 |
SoftTree Technologies
Technical Support Forums
|
|
Author |
Message |
simpleq
Joined: 02 Mar 2009 Posts: 4 Country: United Kingdom |
|
How can I queue a job from a detached process? |
|
I want to run my jobs as detached processes, but I also want them to start the next job in the chain as each completes. I was using semaphore files initially, but the time elapsed between a job finishing and the next one starting was too-great (up to a minute).
I am trying to add a javascript command "Scheduler.queueJob(10);" to run the next job (jobId=10), but it fails with the following message:
 |
 |
An error occurred while executing automation script: Line 71: Detached job is run in a protected process which may not directly manipulate and run other jobs. It also cannot access scheduling engine and modify system settings. |
Thus I have to run the job in-process which is a risk to the scheduler, which I don't want to do. Is there any way to get round this limitation?
|
|
Tue Oct 06, 2009 9:32 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7952
|
|
|
|
"Detached" mode has nothing to do with job sequencing.. Use synchronous mode (make sure asynchronous option is not checked) to run jobs sequentially in their queue, use asynchronous to run them in the background. To parallelize multiple job streams, use multiple job queues. Simply assign different streams to different queues.
Hope this helps.
|
|
Tue Oct 06, 2009 3:37 pm |
|
 |
simpleq
Joined: 02 Mar 2009 Posts: 4 Country: United Kingdom |
|
|
|
It's a bit more complicated than that, we already run multiple job queues for each stream.
We only want to queue a job if the predecessor completed successfully, so we can't submit them all to the queue at the beginning.
So in the Javascript of job 1, we want to check it has completed successfully then we want to submit the next job to the queue without waiting for a semaphore to be checked. But this can't be done if running "detached", which we need to do to protect the scheduler process from being taken down with a job that crashes (for whatever reason).
So my question remains "how do I submit a job from a detached process"?
|
|
Wed Oct 07, 2009 4:50 am |
|
 |
SysOp
Site Admin
Joined: 26 Nov 2006 Posts: 7952
|
|
|
|
As far as I understand your requirement, you can use "run another job" notification action for "on finish" event. Note that this event is only triggered in case of a successful job completion. This is how you can chain jobs. You can also use job dependencies for the same purpose if you need to build many-to-one dependency
PS. Form detached JavaScript job you can call a command console script using cons.sh/cons.bat to queue another job, or alternatively don't run the job detached, and then you can use Scheduler.queueJob JavaScript method.
|
|
Wed Oct 07, 2009 8:26 am |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|