Hi

I am trying to retrieve job counters on hadoop 0.20.2 in runtime or using
history using the org.apache.hadoop.mapred API. My program inputs a job_id
using which I should return the job counters for a running job or by
pulling the info from job history.

I was able to simulate this on the newer hadoop (trunk) version using the
org.apache.hadoop.yarn.api.records.ApplicationReport,
org.apache.hadoop.mapreduce.v2.app.job.Job
and org.apache.hadoop.mapreduce.v2.hs.JobHistory APIs.

Can someone please tell me how we can get the JobCounters in old Hadoop? In
0.20.2 version, the JobClient returns a RunningJob instance if we pass the
JobID parameter. However, if I execute the below snippet of code on a job
which is run within the same program, I get a valid RunningJob instance and
am able to fetch the counters. If I try to pass the job_id of a job running
on the cluster to my program and try to get the JobCounters for it, the
returned RunningJob is simply null. :(

-----
RunningJob runnningJob = jobClient.getJob(JobID.forName(jobId));
if (runnningJob == null) {
System.err.printf("No job with ID %s found.\n", jobId);
 }
if (!runnningJob.isComplete()) {
System.err.printf("Job %s is not complete.\n", jobId);
 }
Counters oldCounters = runnningJob.getCounters();
----------

Any idea what I am doing wrong here?

Regards,
Prajakta

Reply via email to