tRunJob Returning an Error

Highlighted
Six Stars

tRunJob Returning an Error

Hi

I'm trying to check the return code on a tRunJob component to throw an error in my parent when the child job fails.  Could anyone tell me how I can achieve this as right now even though my child is forced to fail the parent thinks it has worked.

 

I was initially using onSubJobOK as seen in the attached but as the parent thinks its ok it flows down the ok path.

 

Any help would be great!

 

D


Accepted Solutions
Employee

Re: tRunJob Returning an Error

Hi Dave,

 

       Could you please verify whether the "Use an independent process to run SubJob" option has been unchecked in your job?

 

       You can keep the Die on child error as either Yes or No based on your specific use case. But the above check box for independent job should be unchecked.

image.png

 

 

 

       If the issue still persists, could you please share the component details screenshot for your tRunJob component for analysis? 

 

      If the answer has helped to resolve your query, could you please mark the topic as resolved? Kudos are also welcome :-)

 

Warm Regards,

 

Nikhil Thampi


All Replies
Six Stars

Re: tRunJob Returning an Error

You can check the condition of die on child error for the trunjob component.

Then connect your trunjob with a tglobalvariable through onsubjoberror and assign error_message of trunjob (which you can find in its properties (clt+space) to a variable.

At last use in post job check in tmap if the error code>0,if yes use tdie to make it die.

Six Stars

Re: tRunJob Returning an Error

Hi

 

I'm not following.  So let me step through what you're saying...

  1. In the child job - set a global variable when the onSubJobError is thrown.
  2. In the parent - get the value of the global variable as an output from the tRunJob
  3. Use the value of the error in a tMap to then decide whether to throw a tDie or not?

This correct?

 

Only problem is I've tried this and get an error.  See the 3 images attached....

 

D

 

Employee

Re: tRunJob Returning an Error

Hi Dave,

 

       Could you please verify whether the "Use an independent process to run SubJob" option has been unchecked in your job?

 

       You can keep the Die on child error as either Yes or No based on your specific use case. But the above check box for independent job should be unchecked.

image.png

 

 

 

       If the issue still persists, could you please share the component details screenshot for your tRunJob component for analysis? 

 

      If the answer has helped to resolve your query, could you please mark the topic as resolved? Kudos are also welcome :-)

 

Warm Regards,

 

Nikhil Thampi

Six Stars

Re: tRunJob Returning an Error

Hi Nikhil

Yes - this is all now working fine thanks.  Sorry - should have responded earlier.

 

I ended up using tBufferOutput to return a code which I could then check in the parent job through a tMap and process accordingly as you will see in the attached.

 

Thanks for your help!

 

Dave

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog