Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Mayot
Contributor III
Contributor III

Get the job duration via a global variable

Hello,

I would like to know if there is a global variable on the duration of a job. This data is automatically logged in the talend logs. I know it can also be retrieved via the tChronometerStop component.

But is there a global variable associated with this data (as for the name of the job (jobName), the name of the project (projectName), etc.).

 

My need, logging the duration of my job during its execution. If I have to do it with tChronometer, can I run several tChronometerStop without tChronometerStart?

Thank you

Labels (2)
1 Solution

Accepted Solutions
Mayot
Contributor III
Contributor III
Author

OK 0683p000009MEwA.png , found what I want :

 

Math.toIntExact(TalendDate.getCurrentDate().getTime() - startTime)

startTime is a long, I compare this long with the current date (convert in long with getTime()).

 

I convert long to int with Math.toIntExact.

 

What i get : the duration in ms.

View solution in original post

2 Replies
vapukov
Master II
Master II

Hi,

 

yes, you can use as many chronometers as you need, without tChronometrStart each of them will count time from the Job start.

 

if you already enable logs and stats collection - you could also extract it from the stats table (or file) by the Job pid

Mayot
Contributor III
Contributor III
Author

OK 0683p000009MEwA.png , found what I want :

 

Math.toIntExact(TalendDate.getCurrentDate().getTime() - startTime)

startTime is a long, I compare this long with the current date (convert in long with getTime()).

 

I convert long to int with Math.toIntExact.

 

What i get : the duration in ms.