大数据全系列 教程
1869个小节阅读:467.3k
目录
408考研
JAVA全系列 教程
面向对象的程序设计语言
Python全系列 教程
Python3.x版本,未来主流的版本
人工智能 教程
顺势而为,AI创新未来
大厂算法 教程
算法,程序员自我提升必经之路
C++ 教程
一门通用计算机编程语言
微服务 教程
目前业界流行的框架组合
web前端全系列 教程
通向WEB技术世界的钥匙
大数据全系列 教程
站在云端操控万千数据
AIGC全能工具班
A A
White Night
程序入口JobSubmitter类中的submitJobInternal方法的198行开始
xxxxxxxxxx
JobStatus submitJobInternal(Job job, Cluster cluster)
throws ClassNotFoundException, InterruptedException, IOException {
// Create the splits for the job 198行
LOG.debug("Creating splits at " + jtFs.makeQualified(submitJobDir));
//写切片信息文件到/tmp/hadoop-yarn/staging/root/.staging/jobId下,并返回切片的数量
int maps = writeSplits(job, submitJobDir);
//使用切片数量作为MapTask任务的数量,所以说有几个切片就对应几个MapTask
conf.setInt(MRJobConfig.NUM_MAPS, maps);
LOG.info("number of splits:" + maps);
}
切片计算调用的哪个方法进行计算的?
xxxxxxxxxx
private int writeSplits(org.apache.hadoop.mapreduce.JobContext job,
Path jobSubmitDir) throws IOException,InterruptedException,
ClassNotFoundException {
JobConf jConf = (JobConf)job.getConfiguration();
int maps;
if (jConf.getUseNewMapper()) {
//hadoop2.x+ 调用该方法进行前切片的计算
maps = writeNewSplits(job, jobSubmitDir);
} else {
//hadoop1.x使用的切片计算的方法
maps = writeOldSplits(jConf, jobSubmitDir);
}
return maps;
}