JobClient

/**
 * <code>JobClient</code> is the primary interface for the user-job to interact
 * with the {@link JobTracker}.
 * 翻译:JobClient是用户的作业与JobTracker进行交互的最基本接口
 * <code>JobClient</code> provides facilities to submit jobs, track their
 * progress, access component-tasks‘ reports/logs, get the Map-Reduce cluster
 * status information etc.
 * 翻译:JobClient提供提交作业的工具,追踪作业的进度,获取component-tasks(合成任务)的日志,获取Map-Reduce集群状态信息等等。
 * <p>The job submission process involves:翻译:作业提交过程包括如下
 * <ol>
 *   <li>
 *   Checking the input and output specifications of the job.翻译:检测作业的输入和输入描述
 *   </li>
 *   <li>
 *   Computing the {@link InputSplit}s for the job.翻译:计算作业的InputSplit
 *   </li>
 *   <li>
 *   Setup the requisite accounting information for the {@link DistributedCache}
 *   of the job, if necessary.

*   翻译:如果有必要的话,为作业的DistributedCache设置必要的accounting information
 *   </li>
 *   <li>
 *   Copying the job‘s jar and configuration to the map-reduce system directory
 *   on the distributed file-system.

*   翻译:拷贝作业的jar文件和配置文件到分布式文件系统里的map-reduce系统目录
 *   </li>
 *   <li>
 *   Submitting the job to the <code>JobTracker</code> and optionally monitoring
 *   it‘s status.

*  翻译:提交作业到JobTracker,并选择性的监控它的状态
 *   </li>
 * </ol></p>
 *  
 * Normally the user creates the application, describes various facets of the
 * job via {@link JobConf} and then uses the <code>JobClient</code> to submit
 * the job and monitor its progress.
 * 翻译:通常用户创建应用程序,通过JobConf来描述作业的各个方面,并且用JobClient来提交作业,并监视它的进度
 * <p>Here is an example on how to use <code>JobClient</code>:</p>翻译:这里有一个例子,教你如何使用JobClient
 * <p><blockquote><pre>
 *     // Create a new JobConf 翻译:创建一个JobConf对象
 *     JobConf job = new JobConf(new Configuration(), MyJob.class);
 *     
 *     // Specify various job-specific parameters   翻译:指定各种各样的和作业有关的具体参数
 *     job.setJobName("myjob");
 *     
 *     job.setInputPath(new Path("in"));
 *     job.setOutputPath(new Path("out"));
 *     
 *     job.setMapperClass(MyJob.MyMapper.class);
 *     job.setReducerClass(MyJob.MyReducer.class);
 *
 *     // Submit the job, then poll for progress until the job is complete翻译:提交作业,不停的询问进度,知道作业完成
 *     JobClient.runJob(job);
 * </pre></blockquote></p>
 *
 * <h4 id="JobControl">Job Control</h4>
 *
 * <p>At times clients would chain map-reduce jobs to accomplish complex tasks
 * which cannot be done via a single map-reduce job. This is fairly easy since
 * the output of the job, typically, goes to distributed file-system and that
 * can be used as the input for the next job.</p>
 * 翻译:有时,clients会把许多的map-reduce作业“链”在一起,取完成一些复杂的任务,这些作业是不能通过一个单一的map-reduce作业来完成的。

    这是非常容易实现的,因为作业的输出通常是在分布式文件系统,所以这些在分布式文件系统的输出可以用作下一个作业的输入。
 * <p>However, this also means that the onus on ensuring jobs are complete
 * (success/failure) lies squarely on the clients. In such situations the
 * various job-control options are:

* 然而,这也意味着,确保作业成功或者失败的重任直接就落在了clients上。在这种情况下,job-control选项如下:
 * <ol>
 *   <li>
 *   {@link #runJob(JobConf)} : submits the job and returns only after
 *   the job has completed.翻译:提交作业,并且只有在作业完成之后返回。
 *   </li>
 *   <li>
 *   {@link #submitJob(JobConf)} : only submits the job, then poll the
 *   returned handle to the {@link RunningJob} to query status and make
 *   scheduling decisions.

*   翻译:仅提交作业,此时,通过RunningJob(<p>Clients can get hold of <code>RunningJob</code> via the {@link JobClient}
 * and then query the running-job for details such as name, configuration,
 * progress etc.</p> )不停的请求句柄,来查询状态和调度决策
 *   </li>
 *   <li>
 *   {@link JobConf#setJobEndNotificationURI(String)} : setup a notification
 *   on job-completion, thus avoiding polling.

*   翻译:设置一个作业完成通知,因此就可以避免不停的询问进度
 *   </li>
 * </ol></p>
 *
 * @see JobConf
 * @see ClusterStatus
 * @see Tool
 * @see DistributedCache
 */

