Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[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
Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

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

View solution in original post

16 Replies
Anonymous
Not applicable
Author

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.
Anonymous
Not applicable
Author

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
Anonymous
Not applicable
Author

Hi Hilderich
Using a tBufferOutput component in the child job to pass the error message from the child job to the main job. Refer to this KB article:
https://help.talend.com/search/all?query=Returning+a+value+from+a+child+Job+to+the+parent+Job&conten...
Shong
Anonymous
Not applicable
Author

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
Anonymous
Not applicable
Author

Hello shong, sanvaibhav and jlolling,
As I see there are no limits in being creative. I am grateful for your hints.
Kind regards
Hilderich
Anonymous
Not applicable
Author

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
willm1
Creator
Creator

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).
Anonymous
Not applicable
Author

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
Anonymous
Not applicable
Author

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