One Star

execution order in a job

I am trying to implement in the following order:
step 1 - get files from FTP to location A
step 2 - copy them to location B
step 3 - unzip the files from location A.
while doing so i have a condition for the tFTPget to trigger the next job ( copy to location B) for the condition - onSubjobOk. After completion of step 2 i have used the trigger condition - OnComponentOk in order to start step 3.
But step 3 is starting after the completion of step 1 and not waiting for the completion of step 2.
can somebody please tell me how can i add the condition for starting step 3. attached is the screenshot of the desinged job.

Seventeen Stars

Re: execution order in a job

perhaps you can use some tRunJob to manage your subJob .
Define each different step for your application in different job and manage them with trunjob ... by this way you can re-use your diiferents jobs in other applications

Re: execution order in a job

This is an excerpt from a documentation project Im working on. It may not answer your question exactly, but it will hopefully help you understand why onComponentOk is acting the way it is.

A component is the basic building block of all Talend jobs. All components have three distinct sections: ?Begin?, ?Main?, and ?End?.
An easy way to understand how components work is to think of them as nested loops.
In the ?Begin? section of a component you will almost always see something like this:
#Begin My Component
foreach my $key (keys %nested_hash) {

This code begins the iteration though each set of hashes inside the %nested_hash variable.
The ?Main? section of a component is where all the ?row? outputs are generated. You will see something like this:
foreach my $detail_key (keys %{ $nested_hash{$key} } ) {	
if($detail_key =~ /^Name$/) {
$row = $nested_hash{$key}{$detail_key};

This code will output a single row from the component for each $key in the %nested_hash.
The ?End? section of a component is used for cleanup and for anything that needs to be done after all other components in the subjob have completed their ?Main? sections. It is often where insert/update/delete statements are executed. In the simple component example, the ?End? section will contain only one closing bracket that matches the opening bracket in the ?Begin? section:
#close the main foreach $key loop:					

Each Talend job consists of one or more Subjobs. A subjob always has a ?start? component, which is highlighted in green. The ?start? component for a subjob always executes its ?Begin? first and its ?End? last within the subjob. Subjobs can be executed in parallel if they are not started with a ?onSubjobOk? link, described below.
This is the recommended way to trigger dependant subjobs.
The ?start? component of a subjob is the only component that will allow a ?onSubjobOk? link. This link will start another subjob when the source subjob has completed without error. (or stated another way: When the ?End? section of the start component has completed without error.)
This trigger should be avoided if possible as its behavior changes depending on the component it is used upon.
This link is triggered when the ?Main? section of a component completes without error. The reason to avoid using it, if possible, is that many components do the important work in the ?End? section of their code: In the case of database output components the actual insert/update/delete statements are send during the ?End? section?so a onComponentOk would execute even if the inserts/update/deletes fail, which is probably not what you wanted.
Also be aware that this causes the subjob triggered by onComponentOk to exist inside the loop of its parent subjob. This can lead to heavily nested code that may cause problems. For example, when creating a large job with many components, it is possible to run into this error:
java.lang.ClassFormatError: Code of a method longer than 65535 bytes	
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(
at java.lang.ClassLoader.defineClass(
Seventeen Stars

Re: execution order in a job

welldone docs are always wellcome Smiley Happy
thanks for those helpfull precisions
One Star

Re: execution order in a job

Thank you for the documentation. i have tried implementating with tRunJob and it works as expected.