Question Richard Prouvot · Aug 28, 2024

JOB $SYSTEM.obj

IS THERE A WAY TO JOB A $SYSTEM.OBJ FUNCTION AND FIND IF THE JOB IS RUNNING OR FINISHED TO ASYNCHRONOUSLY CONTINUE OR HALT THE PROCESS?

Comments

Oliver Thompson · Aug 28, 2024

When you JOB a process you can get the ID of the child Process with $ZCHILD.

You can then check to see if that process is still running.

Not sure whether you can HALT the process or not, and depending on what it is you are running, it might not be a good idea.

0
Richard Prouvot  Aug 28, 2024 to Oliver Thompson

THANKS FOR THAT.

THE MORE IMPORTANT PART OF THE QUESTION IS CAN YOU "JOB $SYSTEM.OBJ" FUNCTION. ON MY MACHINE, I GET THIS:

USER>JOB $SYSTEM.OBJ.Export("RICHS.int","c:\ads\richh.rtn")
 
JOB $SYSTEM.OBJ.Export("RICHS.int","c:\AAA\richh.rtn")
^
<UNIMPLEMENTED>
USER>

0
Roger Merchberger  Aug 28, 2024 to Richard Prouvot

Just create a "job wrapper" around the function, then JOB the subroutine:

JOBEXPORT ; SET UP A ROUTINE TO EXPORT A FILE.Q; USE SEPARATE ENTRY POINT, JUST IN CASE...;
SAVE ; HERE'S THE ACTUAL SUBROUTINE TO EXPORT THE ROUTINE.; IT THROWS AWAY ANY I/O, MAYBE YOU DON'T WANT THAT.D$SYSTEM.OBJ.Export("RTOSAVE.INT","E:\Z\SAVEDROUTINE.RTN")
 Q

Then, just JOB the subroutine and get the job number:

JOB SAVE^JOBEXPORTSET CHLD=$ZCHILDWRITE CHLD,!

( This prints the child process ID, if you don't need to see it you can omit the last WRITE statement. )

Later, to see if the routine is still working, use the $DATA and $^JOB functions:

WRITE$DATA(^$JOB(CHLD))

If the 0 the job has completed (or possibly crashed, I suppose) - if it's 1 then the task is still running. There are utilities both in the Management Portal and in the %SYS namespace to terminate rogue processes.

Hope this helps!

[[ Edited for minor error in code... there might be more. ]]

0
Enrico Parisi  Aug 28, 2024 to Richard Prouvot

Instead of the $SYSTEM "shortcut", use the actual full syntax:

JOB ##class(%SYSTEM.OBJ).Export("RICHS.int","c:\AAA\richh.rtn")

0
Julius Kavay  Aug 28, 2024 to Richard Prouvot

This is possible, but you have to use it the correct way. $SYSTEM.OBJ is just a shorthand for ##class(%SYSTEM.OBJECT), so the correct syntax for your desire is:

job##class(%SYSTEM.OBJ).Export("yourRoutine.mac","yourPathAndFilename.xml")
0