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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] Sub Job Execution Control with Context Paramter

Hi All,

I've couple of Sub jobs with OnSubJobOk connection in one main job. Now, I want to control the execution of subjobs with parameters like RUN_FROM & RUN_TO which indicates from which subjob to which subjob to run the main job.

Is there any such functionality provided by Talend to control the execution of subjobs ? If not, Any suggestions to implement such kind of functionality ?

Thanks,
Siva
Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Hi Siva,
Please see attached screenshot 
1. In main job i had defined two variables as "FROM" and "TO" 
2. All subjobs i had connected with mainjob with "Run If" trigger
3. If you connect all subjob with main-job, a order is set on all subjobs
4. checking condition on "Run IF" as
order:1 --> ((Integer)globalMap.get("row5.FROM")) == 1
order:2 --> ((Integer)globalMap.get("row5.FROM")) <= 2 && ((Integer)globalMap.get("row5.TO")) >= 2
order:3 --> ((Integer)globalMap.get("row5.FROM")) <= 3 && ((Integer)globalMap.get("row5.TO")) >= 3
order:4 --> ((Integer)globalMap.get("row5.FROM")) <= 4 && ((Integer)globalMap.get("row5.TO")) >= 4
It works perfectly.
0683p000009MEql.png

View solution in original post

6 Replies
Anonymous
Not applicable
Author

Hi,
Please have a look at a related forum https://community.talend.com/t5/Design-and-Development/Subjob-execution-order/td-p/87954 to see if it is satisfying your need?
Best regards
Sabrina
Anonymous
Not applicable
Author

Hi Sabrina,
Thanks for your quick reply.
I looked at the post that you mentioned. In my case, I've OnSubJobOk connection among all the subjobs.
For Eg: 
Main job
subjob1 --OnSubjobOK---> subjob2---OnSubjobOk--->subjob3---OnSubjobOk-->subjob4---OnSubjobOk-->subjob5.
I want to control the execution like,  I want to start the job from subjob2 and  want to stop the job at subjob4 inside main job.
So, Is there any such execution controller ?

Thanks,
Siva
Anonymous
Not applicable
Author

Hi Siva,
You can use "Run If" instead of onSubjobok and place your RUN_From and RUN_TO condition on every "Run If" trigger
It will only control your RUN_TO condition (i.e you can control upto last subjob you want to run) but if your first subjob not satisfied "If" condition then job will not proceed to next subjob. From this way you can only control your last subjob execution.
subjob1 --IF---> subjob2---IF--->subjob3---IF-->subjob4---IF-->subjob5
Anonymous
Not applicable
Author

Hi Siva,
I tried and got solution. Try to place your initial job in between and from your main job you connect with your all subjobs using "Run IF" trigger and place "IF "conditions accordingly on trigger.
It will look like this                    
0683p000009MEqg.png
Anonymous
Not applicable
Author

Hi Manish,
Thanks for your time.
I understand the IF condition solution to set the start point among the sub jobs. I didn't get you in stop point functionality in your implementation among the subjobs. Will you elaborate how your implemention stops the subjobs which are connected by RUN IF or OnSubJobOK.
Does Talend provide any other way of controlling the subjob executions ?

Thanks,
Siva
Anonymous
Not applicable
Author

Hi Siva,
Please see attached screenshot 
1. In main job i had defined two variables as "FROM" and "TO" 
2. All subjobs i had connected with mainjob with "Run If" trigger
3. If you connect all subjob with main-job, a order is set on all subjobs
4. checking condition on "Run IF" as
order:1 --> ((Integer)globalMap.get("row5.FROM")) == 1
order:2 --> ((Integer)globalMap.get("row5.FROM")) <= 2 && ((Integer)globalMap.get("row5.TO")) >= 2
order:3 --> ((Integer)globalMap.get("row5.FROM")) <= 3 && ((Integer)globalMap.get("row5.TO")) >= 3
order:4 --> ((Integer)globalMap.get("row5.FROM")) <= 4 && ((Integer)globalMap.get("row5.TO")) >= 4
It works perfectly.
0683p000009MEql.png