Hi All,
we have a scenario where job A will be used by sequencers X and Y and we can not make job A multiple instance because of a limitation with the ABAP stage RFC connections.
If X and Y sequencers are started at the same time, one of the sequencers will fail because job A will already be in 'running' status from the other sequencer.
Is there a way we can make the second sequencer wait for the job to become available instead of aborting? something like get job status, if it is not in ready to run status, wait for 30 seconds and re check the job status...
We don't have any external scheduling tools...we run our jobs from director, on demand.
Appreciate your help!
Thanks.
Preethi
How to pause job execution for availability of the job
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 1
- Joined: Thu Oct 08, 2009 4:18 pm
How to pause job execution for availability of the job
Preethi Katragadda
You could write a custom routine, use the API to check the status of the status of the job in question and then do whatever seems appropriate should it be running. Sleep, check again... repeat as needed. Use a routine activity stage before the job that may need to wait.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Oddly enough, I wrote a function today that does exactly that (although it uses a list of jobs).
The basic skeleton, without the error handling and other calls typed in from memory so there might be some syntax errors is:
The basic skeleton, without the error handling and other calls typed in from memory so there might be some syntax errors is:
Code: Select all
JobHandle=DSAttachJob("YourJobToWaitFor",DSJ.ERRNONE)
Ans = -1
LOOP UNTIL(JobHandle=0)
JobStatus = DSGetJobInfo(JobHandle,DSJ.JOBSTATUS)
IF JobStatus <> DSJS.JOBRUNNING
THEN
JobHandle = DSDetachJob(JobHandle)
JobHandle = 0 ;** so we exit the loop
Ans = 0 ;** return OK status
END
ELSE SLEEP 10 ;** sleep 10 seconds before checkig again
REPEAT
-
- Participant
- Posts: 246
- Joined: Mon Jun 30, 2008 3:22 am
- Location: New York
- Contact:
Is it not possible to make another copy of the job?
If not maybe you can also simply create a dummy file 'running.txt' at the beginning of the job and delete it in after job sub routine. And use wait for file activity's 'wait for file to disappear' in either of the job sequence to determine the completion of the job.
If not maybe you can also simply create a dummy file 'running.txt' at the beginning of the job and delete it in after job sub routine. And use wait for file activity's 'wait for file to disappear' in either of the job sequence to determine the completion of the job.
Arun