custom trigger for Sequence Job when child jobs fail

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
syang@collaborative.com
Premium Member
Premium Member
Posts: 33
Joined: Tue Sep 02, 2014 7:43 am

custom trigger for Sequence Job when child jobs fail

Post by syang@collaborative.com »

Hi guys,

Here is my current situation. I have a master sequencer(mas_seq) that will run another sequencer(Seq_stage_load). Seq_stage_load has 20 job activities(stage_job_1, stage_job_2, etc.) that will each run a parallel job. If the parallel job fails, the job activity triggers a failure notification. The Seq_stage_load sequencer triggers a success notification when it completes.

Here is the issue, regardless if the job activities fail or complete, the Seq_stage_load will send out a success email once all the job activities ran.

Goal:
I want the "Success" notification, only if all 20 job activities complete successfully. If any job activities fail, I want to trigger a notification that notifies me some job activities failed.

What are some simple ways to achieve this?

Thanks.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Run Success triggers from all activities to an "All" sequencer.
Run Otherwise triggers from all activities to an "Any" sequencer.
Create a Notification activity downstream of each.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
syang@collaborative.com
Premium Member
Premium Member
Posts: 33
Joined: Tue Sep 02, 2014 7:43 am

Post by syang@collaborative.com »

I'm not sure what you mean. Do you mean to put success and failure notifications for each job activity? Right each job activity has failure trigger only.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

No, he means have one Success notification and one Failure notification. Before each one put a Sequencer - set it to All for the Success email and Any for the Failure email. Then run two triggers from each stage, one to each, as noted.

Another option is for the Success triggers to go from Job Activity to Job Activity with the last success trigger going to the Success email. This if the jobs run in a serial fashion and you want the series to stop at the first failure. The previous design allows all jobs to run regardless of the success or failure of any of the individual jobs.

Now, if you want the master sequence to send out the success notification, you'll need to ensure that any failure in the child Sequence is propagated up to the master - meaning the child sequence must abort when there is a job failure. Use a Terminator for that. It will prevent the master from sending out an inappropriate success email (assuming you have your trigger set up correctly).
-craig

"You can never have too many knives" -- Logan Nine Fingers
syang@collaborative.com
Premium Member
Premium Member
Posts: 33
Joined: Tue Sep 02, 2014 7:43 am

Post by syang@collaborative.com »

Ah, thanks. That sounds simple enough.
Bhargav86
Participant
Posts: 2
Joined: Thu Apr 10, 2014 4:47 am

Re: custom trigger for Sequence Job when child jobs fail

Post by Bhargav86 »

For Success :Link to all actvities to sequencer activity and set trigger condition conditional ok and set in the sequencer activty option as All and connect to notification activity.

For Failure :Link to all actvities to sequencer activity and set trigger condition Failed and set in the sequencer activty option as Any and connect to notification activity.

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

Post by chulett »

In other words, what's already been suggested twice. :wink:

There's a little bit more to it when the child sequence sends out the failures and the master sequence send out the success, which is what the OP is doing.
-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 »

Actually it's sufficient that the sequences log a warning when any activity finishes with a status other than OK. That propagates the problem up to the master sequence (without the need to force jobs to abort) at which point logs can be inspected to detect what the actual problem is. But to resolve the "all success" question, that approach will suffice.
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