Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi everyone,
I have a subjob that uses a set of context groups. During the developement phase of this subjob I loaded manually the context groups that I needed. But now I have set up a parent job that will run the subjob multiple times automatically. While executing the parentjob, it seems that the contexts that I loaded manually are not loaded.
How can I make it so that some context groups are loaded at the beggining of the execution of the subjob?
You don't need to define the schema of tRunJob (ControlDateTest), you have already defined the context variables in child job, so you are able to select the context variables from the Context Param table in the basic setting panel of tRunJob.
To use a context variable, the expression is:
context.varName
eg:
System.out.println("the value of context variable is: "+context.varName);
Hi
Did you mean that select the context variables from repository into subjob or load new value to context variable? Can you explain what you do 'loaded manually the context groups'?
Regards
Shong
Hi, I mean that I clicked and dragged the context group onto my job (maybe there is another way, but this is how I do it). So yes, I used the context group from the repository.
Hi @Lucas Pujol
Did you check the option "Transmit whole context" on the tRunJob components? That way all the context variables and values set in the parent job would be transmitted to the child jobs.
Another useful resource, depending on what you want to achieve, would be using tContextLoad component. It takes key/value parameters from an input (that could be files or database tables, for example) and fill the job context with them.
I think the Transmit whole context does not work because the context groups are on my repository and I drag them to the job. It is not as if I had created some context variables on my job.
For the tContextLoad I dont think that would suit me either because as I said, all the information is on the context groups of my repository, not in files.
Do I have understood it correctly?
Thank you for your help
If you have dropped the context group onto job, open the Context viewer, you can see the variables there, these variables are imported from repository.
Yes, on the subjob the context are loaded. If I run the subjob it works fine, but if I run the parentjob, the subjob does not work and I think it is because of the context.
I think we need more information about your problem, can you show us what are you getting now? and what behavior do you expect? Some screenshots will be helpful for us to understand the problem well.
Sure, my parent job looks like this. My runjob component is configured like this: I know the value expression is correct because I have copied the same thing onto a java component and it gave the good result.
On my child job I have set another tjava component with the next expressions: But all of them give me null values.
My context on the child job is configured like this: What am I missing? I just followed this tutorial : https://help.talend.com/r/en-US/7.3/system/trunjob-tflowtoiterate-tfileinputdelimited-tjava-creating-child-job-to-get-value-from-parent-job-standard-component-create
It is working!! It was a stupid mistake. I forgot to add thisIf it is not that, maybe it is of how I called the variable in the child context. I am not sure because I made both changes at the same time