Run a job without waiting to complete
Moderators: chulett, rschirm, roy
Run a job without waiting to complete
Hi all,
We have build a sequence with a loop that must be run a job every hour. Each running job has it's own unique invocation id to make it possible that the same job can run twise (or more ) at the same time.
Each hour the job will be started even if the previous job is still running.
After starting the loop in the seqeunce, the job will be runnning. Now we don't want to wait untill the job is finished otherwise the job can not start the next hour because the seqeunce is still be waiting to finish the previous job run.
So the qeustion is: How can we run a job without waiting to be finished.
We have build a sequence with a loop that must be run a job every hour. Each running job has it's own unique invocation id to make it possible that the same job can run twise (or more ) at the same time.
Each hour the job will be started even if the previous job is still running.
After starting the loop in the seqeunce, the job will be runnning. Now we don't want to wait untill the job is finished otherwise the job can not start the next hour because the seqeunce is still be waiting to finish the previous job run.
So the qeustion is: How can we run a job without waiting to be finished.
I'm not sure why you can't work around the issue of waiting for the job to finish in the sequence, but yes, you can call a command stage and issue the appropriate "dsjob -run" command from a sequence.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
This job seqeunce is the first job in my process to run all other processes after each hour. But when a process is still busy. The first job seqeunce must start all other processes with a new invocation id.
The problem is if a job is started in the seqeunce the job seqeunce will wait until the job has finshed and wait than an hour.
The problem is if a job is started in the seqeunce the job seqeunce will wait until the job has finshed and wait than an hour.
In that case you should write a "master" sequence which calls the first job/sequence without waiting. I see two ways to do this for you:
1 - use the command to run "dsjob -run -mode normal {job} {project}"
2 - use a job activity to start the job in a sequence. Then look at the job control for the BASIC code that has been generated and you can see where to remove the WAIT. Note that changes disappear when you recompile, so this is not the recommend route.
1 - use the command to run "dsjob -run -mode normal {job} {project}"
2 - use a job activity to start the job in a sequence. Then look at the job control for the BASIC code that has been generated and you can see where to remove the WAIT. Note that changes disappear when you recompile, so this is not the recommend route.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You can use an Execute Command activity to execute dsjob, as others have noted.
You can also use a Routine activity to call UtilityRunJob, or a routine of your own that submits the run request and exits without waiting for the job to finish.
You can also use a Routine activity to call UtilityRunJob, or a routine of your own that submits the run request and exits without waiting for the job to finish.
Code: Select all
FUNCTION RunJobNoWait(JobName, InvocationID)
$IFNDEF JOBCONTROL.H
$INCLUDE DSINCLUDE JOBCONTROL.H
$ENDIF
hJob = DSAttachJob(JobName : "." : InvocationID, DSJ.ERRNONE)
Ans = DSGetJobInfo(hJob, DSJ.JOBNAME)
If Ans >= DSJE.NOERROR
Then
Ans = DSRunJob(hJob, DSJ.RUNNORMAL)
End
ErrCode = DSDetachJob(hJob)
RETURN(Ans)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.