Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
amtkmr1990
Contributor II
Contributor II

throw Exit code on failure

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

 

Labels (2)
19 Replies
amtkmr1990
Contributor II
Contributor II
Author

ok let me check by unchecking that option 

amtkmr1990
Contributor II
Contributor II
Author

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)

amtkmr1990
Contributor II
Contributor II
Author

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

 

amtkmr1990
Contributor II
Contributor II
Author

attached image will give you clear idea 


5.png
amtkmr1990
Contributor II
Contributor II
Author

How to capture child exit code of failure in parent job (trunjob) ?

lennelei
Creator III
Creator III

You may use something like

((Integer)globalMap.get("tRunJob_1_CHILD_RETURN_CODE"))

Do you have a tPostJob?

amtkmr1990
Contributor II
Contributor II
Author

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

lennelei
Creator III
Creator III

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.

 

amtkmr1990
Contributor II
Contributor II
Author

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 

lennelei
Creator III
Creator III

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.