Five Stars

Running a Subjob From Job Conductor

Scenario: 

Talend MDM DI job with 10 subjobs that each move data into staging tables.

One of the 10,  subjob #9, fails.

Re-run subjob #9 from TAC Job Conductor.

What I Think I Know:

I can add a Context Parameter in Job Conductor such as "RunSubjobNumber9"

A runif trigger can likely reference a Context Parameter.

Question:

How can I reference the "RunSubjobNumber9" Context Parameter in that is part of the job run process kicked  off in Job Conductor? The runif trigger is where I want to reference this Job Conductor passed Context Parameter.

Alternate:

Is there another way to accomplish this task: Single out a subjob within a DI job to run it without opening Talend Studio.

Thanks,

Allen

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Five Stars

Re: Running a Subjob From Job Conductor

Here is the tested solution.

1. Each subjob must have a uniquely named context with type Boolean and context value set to false. 

2. Each subjob needs a Run If trigger with this condition: context.RunSubJob1==true. I use one default tJava component to run Run If triggers to each subjob.

3. Once the job is published and the TAC Job Conductor Execution task's Context parameters can be seen...

  • Set the Context Paramater for this Execution Task.
    • RunSubjob1's Original Value should be set to false
    • Select the Custom Value's radio button and set the Value to true
    • Save the Context Parameters
  • Deploy run the job. Only SubJob1 should run as long as its Custom Value Context Parameter is set to true. Click the Original Value's radio button (set to false from your job) and save it. Then this Subjob will not run.

 

4 REPLIES
Five Stars

Re: Running a Subjob From Job Conductor

You can reffer it as usual contexts for example: context.RunSubJobNumber9

No matter how n where do you pass it as long as it is a context variable/parameter
Five Stars

Re: Running a Subjob From Job Conductor

Goal: Run a Subjob within a job using Job Conductor
Test: Put context parameters in Job Conductor
for a job Exection Task. One of the context
parameters is empty and the other has a value.
Test to see if the one with the value causes
a Subjob to run.
Scenario:
Job Conductor
Project in Talend Job Conductor in Ready to Run Status.
Job Exection Task created which Deploys and Runs without error.
Two Context Parameters set that reference SubJobs in the Job.
Context parameter Value
Subjob_A_Run "" -- Value ommitted for the test
Subjob_B_Run "SubjobBRun"

Talend MDM Platform (6.31)
Job Flow:
tPreJob->OnComponentOK->tJava_1 (Code: String foo = "bar")
tJava_1->RunIf #1 (Condition: context.Subjob_A_Run=="SubjobARun")->tMSSqlInputSubjobA
tJava_1->RunIf #2 (Condition: context.Subjob_B_Run=="SubjobBRun")->tMSSqlInputSubjobB

Problem:
In this real scenario, nothing happens. I expected SubjobB to run, but it did not. I feel like I am missing a step. If there is a better method for running a Subjob within a job, I am open to all solutions.

 

Thanks

Five Stars

Re: Running a Subjob From Job Conductor

Can you try printing the context parameters in tJava Component?

System.out.println(context.Subjob_A_Run);
System.out.println(context.Subjob_B_Run);

Also use 'equals' method instead of '==' in conditions:
context.Subjob_A_Run.equals("SubjobARun")
context.Subjob_B_Run.equals.("SubjobBRun")
Five Stars

Re: Running a Subjob From Job Conductor

Here is the tested solution.

1. Each subjob must have a uniquely named context with type Boolean and context value set to false. 

2. Each subjob needs a Run If trigger with this condition: context.RunSubJob1==true. I use one default tJava component to run Run If triggers to each subjob.

3. Once the job is published and the TAC Job Conductor Execution task's Context parameters can be seen...

  • Set the Context Paramater for this Execution Task.
    • RunSubjob1's Original Value should be set to false
    • Select the Custom Value's radio button and set the Value to true
    • Save the Context Parameters
  • Deploy run the job. Only SubJob1 should run as long as its Custom Value Context Parameter is set to true. Click the Original Value's radio button (set to false from your job) and save it. Then this Subjob will not run.