[resolved] How to get the error message from the child job
Dear Helpers,
We have a parent job with a tRunJob component. Both jobs have tLogCatcher inside. Inside the
child job execeptions/errors via tDie can occur. How can the error message passed to the parent
job that calls the sub-job via tRunJob? Are there any globalMap parameters or what approach is
applied for that?
I have found that entry
https://community.talend.com/t5/Design-and-Development/how-to-catch-the-error-message-of-sub-job-at-... but it doesn't work.
I am very grateful for any help.
Kind regards
Hilderich
Hi,
There could be many options to do this.
1) Context variable - enable Transmit whole context. This would transfer the value of context variable to child job.
2) use (getter-setter) routine - Set the error value in subjob and get the same value in parent job
3) Use tFixedFlowInput-->tBuffer in subjob for your error message. Retrieve schema in parent job to get the error message
4) If you are using tlogcatcher - output the result sets to flat file. In parent job read that flat file to see the error message
Thanks
Vaibhav
You could try globalMap.get("tRunJob_1_CHILD_EXCEPTION_STACKTRACE") in case of your error is caused by an exception. Normal tDie messages couldn't be retrieved this way.
Hello jlolling,
Many thanks for answering. Unfortunately I want exactly the tDie message returned to the parent job. The tLogCatcher in the child job is triggerd by tDie and the message is there also received. The question is how to pass it to the parent job? Do you have the answer?
Kind Regards
Hilderich
Hi,
There could be many options to do this.
1) Context variable - enable Transmit whole context. This would transfer the value of context variable to child job.
2) use (getter-setter) routine - Set the error value in subjob and get the same value in parent job
3) Use tFixedFlowInput-->tBuffer in subjob for your error message. Retrieve schema in parent job to get the error message
4) If you are using tlogcatcher - output the result sets to flat file. In parent job read that flat file to see the error message
Thanks
Vaibhav
Hello sanvaibhav,
Your suggestion No 1 explains the return mechanism via context variables. I have tried this but
with no success. Both jobs have one identical context variable 'errorInSubjob' and on tRunJob
the option 'Transmit whole context' is activated. After the sub-job failed and returned back to
the parent job this variable is not set properly. Are there any side attentions to take care?
Kind regards
Hilderich
Hilderich - "Transmit whole context" goes from Parent to Child, not the other way around. The other methods described here would give you that - Talend in-built global variables, tBufferOutput, a global hashmap variable (set/get), a file).
Hello All, I have solved it with a context variable of type Object and assigned to it a Map. In the sub-job I have put an entry of type string into the map and then I was able to read it afterwards in my parent job. I have done my "job". Kind regards Hilderich
Hilderich,
As Willm said, transmit whole context is applicable for parent to child and not from child to parent. But enabling that check box, allows bi-directional flow of variables, else it won't. Resetting the context variable value of parent job is implemented using (getter setter) routines. Suppose I have multiple subjobs called in a job, once I return the context variable value using routine from child to parent job, then again this context variable value is available to all the other subjobs. This way, it becomes easy to manage variables.
Thanks
Vaibhav