Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have configured a job with each component die on error. I am calling this job .bat build through Jenkins job .
When the job fails the jenkins still shows it as success.
Is there any way in talend to throw exit code -1 while .bat is called and when it fails.
Any valuable direction will be very helpfull.
Thanks You
ok let me check by unchecking that option
I am getting 1 as display
PROD
Child job returns 1. It doesn't terminate normally.
Exception in component tFileList_1 (LOAD_ORACLE_CHG_DB_CSV_TO_STG)
java.lang.RuntimeException: No file found in directory \\prod4271\E2CI-DBOPS\IN
at e2ci_db_integration.load_oracle_chg_db_csv_to_stg_0_1.LOAD_ORACLE_CHG_DB_CSV_TO_STG.tFileList_1Process(LOAD_ORACLE_CHG_DB_CSV_TO_STG.java:1421)
at e2ci_db_integration.load_oracle_chg_db_csv_to_stg_0_1.LOAD_ORACLE_CHG_DB_CSV_TO_STG.runJobInTOS(LOAD_ORACLE_CHG_DB_CSV_TO_STG.java:5292)
at e2ci_db_integration.load_oracle_chg_db_csv_to_stg_0_1.LOAD_ORACLE_CHG_DB_CSV_TO_STG.main(LOAD_ORACLE_CHG_DB_CSV_TO_STG.java:5131)
1
Exception in component tFileList_1 (LOAD_ORACLE_CHG_DB_CSV_TO_STG)
java.lang.RuntimeException: No file found in directory \\prod4271\E2CI-DBOPS\IN
at e2ci_db_integration.load_oracle_chg_db_csv_to_stg_0_1.LOAD_ORACLE_CHG_DB_CSV_TO_STG.tFileList_1Process(LOAD_ORACLE_CHG_DB_CSV_TO_STG.java:1421)
at e2ci_db_integration.load_oracle_chg_db_csv_to_stg_0_1.LOAD_ORACLE_CHG_DB_CSV_TO_STG.runJobInTOS(LOAD_ORACLE_CHG_DB_CSV_TO_STG.java:5292)
at e2ci_db_integration.load_oracle_chg_db_csv_to_stg_0_1.LOAD_ORACLE_CHG_DB_CSV_TO_STG.main(LOAD_ORACLE_CHG_DB_CSV_TO_STG.java:5131)
no working even after unchecked the run child job as separate instance
D:\JENKINS-WS\Cloud_Insights\workspace\E2CI-DB-ORACLE-SHA-INTEGRATION\TRIGGER_LOAD_ORACLE_SHA_DB_TO_E2CI>java -Xms256M -Xmx1024M -cp .;../lib/routines.jar;../lib/activation.jar;../lib/dom4j-1.6.1.jar;../lib/filecopy.jar;../lib/jakarta-oro-2.0.8.jar;../lib/jtds-1.3.1-patch.jar;../lib/log4j-1.2.16.jar;../lib/mail-1.4.jar;../lib/talend_file_enhanced_20070724.jar;../lib/talendcsv.jar;trigger_load_oracle_sha_db_to_e2ci_0_1.jar;load_oracle_sha_db_stg_to_dim_0_1.jar;load_oracle_sha_db_csv_to_stg_0_1.jar;load_oracle_sha_db_stg_to_fct_0_1.jar;load_oracle_sha_db_dim_to_lu_0_1.jar; e2ci_db_integration.trigger_load_oracle_sha_db_to_e2ci_0_1.TRIGGER_LOAD_ORACLE_SHA_DB_TO_E2CI --context=DEV Exception in component tFileList_1 (LOAD_ORACLE_SHA_DB_CSV_TO_STG) java.lang.RuntimeException: No file found in directory \\prod4271\E2CI-DBOPS\IN at e2ci_db_integration.load_oracle_sha_db_csv_to_stg_0_1.LOAD_ORACLE_SHA_DB_CSV_TO_STG.tFileList_1Process(LOAD_ORACLE_SHA_DB_CSV_TO_STG.java:1421) at e2ci_db_integration.load_oracle_sha_db_csv_to_stg_0_1.LOAD_ORACLE_SHA_DB_CSV_TO_STG.runJobInTOS(LOAD_ORACLE_SHA_DB_CSV_TO_STG.java:5292) at e2ci_db_integration.load_oracle_sha_db_csv_to_stg_0_1.LOAD_ORACLE_SHA_DB_CSV_TO_STG.runJob(LOAD_ORACLE_SHA_DB_CSV_TO_STG.java:5139) at e2ci_db_integration.trigger_load_oracle_sha_db_to_e2ci_0_1.TRIGGER_LOAD_ORACLE_SHA_DB_TO_E2CI.tRunJob_1Process(TRIGGER_LOAD_ORACLE_SHA_DB_TO_E2CI.java:594) at e2ci_db_integration.trigger_load_oracle_sha_db_to_e2ci_0_1.TRIGGER_LOAD_ORACLE_SHA_DB_TO_E2CI.runJobInTOS(TRIGGER_LOAD_ORACLE_SHA_DB_TO_E2CI.java:3066) at e2ci_db_integration.trigger_load_oracle_sha_db_to_e2ci_0_1.TRIGGER_LOAD_ORACLE_SHA_DB_TO_E2CI.main(TRIGGER_LOAD_ORACLE_SHA_DB_TO_E2CI.java:2905) Exception in component tRunJob_1 (TRIGGER_LOAD_ORACLE_SHA_DB_TO_E2CI) java.lang.RuntimeException: Child job running failed. java.lang.RuntimeException: No file found in directory \\prod4271\E2CI-DBOPS\IN at e2ci_db_integration.load_oracle_sha_db_csv_to_stg_0_1.LOAD_ORACLE_SHA_DB_CSV_TO_STG.tFileList_1Process(LOAD_ORACLE_SHA_DB_CSV_TO_STG.java:1421) at e2ci_db_integration.load_oracle_sha_db_csv_to_stg_0_1.LOAD_ORACLE_SHA_DB_CSV_TO_STG.runJobInTOS(LOAD_ORACLE_SHA_DB_CSV_TO_STG.java:5292) at e2ci_db_integration.load_oracle_sha_db_csv_to_stg_0_1.LOAD_ORACLE_SHA_DB_CSV_TO_STG.runJob(LOAD_ORACLE_SHA_DB_CSV_TO_STG.java:5139) at e2ci_db_integration.trigger_load_oracle_sha_db_to_e2ci_0_1.TRIGGER_LOAD_ORACLE_SHA_DB_TO_E2CI.tRunJob_1Process(TRIGGER_LOAD_ORACLE_SHA_DB_TO_E2CI.java:594) at e2ci_db_integration.trigger_load_oracle_sha_db_to_e2ci_0_1.TRIGGER_LOAD_ORACLE_SHA_DB_TO_E2CI.runJobInTOS(TRIGGER_LOAD_ORACLE_SHA_DB_TO_E2CI.java:3066) at e2ci_db_integration.trigger_load_oracle_sha_db_to_e2ci_0_1.TRIGGER_LOAD_ORACLE_SHA_DB_TO_E2CI.main(TRIGGER_LOAD_ORACLE_SHA_DB_TO_E2CI.java:2905) at e2ci_db_integration.trigger_load_oracle_sha_db_to_e2ci_0_1.TRIGGER_LOAD_ORACLE_SHA_DB_TO_E2CI.tRunJob_1Process(TRIGGER_LOAD_ORACLE_SHA_DB_TO_E2CI.java:611) at e2ci_db_integration.trigger_load_oracle_sha_db_to_e2ci_0_1.TRIGGER_LOAD_ORACLE_SHA_DB_TO_E2CI.runJobInTOS(TRIGGER_LOAD_ORACLE_SHA_DB_TO_E2CI.java:3066) at e2ci_db_integration.trigger_load_oracle_sha_db_to_e2ci_0_1.TRIGGER_LOAD_ORACLE_SHA_DB_TO_E2CI.main(TRIGGER_LOAD_ORACLE_SHA_DB_TO_E2CI.java:2905) D:\JENKINS-WS\Cloud_Insights\workspace\E2CI-DB-ORACLE-SHA-INTEGRATION\TRIGGER_LOAD_ORACLE_SHA_DB_TO_E2CI>if errorlevel 1 ( echo existing with status -1 exit /b -1 ) Finished: SUCCESS
How to capture child exit code of failure in parent job (trunjob) ?
You may use something like
((Integer)globalMap.get("tRunJob_1_CHILD_RETURN_CODE"))
Do you have a tPostJob?
yeah i am using this
((Integer)globalMap.get("tRunJob_1_CHILD_RETURN_CODE"))
Which i have shared in screen shot.
No i am not using tpostjob
Do you have any suggestion further
Hi,
could you please remove the if() block and add echo %errorlevel% after the .bat line.
You should have something like this:
%~d0 cd %~dp0 java -Xms256M -Xmx1024M -cp .;../lib/routines.jar;../lib/activation.jar;../lib/dom4j-1.6.1.jar;../lib/log4j-1.2.16.jar;../lib/mail-1.4.jar;trigger_load_oracle_chg_db_to_e2ci_0_1.jar;load_oracle_chg_db_csv_to_stg_0_1.jar;load_oracle_chg_db_stg_to_fct_0_1.jar;load_oracle_chg_db_dim_to_lu_0_1.jar;load_oracle_chg_db_stg_to_dim_0_1.jar; e2ci_db_integration.trigger_load_oracle_chg_db_to_e2ci_0_1.TRIGGER_LOAD_ORACLE_CHG_DB_TO_E2CI --context=DEV %* echo Error: %errorlevel%
It should display the return code from the java command.
I haved attached those output in 4.png and 5.png images.
The problem is parent job is exit without error and child job is exiting with error.
So i am struggling to make parent job fail or give exit code error when child job fails
I didn't see you were using a tRunJob and that the failing job was the subjob.
Did you either tick "Use dynamic job" or "Use an independent process to run subjob" option in the tRunJob?
If yes, it might be the source of your problem. With these options, Talend uses Thread to run the subjob and seems to fail to manage correctly subjob errors.
Double check that you really need that! If not, untick the options and you should be fine.
If you have to keep them, try the following solutions: each solution will work on some configuration (the last one should always work).
First try to simply tick the "Die on child error" checkbox.
If that doesn't work, you may try to add a tDie component after a "OnComponentError" link from your tRunJob (tRunJob ==OnComponentError==> tDie).
Final solution, you may add a tDie after a "if" link from your tRunJob (tRunJob ==if==> tDie). The if condition will have the following value for example :
((Integer)globalMap.get("tRunJob_1_CHILD_RETURN_CODE")) != 0
(adapt tRunJob_1 to your tRunJob component number)
Regards.