Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I have created 1 child job with dynamic schema option to run for multiple tables through master job, depending on v_table, value of context variable. My plan is to create master job with multiple tRunJobs pointing to same single child dynamic job and pass different values of context variable v_table to run each tRunJob for different tables.Master job context variable can hold single value of v_table , it runs all tRunjobs for single value , however I want for different values, How can I achieve this scenario ?
I want like below:
tRunJob1(v_table:abc) >> tRunJob2(v_table:bcd)>> tRunJob3(def)
it runs like below:
tRunJob1(v_table:abc) >> tRunJob2(v_table:abc)>> tRunJob3(abc)
How can I do this ? My plan is to have a single job and reuse it for different tables in 1 run ?
Thank you
@rommy rommy ,check the below links,you can do it .
https://community.talend.com/s/article/Passing-a-value-from-a-parent-Job-to-a-child-Job-OPRy5
https://community.talend.com/s/article/Using-Parameterized-Jobs-for-Horizontal-Scalability-o19v7
Hello,
I don't see why you have this type of execution unless you initialize the v_table variable with abc at the start of the father job and not modify it further !
try to use hard code to do your tests.
in the tRunJob, you must pass the value to a context param in the child job.
Change the link between the tRunJob to OnSubjobOk
I use the approch several time in many project and i assure you, it work
If I may, You should use an iteration with a list of values and have only one tRunJob with multiple possible values
The reason we have kept this design as we want to run a same job for different tables, so in a future if a new table is added to extract data, only tRunJob needs to be added to master job.
Since context variable remains same at master job level, I achieved this by using tRunJob Context param ,defined the same variable there and checked "Transmit whole context" , it override , job level variable value with component level.
Hello,
I understand the logic perfectly and like I said I have been using it for months in dynamic migration projects (I have developed specific templates that you can find in the forum)
But if I may, you are doing it "litle" wrong. A generic job is supposed to be called once with different parameters hence the genericity. so, you should have a parameter list, in your case a table list, and iteration with the same job.
Try to set up the solution I gave you with a table list and it should work. And for your problem, I think it initializes the table name varibal only once and it doesn't overwrite.
Thank you for your response @Belaid Momo If I go with your suggested approach how about restartibility if load fails because any of the data issue ? If I have 5 tables to load and 2 completed and if failed at 3rd , how would I ensure that it would start from 3rd only with your approach ? I am using cloud version of talend and it seems Talend does nt have out of box "Error Recovery" option with cloud version.
And what about running remaining components in a job parallel ? With your approach, I wont be able to parallelism it I believe.
Hello,
While working on Talend, I learned that you can do almost anything!
Regarding error recovery, you can integrate a loop and an updated flag at the end of the execution (a little OK, KO and in progress) and at the start of the execution, you only filter on the in progress and Ko or you see how you can handle this with a tFilterRow or tJavaRow
As an example, I developed a job (that I can give it to you if you want) with an infinite loop that loads tables and I added a parameter (ex nbRetry = 3) so it will try again to load the table three times and he goes on to the next one. at the end of the execution, a perform a query to update the flags from KO to in progress (I use a table of parameters in sql) and I restart the job.
Regarding parallelization, similar, if you have a parameter table (database) with your tables, you can add an incremental sequence (eg: 1,2,3,4, ...) on the other hand, there yes you can use two or 3 components tRunJob with the same jobs. For example the first one will read that Jobs having an odd or even order !
it's up to you to find a good method
I will see if I can do parallellization with incremental ,