Running Talend child jobs through a parent job

◇◆丶佛笑我妖孽 提交于 2019-12-12 02:11:45

问题


I want to develop a Talend job parent job which will read a file. This file will have all the child job names. So the parent job when run must go through each entry in the file (ie each child job name) and execute the child job. Can anyone please guide me on this.


回答1:


You can use the tRunJob dynamic job feature, I executed 3 sub jobs called a, b and c, and the order is specified in the file, see below :

First block is to load your file into context, you can use a properties file or delimited file.

I used properties file with this content :

jobs=a;c;b;a

You have to add a string typed context variable named jobs to put the propertie value into.

Now, our job list is stored in a context variable, we need to iterate through them using tJavaFlex and update a context variable called currentjob:

And finally, this is how to set tRunJob component:

Here you specify jobs to be executed, but the execution order is specified by the file !




回答2:


You can do it like following scenario

This is the sample job which I tried out.

I have assumed your input from CSV file and the input file contain three job name which are

ChildJob1
ChildJob2
ChildJob3

I am getting the jobname and assigning it to a context variable like below

Then that context variable is used in tRunJob component.

Each child job has a single tjava component which displays the jobname

Hope this may help you out.



来源:https://stackoverflow.com/questions/41633131/running-talend-child-jobs-through-a-parent-job

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!