Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
_AnonymousUser
Specialist III
Specialist III

How to set the context for sub-jobs through command-line?

Let say I have a context group ctxA with three configurations (DEV, UAT, PROD). I also have two jobs - jobA and subJobB. The subJobB is executed by a component tRunJob in jobA. If I run jobA through command-line with parameter "--context=PROD", how to make sure subJobB is also using "PROD" context?
Labels (2)
5 Replies
Anonymous
Not applicable

check "transmit whole context" in your tRunJob
_AnonymousUser
Specialist III
Specialist III
Author

John, the "Transmit whole context" transmits the context group ctxA to the subJobB, not the selection of context "PROD". The context for tRunJob is controled by selecting the item in the dropdown list box for Context in the Basic settings tag and this selection is hard-coded when Talend generates the Java code. This is the code snippet:
currentComponent = "tRunJob_1";
java.util.List<String> paraList_tRunJob_1 = new java.util.ArrayList<String>();
paraList_tRunJob_1.add("--father_pid=" + pid);
paraList_tRunJob_1.add("--root_pid=" + rootPid);
paraList_tRunJob_1.add("--father_node=tRunJob_1");
paraList_tRunJob_1.add("--context=uat");
// for 10589
paraList_tRunJob_1.add("--stat_port=" + portStats);
As you see it is hard-coded as "--context=uat". This is not what I want. What I want is how to make the component tRunJob take what I put in the command-line when run the parent job jboA, such as "--context=PROD".
Anonymous
Not applicable

if you transmit the whole context, all the PROD variables will be copied into the child job-- no matter what group it is configured for-- as long as the variable exists in the father job. I prefer this method of managing contexts, as I only have to change it in once place.
Regardless, you should find a "Context" drop-down in the tRunJob that allows you to choose which context is passed to the child jobs. If you do not see this, please let me know what version of Talend you are using...
_AnonymousUser
Specialist III
Specialist III
Author

John, it seems that you might not really understand what I want to achieve. Let me explain it in another way:
I'm using Teland Enterprise 4.1.2 and I do see "Context" drop-down in the tRunJob. That is what I don't wnat to use to control the the selection of Context of sub-job. What I want is after I export the parent job, I can run the parent job in command-line in different environments (DEV, UAT, PROD) just by specifying different parameter "--context=XXX" without changing the application and re-exporting the job. The issue is that the command-line parameter "--context=XXX" only takes effect for the parent job, not the sub-job. How to make the command-line parameter "--context=XXX" take effect for both the parent job and the sub-job?
Anonymous
Not applicable

Hello
The issue is that the command-line parameter "--context=XXX" only takes effect for the parent job, not the sub-job. How to make the command-line parameter "--context=XXX" take effect for both the parent job and the sub-job?

You need to check the box 'Transmit whole context'.
Best regards
Shong