Hi,
I have a job sequence which executes a command that fetches a lot of files to the server, and then processes them. This sequence is scheduled to run daily.
However, it's fairly common that, for a given day, those files aren't present at the source. This should not be treated as an error, but I also need to stop all the further processing after that invocation since, without the files, the next job activities will fail.
To accomplish this, I have the ExecuteCommand activity, and three outbound links. One for return code 0 (success, proceed normally), one for return code 1 (FileNotFound) and one for Otherwise (error while trying to get the files).
Link success goes to the rest of the processing activities.
Link Error goes to a routineActivity that invokes a custom routine I coded that sends a custom email depending on the return code received.
Link FileNotFound goes to a termination activity, since I found no input files at the source and want to stop processing without sending the email.
This works, but also leaves my job in "Aborted" state, which the end user doesn't want.
Is there a way to stop the job execution without leaving the job in "aborted" state? Currently I found a workaround: In the custom email routine, I don't send the email if the return code is the one for FileNotFound. I suppose I could create a custom routine that does nothing but log a message and use a call to that using a RoutineActivity instead of a terminator, but I was wondering if there was a better, non-dirty way of doing this
thanks in advance.
How to stop a job sequence without aborting
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 67
- Joined: Thu Aug 09, 2007 7:51 pm
If you want to run the process only when retrurn code=0 then
Have two links from the command activity stage .
one for return code=0 , which executes rest of the processes .
one for otherwise , Which just exits the process and send an email with message ( could return code=1 or other error message).
This way you avoid the job getting aborted .
remove termination activity stage.
Have two links from the command activity stage .
one for return code=0 , which executes rest of the processes .
one for otherwise , Which just exits the process and send an email with message ( could return code=1 or other error message).
This way you avoid the job getting aborted .
remove termination activity stage.
There is nothing good or bad, but thinking makes it so. --William Shakespeare
-
- Premium Member
- Posts: 67
- Joined: Thu Aug 09, 2007 7:51 pm
Thanks Craig, I tried it and it works as expected.chulett wrote:Remove the Terminator (which aborts the job) and replace it with a Sequencer. Job just stops.
Last edited by shankar_ramanath on Wed Feb 20, 2008 2:49 pm, edited 1 time in total.
-
- Premium Member
- Posts: 67
- Joined: Thu Aug 09, 2007 7:51 pm
Hi Paddu,paddu wrote:If you want to run the process only when retrurn code=0 then
Have two links from the command activity stage .
one for return code=0 , which executes rest of the processes .
one for otherwise , Which just exits the process and send an email with message ( could return code=1 or other error message).
This way you avoid the job getting aborted .
remove termination activity stage.
Thanks for your response.
Actually, what you describe is how it happens now. However, the email notifications are intended to happen only in case of an error, and I need this particular case to stop the job without the email (support mailing list members will thank me if I manage to do that )
I just tried Craig's suggestion (replace Terminator with Sequencer) and it works ok. The return code for FileNotFound now links to a sequencer that's named "stopProcessing" and has a logging message of "No files found in server, stopping normally". Job ends, logs say why, and the status isn't aborted. Perfect!