Ending a job gracefully

One Star

Ending a job gracefully

Is there a way to end a job gracefully?
Using a tDie in a sub-job, even with the error code set to 0 and the priority set to Info, will cause the parent job to fail unless I uncheck the "Die on child error" option on the tRunJob.
This is unacceptable as I want the calling job to die in the event of a genuine fault, but in some circumstances I want to end the sub-job with an informational message and let the calling job to continue running.
Thanks in advance
Mario
Moderator

Re: Ending a job gracefully

Hi,
This is unacceptable as I want the calling job to die in the event of a genuine fault, but in some circumstances I want to end the sub-job with an informational message and let the calling job to continue running.

Would you mind giving us a example for your expected result? Or some screenshots for that, which will be appreciated very much.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Ending a job gracefully

Hi Sabrina
An example:
A parent job waits for a file and passes it to a sub-job after it arrives. The sub-job performs a schema compliance check and detects non-compliant rows. At this point, the sub-job should log the error, move the file to a rejected folder, rollback any database changes already processed, die (gracefully) and pass control back to the parent which waits for the next file.
I can't set the parent to ignore child errors as there are other types of errors which which should cause processing to stop,.
While I have your attention, is there any way to check the number of rows (say via a global variable) rejected by a tschemaComplianceCheck component?
Thanks
Mario
Moderator

Re: Ending a job gracefully

Hi,
In order to continue to execute next record in parent job, you have to uncheck the option 'die on error' on tRunJob. In child job, use tLogCatcher to capture all the ava expcetion thrown in child job and the error defined on tDie component.
There is no global variable for the total reject rows, well, you can add a counter and put it to a global variable by yourself on tJavaFlex component. For example:
tFileInputDelimited--main--tschemaComplianceCheck---reject--tJavaFlex--tLogRow
on the begin part of tJavaFlex, define a counter:
int nb_line=0;
on the main part of tJavaFlex:
nb_line=nb_line 1;
on the end part:
globalMap.put("reject_row", nb_line);
you might need more help about tJavaFlex component, please read tJavaFlex
Hope it will help you
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.