Hi,
Can we set timeout period for a job run?
For example if we define a timeout period of 10min and if the job runtime takes more than 10min the job should abort and mail has to be sent abt the status..
Any pointer to accomplish this sort of task???
Job can be either a serverjob or parallel job or sequencer...
Thanks & Regards
Vijay Kumar
How to set time out period for a job run?
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 59
- Joined: Sat May 29, 2004 12:31 am
- Location: Pune
You can get a job's last start time and status from places such as the dsjob command line or within a BASIC program. If the 10 minute time limit is exceeded then you can issue a STOP command to that job. The approach you take is dependant upon where you wish to implement this logic - outside of the DataStage environment or inside.
-
- Participant
- Posts: 59
- Joined: Sat May 29, 2004 12:31 am
- Location: Pune
I want to stop the DS job if it exceeds the time period and i want to implement this from the job control which executes a series of jobs.
All the statements in the Job controler are executed one after the other. After executing the DSRun statement and before the DSRun statement returns its status, I want to calculate the time difference. If the time diff exceeds the thershold I want to abort the job.
Can any one tell me how to accomplish this or some BASIC code to do it.
Thanks in advance.
Regards
Vijay Kumar
All the statements in the Job controler are executed one after the other. After executing the DSRun statement and before the DSRun statement returns its status, I want to calculate the time difference. If the time diff exceeds the thershold I want to abort the job.
Can any one tell me how to accomplish this or some BASIC code to do it.
Thanks in advance.
Regards
Vijay Kumar
Vijay,
you cannot do this type of functionality directly from the sequence which starts the job. Since it is waiting for the job it called to finish it isn't able to simultaneously check for it running too long.
I would have your sequence start two actions in parallel, your job and a Routine Activity which would contain some basic code based on what I've written below. Please note that this code was typed straight in here so there is only a 0.1% chance that it will compile and a 0.001% percent chance that it will work - but it should be enough to show how to approach solving your problem.
you cannot do this type of functionality directly from the sequence which starts the job. Since it is waiting for the job it called to finish it isn't able to simultaneously check for it running too long.
I would have your sequence start two actions in parallel, your job and a Routine Activity which would contain some basic code based on what I've written below. Please note that this code was typed straight in here so there is only a 0.1% chance that it will compile and a 0.001% percent chance that it will work - but it should be enough to show how to approach solving your problem.
Code: Select all
Handle = DSAttachJob(<JobToMonitor>,DSJ.ERRFATAL)
Timeout = 600 ;** seconds
StartTime = TIME()
Finished = 0
LOOP UNTIL Finished
JobStatus = DSGetJobInfo(Handle,DSJ.JOBSTATUS)
IF JobStatus <> DSJS.JOBRUNNING
THEN
Finished = 1
END
ELSE
SLEEP(30) ;** wait for 30 seconds before doing anything
CurrentTime = TIME()
IF CurrentTime < TIME() THEN RunTime = (60*60*24)-StartTime+CurrentTime
ELSE RunTime = CurrentTime - StartTime
IF RunTime > Timeout
THEN
*******************
** Stop the job here **
*******************
Dummy = DSStopJob(Handle)
Finished = 1
END
END
REPEAT
-
- Participant
- Posts: 59
- Joined: Sat May 29, 2004 12:31 am
- Location: Pune
Another option is to leverage your Enterprise Scheduler... if you have one.
For example, we use Control-M to run jobs or series of jobs under our custom job control. Besides the boundries we've defined within our job control, we also have a fall back - Control-M. It is simple for it to monitor the runtime of a 'job' and do something when it exceeds a fixed time. We have it page out when an outer 'boundary box' has been exceeded so that someone can look at it and decide what to do. No sense killing it at 10 minutes if it was going to finish in 10 minutes and 5 seconds.![Wink :wink:](./images/smilies/icon_wink.gif)
For example, we use Control-M to run jobs or series of jobs under our custom job control. Besides the boundries we've defined within our job control, we also have a fall back - Control-M. It is simple for it to monitor the runtime of a 'job' and do something when it exceeds a fixed time. We have it page out when an outer 'boundary box' has been exceeded so that someone can look at it and decide what to do. No sense killing it at 10 minutes if it was going to finish in 10 minutes and 5 seconds.
![Wink :wink:](./images/smilies/icon_wink.gif)
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers