Hadoop 中JobClient 里 submitJob(JobConf) 和 runJob(JobConf) 的区别

Hadoop提交 Job到JobTracker的时候,需要通过JobClient.runJob(JobConf) 或者 JobClient.submitJob(JobConf) 这两个静态方法来提交。但是这两个方法,前者和后者是有区别的。查看API中的文档解释:

1)runJob

runJob

public static RunningJob runJob(JobConf job)
                         throws IOException
Utility that submits a job, then polls for progress until the job is complete.
Parameters:
job – the job configuration.
Throws:
IOException

2)submitJob

submitJob

public RunningJob submitJob(JobConf job)
                     throws FileNotFoundException,
                            InvalidJobConfException,
                            IOException
Submit a job to the MR system. This returns a handle to the RunningJob which can be used to track the running-job.
Parameters:
job – the job configuration.
Returns:
a handle to the RunningJob which can be used to track the running-job.
Throws:
FileNotFoundException
InvalidJobConfException
IOException

 

       可以看出,runJob是同步的,提交任务后要等待处理直到完成以后,才会返回RunningJob的handle;而submitJob是异步的,会返回一个处理中的RuningJob的handle,然后等有资源的时候,才会真正的去执行提交的任务。

 

http://blog.csdn.net/allenlinrui/article/details/6715309

1 thought on “Hadoop 中JobClient 里 submitJob(JobConf) 和 runJob(JobConf) 的区别

  1. of course like your web-site but you have to test the spelling on quite a few of your posts. A number of them are rife with spelling issues and I in finding it very bothersome to tell the truth on the other hand I will surely come again again.

Leave a Reply

Your email address will not be published. Required fields are marked *