Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello, I have multiple parent jobs that use the same Context Variables that are created separately currently.
Now I want these jobs to run one after the other as an executable .bat file and scheduled in Windows Task Scheduler using child jobs in trunjob components.
I know the design setup is trunjob onsubjob ok---> trunjob on subjob ok ---> etc.
What is best practice and design to handle the context variables?
I have my context variables setup to prompt in the parent jobs, I obviously need to turn off the prompt in all the jobs and hard code the values.
I also have a List of Values in some of my context variables. How are these values handled in a trunJob. Does it grab the First value in the list?
If I want every job to run one after the other fully automated.
If all the context variables are the same throughout each parent jobs. Would I setup the child Jobs with the same context variables as the child jobs?
Also I've read that the Context Param in tRunJob component overrides your current Context variables in your parent job. So I wouldn't want to add any of my context variables to that interface.
Please advise
Andrew
Hi Andrew,
In the production scenario, there will not be any prompting for values like in Studio. If you want to pass parameters to conext, you will have to use --context_param followed by variable and value name.
Please refer the below link for details of the context parameters.
https://help.talend.com/reader/HqPypUO_cLctKv_dAWcgFw/bcLKQfu4DXg5cW_7aG6FkQ
There are lot of community posts on this topic. For example,
Warm Regards,
Nikhil Thampi
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
I have about 20 tRunjob components all connected through a subjob ok trigger in one job. If all jobs have the same context variables, and I want to run this Job on Windows Task Scheduler through an executable.bat file. How would you handle the context variables? Would you just leave the context variables in the job itself? Transfer them over to the job with 20 tRunjob components Context Section. Now these context variables need to change each run of the job. So i'm looking for easiest/fatest way to change the variables across multiple jobs. If I'm using a .bat file to run the job then do I have to actually go in the.bat file and change the variables each run? I think this is what you were hinting at in your last post, but just want to confirm.
Let me know
Andrew
Please Advise
Thanks,
Andrew
Hi Andrew,
You can pass the context variables of child jobs through parent job itself. But in this case, the parent job will have a long list of context variables for all the 20 jobs.
Another easier option is to have all the parameters in a file or DB based on the context you want to run. During run time, provide only the DB connection details/ file parameters to your parent job and the balance details will be fetched from the file/DB. But if you are having lot of fluctuating data among context parameters, those details need to be passed during runtime.
If you are having this approach, you will have four file names or table names for each context (dev, test, uat, prod). Hope this should work in your case.
Warm Regards,
Nikhil Thampi
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂
Hey @nthampi
Could you show a screenshot of the component sequence for bringing in the context file and Talend processing it to grab the values out of it for a tRunjob component? Also could you provide the syntax of the the file format, for passing context variables to child jobs? If you can show it for two jobs, I can use it for the 20 jobs I have. If I do bring in a file I don't need the original context variables in the child jobs Im guessing?
If there is a post that explains this process, you can just post the link to this discussion.
Thanks,
Andrew
There are several ways to handle context. For what I have read you could consider this:
Create a context group for your context values
Add the context group to all main and subjobs
on your tRunJob check "Parse context to subjob"
Optionally add a tContextLoad in your main job to load the changing context values.
Do you know if you're suppose to add the context variables into the argument section of the Task Scheduler? If you look at my Screenshot there is an option for Add Arguments. Can you confirm that as long as the context variables are set in the child jobs properly. When I execute the .bat file of the parent job that the context variables will be included and carry over?
Add Arguments
Also,
What options would I choose when Building the parent Job in Talend. I just want the context in the child jobs to execute. I plan on having to change the context variables after each run of this job. So i'm not sure once the job is built if the child jobs contexts can change unless I build a new job each run. What options would I choose in this window for allow me to change the context variables before each run.
Please advise
Hi Andrew,
As shown in my earlier post and link, you can add multiple parameters while calling the job in Bat file. The syntax is also present in previous example.
If you want to refer a sample scenario for reading the data from DB to context variables, please refer the below link where tContextLoad is used to read the data from DB to context variables.
https://help.talend.com/reader/hm5FaPiiOP31nUYHph0JwQ/kOFmhYmRncFBqwTo_kAzaw
Warm Regards,
Nikhil Thampi
Please appreciate our Talend community members by giving Kudos for sharing their time for your query. If your query is answered, please mark the topic as resolved 🙂