本文整理汇总了Java中org.apache.hadoop.mapred.TaskCompletionEvent.Status方法的典型用法代码示例。如果您正苦于以下问题:Java TaskCompletionEvent.Status方法的具体用法?Java TaskCompletionEvent.Status怎么用?Java TaskCompletionEvent.Status使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.hadoop.mapred.TaskCompletionEvent
的用法示例。
在下文中一共展示了TaskCompletionEvent.Status方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fromYarn
import org.apache.hadoop.mapred.TaskCompletionEvent; //导入方法依赖的package包/类
public static TaskCompletionEvent.Status fromYarn(
TaskAttemptCompletionEventStatus newStatus) {
switch (newStatus) {
case FAILED:
return TaskCompletionEvent.Status.FAILED;
case KILLED:
return TaskCompletionEvent.Status.KILLED;
case OBSOLETE:
return TaskCompletionEvent.Status.OBSOLETE;
case SUCCEEDED:
return TaskCompletionEvent.Status.SUCCEEDED;
case TIPFAILED:
return TaskCompletionEvent.Status.TIPFAILED;
}
throw new YarnRuntimeException("Unrecognized status: " + newStatus);
}
示例2: verifyReduceTaskNoMapOutput
import org.apache.hadoop.mapred.TaskCompletionEvent; //导入方法依赖的package包/类
public void verifyReduceTaskNoMapOutput(boolean enableNoFetchEmptyMapOutputs,
Class mapperClass,
TaskCompletionEvent.Status expectedStatus) throws Exception {
MiniDFSCluster dfs = null;
MiniMRCluster mr = null;
FileSystem fileSys = null;
try {
Configuration conf = new Configuration();
// Start the mini-MR and mini-DFS clusters
dfs = new MiniDFSCluster(conf, NUM_HADOOP_SLAVES, true, null);
fileSys = dfs.getFileSystem();
mr = new MiniMRCluster(NUM_HADOOP_SLAVES, fileSys.getUri().toString(), 1);
JobConf jobConf = mr.createJobConf();
TaskCompletionEvent[] events = runJob(jobConf, mapperClass, enableNoFetchEmptyMapOutputs);
// Ensure that all mappers set the status as expected
for (TaskCompletionEvent event: events) {
if (event.isMapTask()) {
assertEquals(expectedStatus, event.getTaskStatus());
}
}
}
finally {
if (dfs != null) { dfs.shutdown(); }
if (mr != null) { mr.shutdown(); }
}
}