Keep Sequencer waiting to trigger a job at a particular time
Moderators: chulett, rschirm, roy
Keep Sequencer waiting to trigger a job at a particular time
A Sequence job is scheduled to trigger daily at 10 PM and it runs multiple jobs . There is one Parallel DataStage job(say X) in that sequence that has to run at a particular time at 2 AM. Even if the Preceding jobs finish early before 2 AM, the sequence job should keep running and wait till 2 AM to trigger the job X . If the Preceding jobs finish later than 2 AM, the sequencer should exit . How I can do this ?
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Check whether the time is after 10PM and earlier than 2AM (e.g. User Variables activity). If it is, execute a sleep command to wait until 02:00 then run the job. If it is after 2AM, then bypass that logic. Both streams of logic end up in the same Any sequencer.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Re: Keep Sequencer waiting to trigger a job at a particular
Ray provided the solution..
Another option would be, take out the 'X' job from the main sequence job.
Schedule the main sequence job to run at 10 pm and once it is completed touch 'mainsequencejob.Done' file.
Also schedule the 'X' job to run at 2 AM and have a wait for file activity to check the 'mainsequencejob.Done' file, if it is there continue to run the 'X' job or dont execute the job.
Another option would be, take out the 'X' job from the main sequence job.
Schedule the main sequence job to run at 10 pm and once it is completed touch 'mainsequencejob.Done' file.
Also schedule the 'X' job to run at 2 AM and have a wait for file activity to check the 'mainsequencejob.Done' file, if it is there continue to run the 'X' job or dont execute the job.
Karthik
Thanks Ray and Karthik for the response.
Currently I am checking the time in a shell script and executing the Job, it works fine. I want to simplify the design to get rid of shell script and also I don't want to use touch or done file.
I am more inclined towards Ray solution. Could you please elaborate on the first step : how to check time in User Variable activity?
Also , Sleep HH:MM in the execute command stage failed with a error " invalid time interval "
Even on the Linux box , the error is as below
sleep: invalid time interval `02:00'
Version: DataStage 11.5 on RHEL LINUX
Please help.
Currently I am checking the time in a shell script and executing the Job, it works fine. I want to simplify the design to get rid of shell script and also I don't want to use touch or done file.
I am more inclined towards Ray solution. Could you please elaborate on the first step : how to check time in User Variable activity?
Also , Sleep HH:MM in the execute command stage failed with a error " invalid time interval "
Even on the Linux box , the error is as below
sleep: invalid time interval `02:00'
Version: DataStage 11.5 on RHEL LINUX
Please help.
Just going to address the "Also". That sleep sleeps for an amount of time, by default in seconds, not until a specific time, which is why you got that interval error. So you would need to get the current time as Ray noted and then compute the number of seconds (or minutes) until your target time, then sleep for that interval.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Within DataStage BASIC programming language SLEEP hh:mm is permitted, so you can effect this with a very simple one-line routine.
(Avoid Execute Command - every time you use it you carry the overhead of opening a new shell and starting any processes required in it.)
(Avoid Execute Command - every time you use it you carry the overhead of opening a new shell and starting any processes required in it.)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Code: Select all
Oconv(@TIME, "MT") >= "22:00" Or Oconv(@TIME, "MT") <= "02:00"
A user variable with the above derivation will return 1 (true) or 0 (false), which you can test in any downstream activity.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.