Harshi
Harshi

Reputation: 189

Running Talend child jobs through a parent job

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.

Upvotes: 0

Views: 2604

Answers (2)

54l3d
54l3d

Reputation: 3973

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 :

enter image description here

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:

enter image description here

And finally, this is how to set tRunJob component:

enter image description here

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

Upvotes: 1

Viki888
Viki888

Reputation: 2774

You can do it like following scenario

enter image description here

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

enter image description here

Then that context variable is used in tRunJob component.

enter image description here

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

enter image description here

Hope this may help you out.

Upvotes: 0

Related Questions