How to capture the start time and end time of the job

One Star

How to capture the start time and end time of the job

Hi all,
I have a requirement where I need to capture jobs start time and end time without using tstatcatcher.
When I use tsatcatcher---tmap---toutput file I am able to capture the start and end time but by doing it I am also getting an extra file each time after the script is run...

How to capture the start and end time of the job without using tstatcatcher? Is there any function available to get the start time and end time?
One Star

Re: How to capture the start time and end time of the job

Hey,
use the komponents tPreJob and tPostJob. On each Komponent you say "on component ok"--> tSetGlobalVar, here you make sth. like "startTime" : talenddate.getcurrentDate(). do the same in tPostJob in setting an endtime var. these global vars you can set in a tMap to your needed column.

see here:

http://img409.imageshack.us/i/starttimeendtime1.jpg/[/img)
One Star

Re: How to capture the start time and end time of the job

Hey,
use the komponents tPreJob and tPostJob. On each Komponent you say "on component ok"--> tSetGlobalVar, here you make sth. like "startTime" : talenddate.getcurrentDate(). do the same in tPostJob in setting an endtime var. these global vars you can set in a tMap to your needed column.

see here:

One Star

Re: How to capture the start time and end time of the job

Hi Steve,
Thanks for your reply. Will definitly try that option.... meanwhile can you post the images again or you can send it to my email id:mahir.jain@gmail.com.
Thanks...
One Star

Re: How to capture the start time and end time of the job

Hi,
We are trying to capture start time and end time of each job using tstatcatcher and tlogcatcher. If any one already worked on this pl let us know the approach.
Thanks
Sreeni.
Moderator

Re: How to capture the start time and end time of the job

Hi,
Is there any error when you use tstatcatcher and tlogcatcher in your job? Have you checked component reference with scenario tStatCatcher and tLogCatcher.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: How to capture the start time and end time of the job

Hi Sabrina,
Thank you for your response. No errors in my tstatcatcher or tlogcatcher. Here tstatcatcher return 2 rows with message type begun and end. I want to assign the moment timestamp corresponding to message type "begin" to start time and moment timestamp corresponding to message type "end" to End time.
tStatcatcher 2 records convert to single record (with start and end time ) Any options in tmap to achieve this.
Thanks
Sreeni.
Moderator

Re: How to capture the start time and end time of the job

Hi,
Here tstatcatcher return 2 rows with message type begun and end. I want to assign the moment timestamp corresponding to message type "begin" to start time and moment timestamp corresponding to message type "end" to End time.
tStatcatcher 2 records convert to single record (with start and end time )

Could you please elaborate your case with an example with input and expected output values?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: How to capture the start time and end time of the job

Hi,
Upon successful job execution My tstatcatcher generates 2 records as show below
2013-12-12 10:48:57|TgurVm|TgurVm|TgurVm|9536|TEST_POSTGRE|ad_lkp_test|_gW35wBxLEeO6I6_upDdnMA|0.1|Default||begin||
2013-12-12 10:58:57|TgurVm|TgurVm|TgurVm|9536|TEST_POSTGRE|ad_lkp_test|_gW35wBxLEeO6I6_upDdnMA|0.1|Default||end||
I want to create a single record using above two records ( Moment info of record with "begin" assign to Start time, Moment info for record with "end" assign to end time as described below)
Start time | end time | job |project
2013-12-12 10:48:57|2013-12-12 10:58:57|ad_lkp_test |TEST_POSTGRE
This will be handled in abinitio, but I am not sure in Talend.
Thanks
Sreeni,
Community Manager

Re: How to capture the start time and end time of the job

Hi Sreeni
If you just want to get the start time and the end time, you can use the built-in function TalendDate.getCurrentDate() to get the current date on tJava at the beginning of job, instead of tStatCather, and store the start time to a global variable for use later. For example:
tJava_1
|
onsubjobok
|
the main processing of your job
|
onsubjobok
|
tFixedFlowInput_1--main-->tFileOutputDelimited
on tJava_1, get the current date and store it to a global variable, for example:
globalMap.put("start_time", TalendDate.getCurrentDate());
on tFixedFlowInput, define the schema with columns what you want to log, for example, here 4 columns are defined:start_time(date), end_time(date), job(string), project(string), and set its value for each column as below:
start_time: (java.util.Date)globalMap.get("start_time")
end_time: TalendDate.getCurrentDate()
job: jobName //jobName is a global variable that store the job name and can be access anywhere in the job
project: projectName //projectName is a global variable that store the project name and can be access anywhere in the job
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: How to capture the start time and end time of the job

Hi Shong,
Thank you for your inputs,
Our design was that all prod jobs loads tstatcatcher, tlogcatcher logs into statcatcher, logcatcher table.
By extracting data from statcatcher, logcatcher table we need to populate the start time and end time insted of suggested approach.
Thanks
Sreeni.
One Star

Re: How to capture the start time and end time of the job

Hi Shong
i got the start time and end time. But i want to show the difference between the start time and end time in also milliseconds.
For example:
Start time: 12:01 hrs
end time: 12:01hrs.....................
In this part we cannot identify the start milliseconds. I want to display the milliseconds also. I am not getting the idea of which function to use for this and what to do for this...???
Thanks 
Ashish