I have a main job that calls other job with a iterate link. I want to manage to possible errors that can append in subjob but I don't see a good and effective way to do it. By exemple my main job is a tFileList link to a first subjob "job1" with an iterate link. The job1 is link to a second subjob "job2" with a onComponentOk link (see screenshot). I can have errors that append in subjob "job1" (with tDie). If an error occurs on a file (from tFileList), I don't want to execute job2 but I want to continue the main job with the next file (of tFileList). I tried : 1) check "Die on child error" on tRunJob "job1" and to add a onComponentError link. My problem is that in this case my files list iteration stops. So the other files aren't treated. 2) uncheck "Die on child error" on tRunJob "job1". My problem is that in this case if an error occurs in subjob 1, the subjob 2 is also executes (and I don't want it). Can you say me what is the solution to do what I want because this kind of job (main job with iteration that call subjobs) is very usefull for us and we absolutely need a solution to this problem. Thanks. Laurie.
Hello laurie tRunJob can't get the child Job's Exception detail, it only can get the child Job's exit code. Note about the exit code: 1. if one job exit normal, there will return 0; 2. if one job exit with tDie, there will return the tDie code. (for example: 4) 3. if one job exit with others Exception, there will return -1; if a tRunJob find the child Job exit abnormal (with Exception or tDie), what behave will the tRunJob to do? It will ignore it or throw an Exception in tRunJob depend on the user check the "Die on Error" or not. As your case, tRunJob_1 how to notify tRunJob_2 that he find the childJob_1 exit with Exception? (using the "Die on Error" can't reach this goal, as your description above, you want continue the next iterate.) So, there must use the "if". I give two solutions as a temporary to resolve your case.(I am sure they are work well for current version.) and report a feature: http://talendforge.org/bugs/view.php?id=3775 It will store the childJob exit code in the globalMap. regards xtan
Hello, The purpose solution with the test on errorCode works if tDie appends in my subjob but it doesn't work if I have a Java exception in the subjob (in my case, I have a SQL exception). On subjob java exception, the error code value is NULL and not -1. How can I do ?
Hello I am sorry about the solution_1 with the errorCode=NULL problem. (the solution_2 is without this problem. it run normally) and if you block by solution_1, as a temporary way, please test it like this: (this.errorCode != null && this.errorCode == 8) || (xtan.aaa_0_1.AAA.status != null && xtan.aaa_0_1.AAA.status.equals("failure")) it looks a little ugly, but it can run with TOS 2.3. After 3981, there will resolve this problem.
And I correct a mistake on last post. --> if there exist an Exception in child job (not the tDie), the errorCode will be 1. (not the -1) thanks for your feedback. regards. xtan