Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
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
lennelei
Creator III
Creator III

Hi,

 

you might try to modify the .bat in order to return -1 in case of error

 

add this after the java command and the .bat should return -1 if the Talend job returns 1 or more (which is usually returns when something get wrong)

if errorlevel 1 exit /b -1

You can also modify directly the .bat model within the Studio in order to apply this modification everytime a new job is build.

The .bat model is located in the project properties (build > shell configuration or something similar).

 

Regards

amtkmr1990
Contributor II
Contributor II
Author

Should i add after %* or before ?

 

%~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 %*

lennelei
Creator III
Creator III

You should add it on a new line after :

%~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 %*

if errorlevel 1 exit /b -1
amtkmr1990
Contributor II
Contributor II
Author

Ok, will update and let you know

Thanks 

amtkmr1990
Contributor II
Contributor II
Author

It did not work. Exception in component tRunJob_1 (TRIGGER_LOAD_ORACLE_CHG_DB_TO_E2CI) java.lang.RuntimeException: 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) at e2ci_db_integration.trigger_load_oracle_chg_db_to_e2ci_0_1.TRIGGER_LOAD_ORACLE_CHG_DB_TO_E2CI.tRunJob_1Process(TRIGGER_LOAD_ORACLE_CHG_DB_TO_E2CI.java:736) at e2ci_db_integration.trigger_load_oracle_chg_db_to_e2ci_0_1.TRIGGER_LOAD_ORACLE_CHG_DB_TO_E2CI.runJobInTOS(TRIGGER_LOAD_ORACLE_CHG_DB_TO_E2CI.java:3192) at e2ci_db_integration.trigger_load_oracle_chg_db_to_e2ci_0_1.TRIGGER_LOAD_ORACLE_CHG_DB_TO_E2CI.main(TRIGGER_LOAD_ORACLE_CHG_DB_TO_E2CI.java:3031) D:\JENKINS-WS\Cloud_Insights\workspace\E2CI-DB-ORACLE-CHG-INTEGRATION\TRIGGER_LOAD_ORACLE_CHG_DB_TO_E2CI>if errorlevel 1 exit /b -1 Triggering a new build of E2CI-DB-ORACLE-SHA-INTEGRATION Finished: SUCCESS
lennelei
Creator III
Creator III

You can use this to check that you correctly process the exit part :

if errorlevel 1 (
	echo existing with status -1
	exit /b -1
)

If the log correctly displays "existing with status -1", the return code should be -1

 

amtkmr1990
Contributor II
Contributor II
Author

It doesn't show the display. I guess when the exception occurs the bat file exits without running the next line 

 

if errorlevel 1 (
	echo existing with status -1
	exit /b -1
)
amtkmr1990
Contributor II
Contributor II
Author

do i need to run the process in single process or multiple tread would work ?

 

lennelei
Creator III
Creator III

The "use a different process" option is not really a multithread (unless I'm mistaken).

It simply start a new Java process.

 

It shouldn't matter anyway but I don't think you should tick this option if you have no use to do so.