Child job to update context variable

Highlighted
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.


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.

15TH OCTOBER, COUNTY HALL, LONDON

Join us at the Community Lounge.

Register Now

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

How to deploy Talend Jobs as Docker images to Amazon, Azure and Google Cloud reg...

Learn how to deploy Talend Jobs as Docker images to Amazon, Azure and Google Cloud registries

Blog

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

Talend API Services Publish to Talend Cloud

Learn how to publish your API Services to Talend Cloud

Watch Now