本文介绍了如何在代码中找到 hadoop 工作的工作 ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个 Hadoop 程序,它有一个循环.在循环的每次迭代中,都会创建一个作业.如何在代码中找到工作 ID?
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?
推荐答案
当你提交你的 Job
实例时,你可以使用 getJobID
方法获取关于 job id 的信息:
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();
请注意,MAPREDUCE-118 中描述了一个影响 Hadoop 的错误0.20.204 之前的版本,其中 getJobID
只会返回 null
.
Note that there was a bug described in MAPREDUCE-118 which impacted Hadoop versions before 0.20.204 where getJobID
would only return null
.
这篇关于如何在代码中找到 hadoop 工作的工作 ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!