Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
MapReduce, mail # user - Accessing Job counters displayed in WEB GUI in Hadoop Code


+
arun k 2011-12-11, 06:41
Copy link to this message
-
RE: Accessing Job counters displayed in WEB GUI in Hadoop Code
Devaraj K 2011-12-12, 03:26
Hi Arun,

You can get the Counters object from the job after completion and
then find the counter whichever you want in Counters object using
findCounter api. Please find the sample snippet for accessing the counter
after Job completion
Configuration conf = new Configuration();  

Cluster cluster = new Cluster(conf);  

Job job = Job.getInstance(cluster,conf);  

result = job.waitForCompletion(true);  
.....
.....
Counters counters = job.getCounters();

Counter c1 = counters.findCounter(CustomCOUNTER.NOOFBADRECORDS);  

System.out.println(c1.getDisplayName()+":"+c1.getValue());

Devaraj K

-----Original Message-----
From: ArunKumar [mailto:[EMAIL PROTECTED]]
Sent: Sunday, December 11, 2011 12:15 PM
To: [EMAIL PROTECTED]
Subject: Accessing Job counters displayed in WEB GUI in Hadoop Code

Hai guys !

Can i access the Job counters displayed in WEB GUI in Hadoop code when the
job finished their execution ?
If so, how can i access the values like "average task run time" and counters
"FILE/HDFS BYTES READ/WRITTEN" immediately after the job has completed in
JobQueueTaskScheduler Code or in some other code file ?
Thanks,
Arun

--
View this message in context:
http://lucene.472066.n3.nabble.com/Accessing-Job-counters-displayed-in-WEB-G
UI-in-Hadoop-Code-tp3576925p3576925.html
Sent from the Hadoop lucene-users mailing list archive at Nabble.com.