Stop the sequence at specific 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
SachinCho
Participant
Posts: 45
Joined: Thu Jan 14, 2010 1:23 am
Location: Pune

Stop the sequence at specific time

Post by SachinCho »

I have a datastage sequence which runs for 24 hours. I want stop this job on friday night and restart again on monday morning. Restarting can be done manually. Any pointers how to stop at specific time? This should be graceful exit and job should be in stopped/restartable state and not in aborted.
Sachin C
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Depends, but almost certainly not. A sequence spends most of its time uninterruptably asleep waiting for activities to finish. If you check the system time after each activity finishes you can direct control to an "ending" path. The more complex the sequence, the more additional activities you will need to implement the design.

You can use a job control routine using the sequence generated code as the prototype, and replace the DSWaitForFile() function with our own code that checks the time at each pulse of the "busy wait". But what do you want to happen to activities that are already running in this case?
Last edited by ray.wurlod on Thu Jul 01, 2010 3:15 am, edited 1 time in total.
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 »

I think you won't be able to restart a sequence from the point you stopped as stopped/restartable status is not a valid restartable status prior to 8.x.
Priyadarshi Kunal

Genius may have its limitations, but stupidity is not thus handicapped. :wink:
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

As Ray notes, you need to build that functionality in. I always have some kind of "date/time/loop" check built in so it can gracefully stop on its own and add a polling step so I can touch a stop file into existence and it will notice and again do a graceful shutdown.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

On option is to have another process issue a STOP request at a given time, the job sequence will the sto the next time it polls, or you can use the DSGetJobInfo(JobHandle,DSJ_JOBCONTROL) call to check to see if a stop request is pending.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

As everyone will say and agree, a graceful termination is better than killing the process. Also it is cleaner to maintain without any threads hanging.

One possibility I thought about is to decrease the priority of DataStage with Unix nice command to such a level that the OS will not even bother about it.

Alternatively you can schedule a non-DataStage command with high priority during the weekend to keep all other process asleep.

But note that this is your OS level and impacts all other process too.
rameshrr3
Premium Member
Premium Member
Posts: 609
Joined: Mon May 10, 2004 3:32 am
Location: BRENTWOOD, TN

Post by rameshrr3 »

I had done this around 4 years ago with datastage sequences and datastage Command lineinterface. Create a scheduled job that will create a dummy file whenever the main sequence needs to be stopped, introduce a wait for file condition in a loop wrapping the main sequence , when file is found use a command activity to stop the job using

Code: Select all

dsjob -stop 
( I know there is a way to stop a job using dsjob - you could get it in the documentation..), and optionally cleanup the dummy file with another command ..

HTH

Ramesh
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Or just exit the loop cleanly when your stop condition (whatever it is) is found. No need to do anything less graceful, really. IMHO. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply