HHH
HHH

Reputation: 6465

How to find job Id of a hadoop job in code?

I have a Hadoop program which has a loop. In each iteration of the loop a job is created. How can I find the job id in the code?

Upvotes: 1

Views: 3290

Answers (1)

Charles Menguy
Charles Menguy

Reputation: 41428

When you submit your Job instance, you can get information about the job id using the getJobID method:

Configuration config = new Configuration();
Job job = new Job(config);
// configure your job
job.submit();
// at that point your job is submitted but not finished and should have your job id
String jobid = job.getJobID().toString();

Note that there was a bug described in MAPREDUCE-118 which impacted Hadoop versions before 0.20.204 where getJobID would only return null.

Upvotes: 2

Related Questions