Aborted Child Jobs in not detected from Parent Job Sequence

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

Christina Lim
Participant
Posts: 74
Joined: Tue Sep 30, 2003 4:25 am
Location: Malaysia

Aborted Child Jobs in not detected from Parent Job Sequence

Post by Christina Lim »

Hello all,

I have a lot of job sequences. Then I have a main job sequence to link up all the child job sequences. My problem here is that the parent job sequence are not able to detect the job abortion in one of the jobs in the child's job sequence. As a result, though one of jobs in the child job sequence aborts, that child job sequence still return finished status. Thus the main job sequence continues with the run of the next job sequence. How am I able to solve this?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

This is actually a pretty straight-forward problem to solve. :wink:

We added a Routine stage to the error handle section of all of our 'Child' Sequences. When a job has problems, do your normal error handling (send an email, whatever) and then execute one of the "Utility???ToLog" routines - either "Warn" or Abort" depending on your preferences. This will write a specific message of a specific type to the Child Sequence's log that will be picked up by the Parent Sequence.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Klaus Schaefer
Participant
Posts: 94
Joined: Wed May 08, 2002 8:44 am
Location: Germany
Contact:

Post by Klaus Schaefer »

Or, similar, as I do in most of my projects:

1. Start each child sequence with a routine to set the UserStatus to 'NOK'
2. End each child sequence when the last job runs ok by again calling the same routine setting the UserStatus to 'OK'
3. Now, in each caller sequence you can trigger the follow up processes by checking the UserStatus returned. If it's 'OK' - everthing was fine. If it's still 'NOK' - there's been a problem and you can act accordingly.

Klaus
Christina Lim
Participant
Posts: 74
Joined: Tue Sep 30, 2003 4:25 am
Location: Malaysia

Post by Christina Lim »

Many thanx for the response. Sorry for being naive.
I have not used the Routine stage before.
Can u please elaborate further on the steps to do it?
Am I suppose to add Routine Stage before and after each jobs in the child job sequences as well as the parent job sequence?
And how do I set the UserStatus to 'NOK'?
chucksmith
Premium Member
Premium Member
Posts: 385
Joined: Wed Jun 16, 2004 12:43 pm
Location: Virginia, USA
Contact:

Post by chucksmith »

In your child sequence:

1) each JobActivity stage should have a failed trigger (link) going to a single Sequencer stage.

2) The mode of the sequencer stage should be set to "Any".

3) The output trigger (link) from the Sequencer stage should be connected to a RoutineActivity stage.

4) In the RoutineActivity stage, set the Routine name to \sdk\Utility\UtilityAbortToLog, and set Arg1 to some descriptive text.

Piece of cake! :wink:

Chuck
Christina Lim
Participant
Posts: 74
Joined: Tue Sep 30, 2003 4:25 am
Location: Malaysia

Post by Christina Lim »

Let me get things right here.

Quoted:
4) In the RoutineActivity stage, set the Routine name to \sdk\Utility\UtilityAbortToLog, and set Arg1 to some descriptive text.


If I needed UtilityAbortToLog as well as \sdk\Utility\UtilityWarningToLog, should i add another output trigger (link) ?
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Christina Lim wrote:If I needed UtilityAbortToLog as well as \sdk\Utility\UtilityWarningToLog, should i add another output trigger (link) ?
Yes, mostly. You can add another triggered link from a Job stage or simply chain them together, one after the other. It really depends on exactly what you are trying to accomplish.

Each Routine Activity can only run a single routine. If for some reason you need to write both a Warning and an Abort message to the same log (?) make sure you do them in that order. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
chucksmith
Premium Member
Premium Member
Posts: 385
Joined: Wed Jun 16, 2004 12:43 pm
Location: Virginia, USA
Contact:

Post by chucksmith »

From my perspective,it is up to you. When a child fails (aborts), do you want the parent sequencer to receive a warning message, or a fatal (abort) message?

Perhaps you want to repeat steps 1 through 4 for warnings, too. In this case, let's try these instructions:

1) each JobActivity stage should have a failed trigger (link) going to an abort Sequencer stage, and a warning trigger (link) going to a warn Sequencer stage.

2) The modes of the both sequencer stages should be set to "Any".

3) The output trigger (link) from the abort Sequencer stage should be connected to an abort RoutineActivity stage, and the output triggers (link) from the warn Sequencer stage should be connected to a warn RoutineActivity stage.

4) In the abort RoutineActivity stage, set the Routine name to \sdk\Utility\UtilityAbortToLog, and set Arg1 to some descriptive text.

