Abort Sequence after Some time

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
laxman.ds
Premium Member
Premium Member
Posts: 66
Joined: Thu Mar 02, 2006 9:00 am

Abort Sequence after Some time

Post by laxman.ds »

Hi
I have a requirement Where I need to Abort a sequence when the Current time reaches 7:30 AM, Means after 7:30AM Sequence should not continue, If it running It should Abort.

Please advise In this regard.

Thanks
2 B 1 4 ALL
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

The only way a Sequence could do something like this to itself is inbetween activities, but that's not necessarily going to handle the "abort right smack at 7:30" part if (for example) it's in the middle of a long Job Activity.

What you need is another process to monitor the Sequence job. One of the basic functionalities of any job control process is the ability to handle something that's been running "too long". One way we've done something like this is using an Enterprise Scheduler. They can easily check a process at a particular time and if found to be still running at a particular threshold (run time or clock time) can either issue an alert or can attempt to kill the other process from the Enterprise Scheduler itself.

Another choice, one more "DataStage centric", would be to write a small bit of BASIC job control code to check the status of the Sequence job. If it is not found to be running, do nothing. If running, issue a Stop request to either the Sequence itself or the currently controlled running job.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Personally I will do a timing on the jobs and raise alarm of anything behind schedule.

For your requirement....
Split your seq start to call a sleep activity until 7:30 and join it to output link from last stage into a sequence stage.

Output link of seq stage pointing to kill anything still running.

Or simply kill any ds phantoms hanging at 7:30.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Or simply a Routine activity (sleep until 07:30) with an unconditional link to a Terminator, these in the same job sequence as everything else.

The Terminator can send Stop requests to every activity currently running under control of the job sequence in which it occurs.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Hmmm... but if the job finishes before that time, won't the routine still cause the Sequence to wait and then terminate? :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Yes, but another Terminator in the main stream could cope with that.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
kandyshandy
Participant
Posts: 597
Joined: Fri Apr 29, 2005 6:19 am
Location: Singapore

Post by kandyshandy »

Ray, So the sequence will be STOPPED or ABORTED everyday?
Kandy
_________________
Try and Try again…You will succeed atlast!!
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It's a solution. I don't particularly like it, but it's a solution.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
vasa_dxx
Participant
Posts: 39
Joined: Sun Sep 28, 2008 2:59 am
Contact:

Post by vasa_dxx »

Just Curious. Does this frequent Abort & Kill affect the Job performance in the Long Run?

And whether the Job should start from previous abort point( Check Point Run) OR Start afresh
Two wrongs don't make a right. But three lefts do.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

1. No.
2. You can elect (design) for either of these behaviours.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
priyadarshikunal
Premium Member
Premium Member
Posts: 1735
Joined: Thu Mar 01, 2007 5:44 am
Location: Troy, MI

Post by priyadarshikunal »

ray.wurlod wrote:It's a solution. I don't particularly like it, but it's a solution. ...

Well this approach can give the desired result but what is in my mind currently i am writing the same

1. At the begining of the top sequence write 0 to a file or environment variable or some where else where it static during the execution.
2. At last if every thing finishes successfully change value to 1.
3. Routine (sleep till 7:30 modified) with conditional trigger to terminator.

Routine (sleep till 7:30 modified) - you may wish to break this in parts
1. don't sleep.
2. Keep reading for that file every half an hour.
3. Keep track of time.

if the value in file changes to 1 return 0. No need to trigger the terminator.

if its 7:30 and the value in that file is still 0 then
1. return 1
2.you may wish to give a custom message
3. call terminator to abort everything.

this is the solution in datastage. but I prefer putting a shell script in cron and cheking the status and aborting from there itself.

Please let me know if there is any descripency or if you think it won't work or you have a better solution because I never tried it.

Regards,
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
Post Reply