Page 1 of 1

Abort job if ran more than 30 minutes

Posted: Fri Mar 01, 2013 1:08 pm
by wittyme
How to abort a parallel job or sequence if it is running more than 30 minutes?

I searched the forum and I couldn't find any particular answer. We use a scheduling tool and that creates a ticket if it exceeds max time out.

But I need to abort the datastage job. Just want to know if there is any environment variable for this.

Posted: Fri Mar 01, 2013 1:26 pm
by priyadarshikunal
Why you want to abort the job if it reaches 30 minutes mark. There might be much more data in input than expected, to make it cross the timelimit defined?

Posted: Fri Mar 01, 2013 1:31 pm
by wittyme
The data in the file is very less. The job hangs due to DS administration issues which I am not sure of.

If I abort the job so it will run again as the job is scheduled within short intervals of time if not it will wait until someone manually go into director and abort it. The job runs throughout the day.

Posted: Fri Mar 01, 2013 2:23 pm
by chulett
Have your scheduling tool issue the stop request from the command line.

Posted: Fri Mar 01, 2013 2:33 pm
by wittyme
No, it doesn't.

I read in an other blog that it cannot be done inside the job and has to have a different job to monitor it.

Posted: Fri Mar 01, 2013 2:37 pm
by chulett
That wasn't a question. If your scheduler creates a ticket when the threshold is passed, why not have it also stop the job?

Posted: Fri Mar 01, 2013 2:43 pm
by sudha03_vpr
You can probably write a shell script using dsjob command to stop the job if the DSJ_JOBELAPSED (gets the elapsed time in seconds) > 1800 seconds. What scheduler do u you use to trigger the jobs ?

Posted: Fri Mar 01, 2013 2:50 pm
by ray.wurlod
Use a Constraint expression that tests how long it has been since the job started and send the row down an output link with a row count limit of 1.

In a sequence remember the job start time using a User Variables activity and, at specific places in the sequence, compare this against current time.

Neither of those will work if the "running" time is increasing because of waiting on an external resource, such as a lock (deadlock) in a database.

Ideally, as others have noted, monitor externally to the job/sequence and issue Stop request.