5) In the warn RoutineActivity stage, set the Routine name to \sdk\Utility\UtilityWarningToLog, and set Arg1 to some descriptive text.


Your sequence will look something like this:

Code: Select all

Warn           Warn               Job 1             Abort
Routine  <---- Sequencer <------  Job       ------> Sequencer ----> Routine
Activity   Any      ^      Warn   Activity   Fail        ^    Any
                    |                                    |
                    |             Job 2                  |
                    +------------ Job       -------------+
                           Warn   Activity   Fail
This is an example of a child sequencer that can send both warning and fatal messages to its parent.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

I personally don't see a reason why a Sequence would ever need to 'abort' itself. A 'warning' message should do the job just fine. My .02 on that.

I also never (well, hardly ever) use a 'Failed' trigger. Unless I specifically need to differentiate between "Finished (with warnings)" and "Aborted" in a sequence, I simply use an "Ok" trigger and then an "Otherwise" to trap all problems. Without the otherwise trigger, you stand the chance of not properly trapping errors when something odd happens - like a job crashes. Hey, it does happen. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
luie
Premium Member
Premium Member
Posts: 16
Joined: Sun Jan 25, 2004 3:48 pm

Post by luie »

Hi!

I have a similar problem but I am using 7.1. I have a Master Sequence that initiates child sequences. Some of these child sequences run when the previous ones successfully finish.My final sequencer is set to ALL so that it only fires a table update when all child sequences ran successfully. In the child sequences, our job activities are already attached to a Routine Activity that is triggered "Otherwise" so that we can log a message when the job aborts.
However, one of the job sequences aborted but the Master Sequence did not pick it up. What do I have to include in my master Sequence so that it will pick up the status of any child sequence.
Thanks.
Any help is appreciated.
luie
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Checkpoints. 7.1 introduces the concept of 'Checkpoints' in Sequencer jobs. If you upgrade to 7.5 you'll find several new stages for Sequencer jobs that help out even more, but with checkpoints enabled in a Sequencer, it will automate the failure notification and restart. No need to build it all in yourself like we've been discussing here for previous versions.

To be perfectly honest, I haven't played with that feature yet, but it should be documented in your Release Notes and online help. Check it out!

In the meantime, what kind of 'message' do you log when a child sequence has problems? It needs to be of a 'warning' or 'abort' type in order to make the parent sequence sit up and take notice. And that also means your high-level Master Sequence needs 'otherwise' triggers in it as well... does it? (well, unless you are using Checkpoints, that is :wink: )
-craig

"You can never have too many knives" -- Logan Nine Fingers
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

It works great but it requires an extra job stream with an event handler. If you do not trap an event above then the event handler takes that event. Normally we have trapped Ok but occasionaly I have to trap warnings as well so that job has 2 links to a job sequencer one for OK and another for warnings.

Code: Select all

Job1 -> OK1 -> Job2 -> OK2 
                                              -> WaitOnAny -> Job3 -> done
                               -> Warn2

EventHandler -> Email -> AbortToLog
I hope this helps. You still need to call abort to log to notify the parent job that this sequence failed.
Mamu Kim
luie
Premium Member
Premium Member
Posts: 16
Joined: Sun Jan 25, 2004 3:48 pm

Post by luie »

We tried using 'Automatically handle activities that fail' (v7.1) and the Master Sequence aborts when the child sequences abort. This is ok when the routine activity in the Master Sequence returns zero.

However, when the routine activity returns non-zero, the Master Sequence fails when it should not. Apparently this is what happens: A routine activity can return anything; text, number, etc. and when the above mentioned property is checked ('Automatically handle....'), DataStage incorrectly interprets the return value as the status.

We can not get rid of the routine activity in the master sequence and it will not always return 0. That means we can not use that feature.

I am just wondering why the Master Sequence does not notice the aborts in the Child sequences without that enabled. The 'OTHERWISE' triggers in the child sequences logs an 'ABORT' message whenever the jobs fail. Here is the log, Event TYpe:INFO
CRFMaster.27497.JobControl (DSWaitForJob): Job ExchRate.27497 has finished, status = 3 (Aborted)

Any comments?

Thanks.
luie
luie
Premium Member
Premium Member
Posts: 16
Joined: Sun Jan 25, 2004 3:48 pm

Post by luie »

The log that I mentioned above that is of type INFO is for the Master Sequence. The child sequence log is still ABORT.

Thanks.
luie
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Wrap a job around your routine and have it abort if the return value is bad.
Mamu Kim
Post Reply