时间: 2024-08-08 21:55:15

JobClient的相关文章

MapReduce V1:Job提交流程之JobClient端分析

我们基于Hadoop 1.2.1源码分析MapReduce V1的处理流程.MapReduce V1实现中,主要存在3个主要的分布式进程(角色):JobClient.JobTracker和TaskTracker,我们主要是以这三个角色的实际处理活动为主线,并结合源码,分析实际处理流程.下图是<Hadoop权威指南>一书给出的MapReduce V1处理Job的抽象流程图: 如上图,我们展开阴影部分的处理逻辑,详细分析Job提交在JobClient端的具体流程.在编写好MapReduce程序以后

Hadoop 学习笔记三 --JobClient 的执行过程

一. MapReduce 作业处理过程概述 当用户在使用Hadoop 的 MapReduce 计算模型处理问题的时候,只需要设计好Mapper 和Reducer 处理函数,还有可能包括Combiner 函数.之后,新建一个Job 对象,并对Job 的运行环境进行一些配置,最后调用Job 的waitForCompletion 或者 submit 方法来提交作业即可.代码如下: 1 //新建默认的Job 配置对象 2 Configuration conf = new Configuration();

eclipse下提交job时报错mapred.JobClient: No job jar file set. User classes may not be found.

错误信息: 11/10/14 13:52:07 WARN mapred.JobClient: Use GenericOptionsParser for parsing the arguments. Applications should implement Tool for the same.11/10/14 13:52:07 WARN mapred.JobClient: No job jar file set.  User classes may not be found. See JobCo

hadoop报错:WARN mapred.JobClient: Error reading task outputNo route to host

解决方案: /etc/sysconfig/network/etc/hosts$hostname 这三处的主机名都要一样. 具体参考:http://blog.itpub.net/28254374/viewspace-1059607/

WordCount深入分析------JobClient学习

public static void main(String[] args) throws Exception { Configuration conf = new Configuration(); //conf就是作业的配置对象,读取core-site.core-default.hdfs-site/default.mapred-site/default文件里的配置信息 String[] otherArgs = new GenericOptionsParser(conf, args).getRe

基于 Eclipse 的 MapReduce 开发环境搭建

文 / vincentzh 原文连接:http://www.cnblogs.com/vincentzh/p/6055850.html 上周末本来要写这篇的,结果没想到上周末自己环境都没有搭起来,运行起来有问题的呢,拖到周一才将问题解决掉.刚好这周也将之前看的内容复习了下,边复习边码代码理解,印象倒是很深刻,对看过的东西理解也更深入了. 目录 1.概述 2.环境准备 3.插件配置 4.配置文件系统连接 5.测试连接 6.代码编写与执行 7.问题梳理 7.1 console 无日志输出问题 7.2

mapreduce工作原理

转自:http://www.cnblogs.com/z1987/p/5055565.html MapReduce模型主要包含Mapper类和Reducer类两个抽象类.Mapper类主要负责对数据的分析处理,最终转化为key-value数据对:Reducer类主要获取key-value数据对,然后处理统计,得到结果.MapReduce实现了存储的均衡,但没有实现计算的均衡. 一. MapReduce框架组成 MapReduce主要包括JobClient.JobTracker.TaskTracke

Hadoop之——MapReduce实战(一)

转载请注明出处:http://blog.csdn.net/l1028386804/article/details/45956487 MapReduce概述      MapReduce是一种分布式计算模型,由Google提出,主要用于搜索领域,解决海量数据的计算问题. MR由两个阶段组成:Map和Reduce,用户只需要实现map()和reduce()两个函数,即可实现分布式计算,非常简单. 这两个函数的形参是key.value对,表示函数的输入信息. MR执行流程 MapReduce原理 执行

Hadoop 实践(二) Mapreduce 编程

Mapreduce 编程,本文以WordCount  为例:实现文件字符统计 在eclipse 里面搭建一个java项目,引入hadoop lib目录下的jar,和 hadoop主目录下的jar. 新建WordCount 类: package org.scf.wordcount; import java.io.IOException; import java.util.*; import org.apache.hadoop.fs.Path; import org.apache.hadoop.co