Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello everyone,
I would like to be able to run a subjob even if the previous one got an error.
I know that I could use a tRunJob as a subjob, without checking Die on child error. I'm not in this case. The whole thing is in a unique job.
I thought about how to response to this need, and here is an example job :
I would like to run tJava_5 even if an error occurs from tJava_1.
In tJava_2 et 6 I create an error.
Here is the code of each tJava :
tJava_1 : empty
tJava_2 : int i = 1/0;
tJava_6 : int j = 1/0;
tJava_4 : System.out.println("KO !");
tJava_5 : System.out.println("RUN ANYWAYS !");
Indeed, if an error occurs in tJava_2 or 6, tJava_4 is run, and then tJava_5, which is also run if there is no error, so from tJava_1.
I also tried this configuration :
However, when I execute the job, it fails, tJava_4 is not executed. That's why I used onComponentError instead of onSubjobError.
So, here : I don't understand the use of onSubjobError. For any error occurring in tJava_1 subjob, it should run tJava_4, and then tJava_5.
Can you shed your light on my understanding ? 🙂
Thank you everyone !
Hi @Alpha549 Alpha549 , in the second configuration , you will notice that on subjob ok link will work, cause on component ok link have high priority than on subjob ok , so it will execute first all the component linked by on component ok and if all components works fine no error are thrown so it can execute the on subjob ok link, the on subjob error link will not work cause it consider tJava_1 as a unique subjob, it will work if you put on component error link for all tJava(1,2,6) to tJava _4
Hi @Alpha549 Alpha549 , in the second configuration , you will notice that on subjob ok link will work, cause on component ok link have high priority than on subjob ok , so it will execute first all the component linked by on component ok and if all components works fine no error are thrown so it can execute the on subjob ok link, the on subjob error link will not work cause it consider tJava_1 as a unique subjob, it will work if you put on component error link for all tJava(1,2,6) to tJava _4
Thanks a lot @guenneguez jeremy
Ok the fact here is simply that each tJava is a subjob. Indeed, when I use another configuration :
onSubjobError link works perfectly, so in the success case and error case, tJava_1 is executed 🙂
Topic solved ! 🙂
yes here it will work cause Talend consider tFixedFlowInput + the two tJavaRow as a unique subjob
@guenneguez jeremy , just to know, do you know if there is a way to explicitely include a component in a subjob ?
For instance here, tJava is a subjob itself, but is there a way to include it in another subjob ?