Child job to update context variable

Five Stars

Child job to update context variable

I need to pass a value from my parent job to the child job, update it and pass it back to my parent job. 

 

I'm okay if this is either through context variable or through global variable.

 

In this scenario, after I transmit the value I force to child job to fail ( tDie). But I still need the updated value in my main job.

 

Can anyone help on how to achieve the same ?

 

 


Accepted Solutions
Community Manager

Re: Child job to update context variable

You cannot do this I'm afraid.

 

You can pass a context variable to a child job easily enough. 

You can pass the value back using a tBufferOutput component at the end of the child job. The value would need to be passed back as part of a datarow.

However, if you kill the child job with a tDie, it ends there and then. Why would you do this? You are essentially killing the Java execution of your program/job. You should only do this if you need the process to stop dead.

 

What you could try is sending the data back to the parent using the tBufferOutput and killing the job after this is done. That might work. The other thing you can try is to write the value out to a database or similar.

 

Unfortunately you cannot pass a context variable back to its parent without going through a convoluted process.

View solution in original post


All Replies
Community Manager

Re: Child job to update context variable

You cannot do this I'm afraid.

 

You can pass a context variable to a child job easily enough. 

You can pass the value back using a tBufferOutput component at the end of the child job. The value would need to be passed back as part of a datarow.

However, if you kill the child job with a tDie, it ends there and then. Why would you do this? You are essentially killing the Java execution of your program/job. You should only do this if you need the process to stop dead.

 

What you could try is sending the data back to the parent using the tBufferOutput and killing the job after this is done. That might work. The other thing you can try is to write the value out to a database or similar.

 

Unfortunately you cannot pass a context variable back to its parent without going through a convoluted process.

View solution in original post

2019 GARTNER 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

Talend Cloud Developer Series – Defining Metadata

This video focuses on different methods of adding metadata to a job in Talend Cloud

Watch Now

Talend Cloud Developer Series – Updating Context Variables

This video will show you how to add context parameters to a job in Talend Cloud

Watch Now

Talend Cloud Developer Series – Deploying First Job to Cloud

This video will show you how to run a job in Studio and then publish that job to Talend Cloud

Watch Now