Job Sequencer Problem

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
bapajju
Participant
Posts: 82
Joined: Wed Nov 19, 2003 11:58 pm

Job Sequencer Problem

Post by bapajju »

Hello,

I am facing a typical problem. I have never faced this before. I have a Sequencer which intern has multiple sequensers inside it with proper dependencies. Let's say My parent Sequenser is PS and the child sequencers embeded in it are S1, S2, S3, S4, S5. Now the dependency is as below:

S1->S2->S3->S4->S5

On sucess of S1, S2 should run and On Success of S2, S3 should run and so on....

Now the problem is when I execute the Parent Sequenser PS, even if the Sequenser S3 fails (Due to Soem reason), the next Seuqnser gets Kicked off and starts runnign. It's quite unnantural.

In The Trigger Tab of the S3, I have the following options:

Expression Type : Ok (Conditional)
Expression: "Executed Ok"

Could you please help me.

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

Post by chulett »

Actually, this is a very typical problem people run into when first having Sequencers running sequencers. :wink:

You see, S3 hasn't failed - one of the jobs S3 was responsible for running failed. S3 finished without error - and that's the crux of your problem. A child Sequencer needs to propogate any errors 'upstream' so the parent Sequencer knows it had an issue.

Accomplish this a couple of different ways depending on your version. Basically you need to funnel any failed jobs to a Routine Activity stage that calls one of the Utility routines like UtilityWarnToLog. Logging a warning in a child Sequencer's log will give the parent Sequencer something to notice.
-craig

"You can never have too many knives" -- Logan Nine Fingers
sun rays
Charter Member
Charter Member
Posts: 57
Joined: Wed Jun 08, 2005 3:35 pm
Location: Denver, CO

Re: Job Sequencer Problem

Post by sun rays »

bapajju wrote:Hello,

I am facing a typical problem. I have never faced this before. I have a Sequencer which intern has multiple sequensers inside it with proper dependencies. Let's say My parent Sequenser is PS and the child sequencers embeded in it are S1, S2, S3, S4, S5. Now the dependency is as below:

S1->S2->S3->S4->S5

On sucess of S1, S2 should run and On Success of S2, S3 should run and so on....


In The Trigger Tab of the S3, I have the following options:

Expression Type : Ok (Conditional)
Expression: "Executed Ok"

Could you please help me.

Thanks in Advance
Along with OK(conditional trigger) you need to have two more triggers, one for Finished with warnings , use this trigger to call ForceWarn routine, and one for Abort(use this trigger to call ForceAbort routines). You can route these triggers from different jobs through a sequencer using "any" option to call the routines. As Chulett mentioned, this would allow the warning to propagate all the way to the parent job.
Last edited by sun rays on Tue Oct 11, 2005 9:38 pm, edited 2 times in total.
bapajju
Participant
Posts: 82
Joined: Wed Nov 19, 2003 11:58 pm

Re: Job Sequencer Problem

Post by bapajju »

Thanks for the prompt response. But I am new to Sequenser and I do not know how to have Multiple Triggers for a Singel Job Sequencer. Could you please be more elaborate on how to achieve this.
sun rays wrote:
bapajju wrote:Hello,

I am facing a typical problem. I have never faced this before. I have a Sequencer which intern has multiple sequensers inside it with proper dependencies. Let's say My parent Sequenser is PS and the child sequencers embeded in it are S1, S2, S3, S4, S5. Now the dependency is as below:

S1->S2->S3->S4->S5

On sucess of S1, S2 should run and On Success of S2, S3 should run and so on....


In The Trigger Tab of the S3, I have the following options:

Expression Type : Ok (Conditional)
Expression: "Executed Ok"

Could you please help me.

Thanks in Advance
Along with OK(conditional trigger) you need to have two more triggers, one for Finished with warnings , use this trigger to call ForceWarn routine, and one for Abort(use this trigger to call ForceAbort routines). You can route these triggers from different jobs through a sequencer using "any" option to call the routines.
bapajju
Participant
Posts: 82
Joined: Wed Nov 19, 2003 11:58 pm

Post by bapajju »

Chulett,First of all thanks for your reply. But As I am very new to Sequencer. I am unable to figure out as to how to funnel any failed jobs to a Routine Activity stage that calls one of the Utility routines like UtilityWarnToLog.
chulett wrote:Actually, this is a very typical problem people run into when first having Sequencers running sequencers. :wink:

You see, S3 hasn't failed - one of the jobs S3 was responsible for running failed. S3 finished without error - and that's the crux of your problem. A child Sequencer needs to propogate any errors 'upstream' so the parent Sequencer knows it had an issue.

Accomplish this a couple of different ways depending on your version. Basically you need to funnel any failed jobs to a Routine Activity stage that calls one of the Utility routines like UtilityWarnToLog. Logging a warning in a child Sequencer's log will give the parent Sequencer something to notice.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Drop a Sequence object on the canvas and set it to 'Any'. Drag a new (second) link from each of your Job Activity stages to the Sequence. Change the trigger value in each to 'Otherwise' - this will catch any other status other than 'Finished Ok'.

From the Sequence, run a link to a Routine Activity stage. In that stage, choose to run UtilityWarningToLog and for Arg1 put something appropriate to send to the log as a Warning message. No need to abort anything, the warning will work just fine.

Newer versions (7.5.x?) allow the Exception Handler stage to automatically handle job failures and it can then be linked to a Routine Activity stage as noted above. I haven't had the pleasure yet.
-craig

"You can never have too many knives" -- Logan Nine Fingers
bapajju
Participant
Posts: 82
Joined: Wed Nov 19, 2003 11:58 pm

Post by bapajju »

Thank You Sir. This seems to be cool. Thanks Ton. I will try to implement it. In case of any issue I will again get back to you:).

thanks a lot again


chulett wrote:Drop a Sequence object on the canvas and set it to 'Any'. Drag a new (second) link from each of your Job Activity stages to the Sequence. Change the trigger value in each to 'Otherwise' - this will catch any other status other than 'Finished Ok'.

From the Sequence, run a link to a Routine Activity stage. In that stage, choose to run UtilityWarningToLog and for Arg1 put something appropriate to send to the log as a Warning message. No need to abort anything, the warning will work just fine.

Newer versions (7.5.x?) allow the Exception Handler stage to automatically handle job failures and it can then be linked to a Routine Activity stage as noted above. I haven't had the pleasure yet.
bapajju
Participant
Posts: 82
Joined: Wed Nov 19, 2003 11:58 pm

Post by bapajju »

Craig,

Noe I am facing some other type of problem. Now We want to run the successding sequence even if the preceeding sequence finishes with warnings. But if the preceeding sequence aborts then only we do not want to run the succeeding sequence.

Now when I put "Otherwise" in the second link and 'Finished Ok' in the first link, when warning occurs the "Otherwise trigger gets kicked off and the next sequence dies not run.

Any lead on this.
chulett wrote:Drop a Sequence object on the canvas and set it to 'Any'. Drag a new (second) link from each of your Job Activity stages to the Sequence. Change the trigger value in each to 'Otherwise' - this will catch any other status other than 'Finished Ok'.

From the Sequence, run a link to a Routine Activity stage. In that stage, choose to run UtilityWarningToLog and for Arg1 put something appropriate to send to the log as a Warning message. No need to abort anything, the warning will work just fine.

Newer versions (7.5.x?) allow the Exception Handler stage to automatically handle job failures and it can then be linked to a Routine Activity stage as noted above. I haven't had the pleasure yet.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

bapajju wrote:Now when I put "Otherwise" in the second link and 'Finished Ok' in the first link, when warning occurs the "Otherwise trigger gets kicked off and the next sequence dies not run.
Of course... think about your trigger values. There are three basic status codes a job could finish with: 'Ok', 'With Warnings' or 'Aborted'. Checking for Ok and Otherwise lumps both Warnings and Aborts onto the otherwise side.

To allow both Ok and Warnings in one link you need to go to a Custom trigger and leverage the actual status code values:

Code: Select all

stage_label.$JobStatus = 1 Or stage_label.$JobStatus = 2
1 = Finished Ok
2 = Finished with Warnings
3 = Aborted

stage_label is name of the activity stage as given in the Diagram window.
-craig

"You can never have too many knives" -- Logan Nine Fingers
vcannadevula
Charter Member
Charter Member
Posts: 143
Joined: Thu Nov 04, 2004 6:53 am

Post by vcannadevula »

bapajju wrote:Craig,

Noe I am facing some other type of problem. Now We want to run the successding sequence even if the preceeding sequence finishes with warnings. But if the preceeding sequence aborts then only we do not want to run the succeeding sequence.

Now when I put "Otherwise" in the second link and 'Finished Ok' in the first link, when warning occurs the "Otherwise trigger gets kicked off and the next sequence dies not run.

Any lead on this.
chulett wrote:Drop a Sequence object on the canvas and set it to 'Any'. Drag a new (second) link from each of your Job Activity stages to the Sequence. Change the trigger value in each to 'Otherwise' - this will catch any other status other than 'Finished Ok'.

From the Sequence, run a link to a Routine Activity stage. In that stage, choose to run UtilityWarningToLog and for Arg1 put something appropriate to send to the log as a Warning message. No need to abort anything, the warning will work just fine.

Newer versions (7.5.x?) allow the Exception Handler stage to automatically handle job failures and it can then be linked to a Routine Activity stage as noted above. I haven't had the pleasure yet.

Define the ortherwise link to a On ABort, this will not consider the warnings, unless you specified any warning limits while running the job.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Problem is, not all Aborts are created equal. Jobs can crash or suffer timeouts and other problems that are not considered as 'Aborted'. That's why I prefer to specify the good stuffs and then let all the bad stuffs get caught by the Otherwise trigger. :wink:
-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 »

Recommendation

Don't hard code 0, 1 and 2, etc. Use DataStage constants from the expression editor drop-down list. That way, if "they" ever change the return values, you're covered.

Code: Select all

stage_label.$JobStatus = DSJS.RUNOK Or stage_label.$JobStatus = DSJS.RUNWARN Or stage_label.$JobStatus = DSJS.RESET 
Incidentally, 0 is "running", 1 is "finished", 2 is "finished with warnings" and 3 is "aborted". 21 is "has been reset" and is good to include (see above) if your run mode is "reset if required, then run".
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply