本文介绍了如何在代码中找到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?
推荐答案
当您提交作业
>实例,您可以使用 getJobID
方法获取有关作业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();
请注意,在0.20.204之前影响Hadoop版本,其中 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?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!