Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
RMotta2408
Creator
Creator

Talend Studio: Job hierarchy - How do I know if a Job is a Master Job?

Hello everyone,

How do I know if a Job is a "Master" Job, meaning it is not being called from any other Job?
I'm using Talend Studio and I know there is an option accessible by right-clicking on a Job to "Open Job Hierarchy". It shows the flow starting from that Job onwards. But it doesn't show if that particular Job is being called by another Job.
So, my question is: how do I know if a Job I'm looking at is being called by another Job, thus being its child.

 

Thank you so much.

Rui
 

Labels (2)
2 Solutions

Accepted Solutions
billimmer
Creator III
Creator III

use the built in variable "isChildJob".   

Try it in a tjava component:  

System.out.println(isChildJob);

View solution in original post

billimmer
Creator III
Creator III

You should be able to use a tFileList to iterate through all of your project files.  Use mask "*.item".  The .item files are xml so you can parse it that way using Talend components.  Or you can use a tJava and java code to read each file into a string (see java.nio.file.Files.readAllBytes) and then "look" through the string with java ((String.contains, String.indexOf, String.substring) 

 

 

View solution in original post

9 Replies
jeoste
Creator
Creator

Hello,
I don't think that exists, you have to open each job and make your own hierarchy by determining the master job.

RMotta2408
Creator
Creator
Author

Hello,

Thank you for replying.
That is actually what I've been doing but I thought there was a better way of establishing a project hierarchy.

 

billimmer
Creator III
Creator III

use the built in variable "isChildJob".   

Try it in a tjava component:  

System.out.println(isChildJob);

RMotta2408
Creator
Creator
Author

Hi there.

Thanks for the reply.

I would have to go through all the Jobs to see if it is or not a Child Job though, right?

 

Cheers,

Rui

billimmer
Creator III
Creator III

Sorry, I misunderstood.

You could create a job that loops through all of the job files in a project directory and searches for instances of the tRunJob component to get subjob names.  Compare this to a list of all jobs.

Thanks  

RMotta2408
Creator
Creator
Author

Hello,

Ok, I appreciate your help.
I'm going to look into that solution.

I haven't search a way, but do you know how to loop through all of the job files in a project directory?

I appreciate your help.

 

Rui

RMotta2408
Creator
Creator
Author

Hi there @billimmer ,

 

I'm struggling with the "searche for instances of the tRunJob component" part.

Have you got any ideia how do I do that?

 

Thank you

billimmer
Creator III
Creator III

You should be able to use a tFileList to iterate through all of your project files.  Use mask "*.item".  The .item files are xml so you can parse it that way using Talend components.  Or you can use a tJava and java code to read each file into a string (see java.nio.file.Files.readAllBytes) and then "look" through the string with java ((String.contains, String.indexOf, String.substring) 

 

 

RMotta2408
Creator
Creator
Author

Hi there,

This is what I did:
Starting from the "process" folder, I searched every *.item file. 
Then I read each line looking for this line: elementParameter field="PROCESS_TYPE" name="PROCESS"
When found, I'd get the child Job name in "value="xxxx""
Then I put into a tHashOutput both the Job name (filename.item) and the child Job name (when found).
At the end I confronted both lists to determine which Jobs are being called (child Jobs) and which are not (Master Jobs), creating a list of all the Jobs and a mark indicating if the Job is a child Job.

Thank you for all the input. I appreciate it.

Rui