當前位置: 首頁>>代碼示例>>Java>>正文


Java RunningJob.getTaskCompletionEvents方法代碼示例

本文整理匯總了Java中org.apache.hadoop.mapred.RunningJob.getTaskCompletionEvents方法的典型用法代碼示例。如果您正苦於以下問題:Java RunningJob.getTaskCompletionEvents方法的具體用法?Java RunningJob.getTaskCompletionEvents怎麽用?Java RunningJob.getTaskCompletionEvents使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.mapred.RunningJob的用法示例。


在下文中一共展示了RunningJob.getTaskCompletionEvents方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: abortJob

import org.apache.hadoop.mapred.RunningJob; //導入方法依賴的package包/類
@Override
public void abortJob(JobContext context, JobStatus.State runState) throws java.io.IOException {
	super.abortJob(context, runState);

	final JobClient jobClient = new JobClient(new JobConf(context.getConfiguration()));
	final RunningJob job = jobClient.getJob((org.apache.hadoop.mapred.JobID) JobID.forName(context.getConfiguration().get("mapred.job.id")));
	String diag = "";
	for (final TaskCompletionEvent event : job.getTaskCompletionEvents(0))
		switch (event.getTaskStatus()) {
			case SUCCEEDED:
				break;
               default:
				diag += "Diagnostics for: " + event.getTaskTrackerHttp() + "\n";
				for (final String s : job.getTaskDiagnostics(event.getTaskAttemptId()))
					diag += s + "\n";
				diag += "\n";
				break;
		}
	updateStatus(diag, context.getConfiguration().getInt("boa.hadoop.jobid", 0));
}
 
開發者ID:boalang,項目名稱:compiler,代碼行數:21,代碼來源:BoaOutputCommitter.java

示例2: testTaskCompletionEvents

import org.apache.hadoop.mapred.RunningJob; //導入方法依賴的package包/類
public void testTaskCompletionEvents() throws Exception {
  LOG.info("Starting SleepJob to test TaskCompletionEvents");
  corona = new MiniCoronaCluster.Builder().numTaskTrackers(1).build();
  JobConf conf = corona.createJobConf();
  
  SleepJob sleepJob = new SleepJob();
  ToolRunner.run(conf, sleepJob, new String[] { "-m", "10", "-r", "10",
      "-mt", "5", "-rt", "5" });
  List<TaskCompletionEvent> events = new ArrayList<TaskCompletionEvent>();
  int index = 0;
  int numReduces = 0;
  int numMaps = 0;
  RunningJob rjob = sleepJob.getRunningJob();
  while (true) {
    TaskCompletionEvent[] someEvents = rjob.getTaskCompletionEvents(index);
    if (someEvents.length == 0) {
      break;
    }
    for (int i = 0; i < someEvents.length; i++) {
      if (someEvents[i].isMapTask()) {
        numMaps++;
      } else {
        numReduces++;
      }
    }
    index += someEvents.length;
  }
  Assert.assertEquals("Num maps is " + numMaps, 10, numMaps);
  Assert.assertTrue("Num reduces is " + numReduces, numReduces >= 10);
}
 
開發者ID:rhli,項目名稱:hadoop-EAR,代碼行數:31,代碼來源:TestCompletionEvents.java


注:本文中的org.apache.hadoop.mapred.RunningJob.getTaskCompletionEvents方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。