我正在尝试通过我的 MR 代码中的所有任务计算映射、洗牌和归约的各个总时间。
我需要帮助来检索每个 MapReduce 作业的信息。
有人可以发布任何进行该计算的代码片段吗?
您需要使用 JobClient API,如下所示: 但是,该 API 有一些怪癖。试试吧,让我知道我会帮助你。
JobClient client = null;
Configuration configuration = new Configuration();
configuration.set("mapred.job.tracker", jobTrackerURL);
client = new JobClient(new JobConf(configuration));
while (true) {
List<JobStatus> jobEntries = getTrackerEntries(jobName,
client);
for (JobStatus jobStatus : jobEntries) {
JobID jobId = jobStatus.getJobID();
String trackerJobName = client.getJob(jobId)
.getJobName();
TaskReport[] mapReports = client
.getMapTaskReports(jobId);
TaskReport[] reduceReports = client
.getReduceTaskReports(jobId);
client.getJob(jobId).getJobStatus().getStartTime();
int jobMapper = mapReports.length;
mapNumber = +jobMapper;
int jobReducers = reduceReports.length;
reduceNumber = +jobReducers;
}
}