Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Kill a talend job using tjavaflex

Dears, 

I have to create a talend job for killing a job which keep running for a while. The job contains BIGSql components. I am using tjavaflex to check if the job has been running for more than 1hour and then a tDie for killing the job. But it keeps telling me that 'tJavaFlex_1 null'. 

Please could you help me? I am totally new in Talend. 

Labels (2)
4 Replies
Anonymous
Not applicable
Author

You will need to give a bit more information. Is the job that you are trying to kill the job in which that the tJavaFlex is located? Can you show us the code that is failing due to the NULL please?

Anonymous
Not applicable
Author

Yes, the job that I am trying to kill is the one that have tjavaflex inside. This job has to 2 tDB2Input that are mapped together with a tMap. 

The code of tjavaflex:

 Date startTime =TalendDate.getCurrentDate();
 Integer timeout=0;

if(TalendDate.diffDate(TalendDate.getCurrentDate(), startTime, "ss") >1)
{
timeout=1;
break;
}

 

I included context.timeout in the context part of the job. 

The job runs without error, but tdie does not kill the job, even the running time is more than 1 second.

 

Anonymous
Not applicable
Author

This is not going to work. In fact, I am concerned by the look of your job in general if I'm honest. For a tMap lookup, unless it is triggered for every row, this will happen once at the beginning of the subjob. So your tJavaFlex is likely running immediately at the beginning of the job and only then.

 

What is your job supposed to be doing? The reason I ask is that the flow looks a little weird.

Anonymous
Not applicable
Author

Actually it works for killing the job when it takes on running for more than a specific time (tested with 5 sec). The tjavaflex managed to call tdie. The job itself creates data into 2 tables by copying the data from a hdfs path. It is needed to be killed the job since it stacked on running for long time for some timestamp. Normally it takes less than 2 min on running.