Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running parallel jobs in talend

I have a situation where i need to run five different child jobs in talend in parallel. Problem is that, in my select query i would be getting five different ID's and then for each particular id , i need to run five different jobs. Problem with tparrallelize component is that , it does not allow me to pass context variables to each sub job, i.e id in this particular case.

select id from table limit 5; ----> five different instance of same job with different id as parameter

Any help would be highly appreciated

thanks

like image 856
Nitish Sharma Avatar asked Oct 02 '22 19:10

Nitish Sharma


1 Answers

I'm not sure if I properly understand what you're doing here but if you were to break out each of those IDs and store them as 5 separate context variables then each job could access their own context variable with the right ID stored for each of them and use that.

So I would start with your database input component (just select the IDs you want) and feed that into a tFlowToIterate. Connect this via an iterate flow into a tFixedFlowInput component and create 2 fields in your schema, "key" and "value". Use the inline table to specify that "key" should be ((Integer)globalMap.get("tFlowToIterate_1_CURRENT_ITERATION")) and "value" should be ((String)globalMap.get("row1.SupplierPartNumber")).

Iterate through the returned IDs and put in Global Map and then retrieve

I'd then throw this into a tMap component where I'd put "ContextNumber" + row2.key into the mapped key column just to make it a bit more obvious than the iteration number as your context and then feed that directly into a tContextLoad.

Map the iteration value

From there you can OnSubjobOK to your tParallelize component and link all your jobs together. In each job configure the jobs to use the appropriate context variable.

enter image description here

like image 52
ydaetskcoR Avatar answered Oct 05 '22 11:10

ydaetskcoR