• Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » [resolved] tChronometerStart and tChronometerStop return null durations

#1 2010-01-25 20:28:21

Serpico
Member
Registered: 2010-01-25
Posts: 16
Website

[resolved] tChronometerStart and tChronometerStop return null durations

Hi,

I haven't found any post mentioning this, and I have no idea where the problem is.

I am using a tChronometerStart and tChronometerStop in my job to get the start time and execution time of the job, and i am trying to access those values from a tJava component but I am always getting null values even though the tChronometerStop is displaying correctly the result on the console.

I have attached a picture of my simple job. As you can see on the console, the values in the Java code are null, but the tChronometerStop is displaying correctly the result.

The code in my tJava_1 component is the following:

Code:

System.out.println("Duration : " + ((String)globalMap.get("tChronometerStop_1_DURATION")));
System.out.println("Start Time : " + ((String)globalMap.get("tChronometerStart_1_STARTTIME")));

Does anyone know where the problem is and how to access those values from a Java component?

Thank you in advance.

System:
OS: Windows XP
Talend version: TIS 3.2.2r33000
Generated language: Java


Uploaded Images

Offline

#2 2010-01-27 19:42:13

Serpico
Member
Registered: 2010-01-25
Posts: 16
Website

Re: [resolved] tChronometerStart and tChronometerStop return null durations

Hi,

Could it be a bug? Was anyone able to extract those values?

Offline

#3 2010-01-28 04:03:29

shong
Talend team
Registered: 2007-08-29
Posts: 10289
Website

Re: [resolved] tChronometerStart and tChronometerStop return null durations

Hello
Yes, the two global vars are not avaliable now, you can report a bug on our bugtracker.
((String)globalMap.get("tChronometerStop_1_DURATION"))
((String)globalMap.get("tChronometerStart_1_STARTTIME"))
For now, you can extract those values on tJava like this:

Code:

long startTime=(Long)globalMap.get("tChronometerStart_1");
java.util.Calendar c=java.util.Calendar.getInstance();
c.setTimeInMillis(startTime);
java.util.Date date=c.getTime();
System.out.println("Start Time : " +TalendDate.formatDate("yyyy-MM-dd HH:mm:ss",date));

System.out.println("Duration : " +(((Long)globalMap.get("tChronometerStop_1"))-((Long)globalMap.get("tChronometerStart_1")))+"milliseconds");

output result:

Code:

Start Time : 2010-01-28 11:00:17
Duration : 125milliseconds

Best regards

           shong


Uploaded Images


Email:shong@talend.com
Choose Talend, Enjoy Talend!
New & Event: Talend Help Center
Talend-->the leader of open source data management and application integration solutions!

Offline

#4 2010-01-28 21:36:34

Serpico
Member
Registered: 2010-01-25
Posts: 16
Website

Re: [resolved] tChronometerStart and tChronometerStop return null durations

Thanks Shong for your answer. For now I'll stick to the workaround.

This issue has been reported as a bug (id 11390) on the bugtracker.
Link to the bug: http://www.talendforge.org/bugs/view.php?id=11390

Thanks.

Offline

#5 2010-01-29 04:38:32

ytao
Member
Registered: 2008-08-29
Posts: 21

Re: [resolved] tChronometerStart and tChronometerStop return null durations

Hi,

Other related report at [Bugtracker, bug 10978, fixed] tChronometerStop: You can't retrieve the duration.

For using last components, it can be download from:

TOS Trunk component directory

After updates for this two components, input code likes:

Code:

System.out.println(new Date((Long)globalMap.get("tChronometerStart_1_STARTTIME"))); 
System.out.println((Long)globalMap.get("tChronometerStop_1_DURATION"));

Regards.

Offline

#6 2011-08-10 11:15:35

Kyaw Lwin Phyo
Member
Registered: 2011-07-12
Posts: 57

Re: [resolved] tChronometerStart and tChronometerStop return null durations

Hi,
I want to write the duration n start time into a file,
how can I do that?
right now, i'm thinking like having 2 context variables liek duration n start_time
which will be assigned values using tJava during run time,
but I don't know how to write into a file.

Please advice.

Offline

#7 2011-08-10 11:21:31

brandon_stubbs93
Member
Company: BOS Solutions
Registered: 2011-01-16
Posts: 164
Website

Re: [resolved] tChronometerStart and tChronometerStop return null durations

Hi I got the duration working in a job a while ago

See post
http://www.talendforge.org/forum/viewtopic.php?id=15187

Regards
Brandon

Offline

#8 2011-08-11 01:52:31

alevy
Member
Registered: 2009-11-20
Posts: 1477

Re: [resolved] tChronometerStart and tChronometerStop return null durations

Use tFixedFlowInput to create a row(s) containing your output and link it to tFileOutputDelimited

Offline

  • Index
  •  » Talend Open Studio for Data Integration » Usage, Operation
  •  » [resolved] tChronometerStart and tChronometerStop return null durations

Board footer

Powered by FluxBB