Six Stars

Passing a context environment to child jobs

I am using the tParallelize component to run a couple of jobs in Parallel - see the attached screenshot.

 

However, when I run this job using in the "prod context", the child jobs run in the "Default context" even though I want it to run in the "prod context".

 

What's the best to resolve this issue?

16 REPLIES
Six Stars

Re: Passing a context environment to child jobs

Hello,

 

Do tou have set prod in the tRunJob properties ?

 

 

Six Stars

Re: Passing a context environment to child jobs

Hello,

How would I use tRunJob in this scenario?

Six Stars

Re: Passing a context environment to child jobs

Take a look to the attached screenshot

Six Stars

Re: Passing a context environment to child jobs

tried what you suggested - see screenshots - the "prod" context is stil not picked up by the child job - it's using "Default".

Six Stars

Re: Passing a context environment to child jobs

here is the job output

Twelve Stars

Re: Passing a context environment to child jobs

You do not want to use contexts (or context environments), they are terrible. Don't get me wrong, context variables are awesome. However the contexts (DEV,TEST, PROD, DEFAULT, etc) just lead to issues. Just use a default context. Use the implicit context load functionality to load your context variables from a file or database. This way you can handle the context in one location (file or database). 

Rilhia Solutions
Six Stars

Re: Passing a context environment to child jobs

Thank you very much for your response.

 

I am new to Talend and still learning.

 

Can you please briefly outline how I can implement the solution you are proposing? A screenshot of a sample job would be really helpful :-)

Six Stars

Re: Passing a context environment to child jobs

Maybe in the "execution tab" you let the default environement ?

Six Stars

Re: Passing a context environment to child jobs

Hmmm, not sure what you mean by "execution" tab.

 

I am trying to run this using Talend Studio, not tac.

Twelve Stars

Re: Passing a context environment to child jobs

Take a look at this: https://help.talend.com/reader/Z6nEoVnqAU2j~MFxYHYeOg/LfezCT8~JqVthW~n~utV6g

The above page shows how to set it up against a database table. You should be able to extrapolate from that to using a file. The format of the file needs to be....

 

ContextVariableName1=Value1
ContextVariableName2=Value2
ContextVariableName3=Value3
ContextVariableName4=Value4
Rilhia Solutions
Six Stars

Re: Passing a context environment to child jobs

Execution tab is that (see screenshot)

Six Stars

Re: Passing a context environment to child jobs

Didn't work even after I set the context to prod in the execution tab - see screenshot.

Six Stars

Re: Passing a context environment to child jobs

- Trunjob param set the right env,
- Execution tab parameter set the right env,
- Tick "transmission of all context" parameter checkbox in the trunjob compoonent propertie
Six Stars

Re: Passing a context environment to child jobs

so, here is my issue.

 

If I execute a simple tRunJob with

- Trunjob param set the right env,
- Execution tab parameter set the right env,
- Tick "transmission of all context" parameter checkbox in the trunjob compoonent properties

it works.

 

However, I need to run a tRunJob with a job that has multiple tRunJob.

In this case, then even though I transmit all context, the 2nd level tRunJob doesn't inherit the context from the 1st level tRunJob.

 

Essentially, I am trying to parallelize about 20 different jobs using the tParallelize component - see my original screenshot.

Twelve Stars

Re: Passing a context environment to child jobs

This is the reason for my suggestion. This is one of the reasons the contexts cause issues. If you only have a single default context and supply your different environment variables using a file or database, you can control this far easier.

Rilhia Solutions
Six Stars

Re: Passing a context environment to child jobs

Thanks. I totally understand. I was hoping to get away without having to redo the context group logic :-)