org.apache.hadoop.mapreduce.v2.api.records.JobReport#setJobState ( )源码实例Demo

下面列出了org.apache.hadoop.mapreduce.v2.api.records.JobReport#setJobState ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: hadoop   文件: NotRunningJob.java
@Override
public GetJobReportResponse getJobReport(GetJobReportRequest request)
    throws IOException {
  JobReport jobReport =
    recordFactory.newRecordInstance(JobReport.class);
  jobReport.setJobId(request.getJobId());
  jobReport.setJobState(jobState);
  jobReport.setUser(applicationReport.getUser());
  jobReport.setStartTime(applicationReport.getStartTime());
  jobReport.setDiagnostics(applicationReport.getDiagnostics());
  jobReport.setJobName(applicationReport.getName());
  jobReport.setTrackingUrl(applicationReport.getTrackingUrl());
  jobReport.setFinishTime(applicationReport.getFinishTime());

  GetJobReportResponse resp =
      recordFactory.newRecordInstance(GetJobReportResponse.class);
  resp.setJobReport(jobReport);
  return resp;
}
 
源代码2 项目: hadoop   文件: TestClientRedirect.java
@Override
public GetJobReportResponse getJobReport(GetJobReportRequest request)
    throws IOException {

  amContact = true;

  JobReport jobReport = recordFactory.newRecordInstance(JobReport.class);
  jobReport.setJobId(request.getJobId());
  jobReport.setJobState(JobState.RUNNING);
  jobReport.setJobName("TestClientRedirect-jobname");
  jobReport.setUser("TestClientRedirect-user");
  jobReport.setStartTime(0L);
  jobReport.setFinishTime(1L);

  GetJobReportResponse response = recordFactory
      .newRecordInstance(GetJobReportResponse.class);
  response.setJobReport(jobReport);
  return response;
}
 
源代码3 项目: hadoop   文件: MRBuilderUtils.java
public static JobReport newJobReport(JobId jobId, String jobName,
    String userName, JobState state, long submitTime, long startTime, long finishTime,
    float setupProgress, float mapProgress, float reduceProgress,
    float cleanupProgress, String jobFile, List<AMInfo> amInfos,
    boolean isUber, String diagnostics) {
  JobReport report = Records.newRecord(JobReport.class);
  report.setJobId(jobId);
  report.setJobName(jobName);
  report.setUser(userName);
  report.setJobState(state);
  report.setSubmitTime(submitTime);
  report.setStartTime(startTime);
  report.setFinishTime(finishTime);
  report.setSetupProgress(setupProgress);
  report.setCleanupProgress(cleanupProgress);
  report.setMapProgress(mapProgress);
  report.setReduceProgress(reduceProgress);
  report.setJobFile(jobFile);
  report.setAMInfos(amInfos);
  report.setIsUber(isUber);
  report.setDiagnostics(diagnostics);
  return report;
}
 
源代码4 项目: hadoop   文件: TestTypeConverter.java
@Test
public void testFromYarnJobReport() throws Exception {
  int jobStartTime = 612354;
  int jobFinishTime = 612355;
  JobState state = JobState.RUNNING;
  JobId jobId = Records.newRecord(JobId.class);
  JobReport jobReport = Records.newRecord(JobReport.class);
  ApplicationId applicationId = ApplicationId.newInstance(0, 0);
  jobId.setAppId(applicationId);
  jobId.setId(0);    
  jobReport.setJobId(jobId);
  jobReport.setJobState(state);
  jobReport.setStartTime(jobStartTime);
  jobReport.setFinishTime(jobFinishTime);
  jobReport.setUser("TestTypeConverter-user");    
  JobStatus jobStatus = TypeConverter.fromYarn(jobReport, "dummy-jobfile");
  Assert.assertEquals(jobStartTime, jobStatus.getStartTime());
  Assert.assertEquals(jobFinishTime, jobStatus.getFinishTime());    
  Assert.assertEquals(state.toString(), jobStatus.getState().toString());
}
 
源代码5 项目: big-c   文件: NotRunningJob.java
@Override
public GetJobReportResponse getJobReport(GetJobReportRequest request)
    throws IOException {
  JobReport jobReport =
    recordFactory.newRecordInstance(JobReport.class);
  jobReport.setJobId(request.getJobId());
  jobReport.setJobState(jobState);
  jobReport.setUser(applicationReport.getUser());
  jobReport.setStartTime(applicationReport.getStartTime());
  jobReport.setDiagnostics(applicationReport.getDiagnostics());
  jobReport.setJobName(applicationReport.getName());
  jobReport.setTrackingUrl(applicationReport.getTrackingUrl());
  jobReport.setFinishTime(applicationReport.getFinishTime());

  GetJobReportResponse resp =
      recordFactory.newRecordInstance(GetJobReportResponse.class);
  resp.setJobReport(jobReport);
  return resp;
}
 
源代码6 项目: big-c   文件: TestClientRedirect.java
@Override
public GetJobReportResponse getJobReport(GetJobReportRequest request)
    throws IOException {

  amContact = true;

  JobReport jobReport = recordFactory.newRecordInstance(JobReport.class);
  jobReport.setJobId(request.getJobId());
  jobReport.setJobState(JobState.RUNNING);
  jobReport.setJobName("TestClientRedirect-jobname");
  jobReport.setUser("TestClientRedirect-user");
  jobReport.setStartTime(0L);
  jobReport.setFinishTime(1L);

  GetJobReportResponse response = recordFactory
      .newRecordInstance(GetJobReportResponse.class);
  response.setJobReport(jobReport);
  return response;
}
 
源代码7 项目: big-c   文件: MRBuilderUtils.java
public static JobReport newJobReport(JobId jobId, String jobName,
    String userName, JobState state, long submitTime, long startTime, long finishTime,
    float setupProgress, float mapProgress, float reduceProgress,
    float cleanupProgress, String jobFile, List<AMInfo> amInfos,
    boolean isUber, String diagnostics) {
  JobReport report = Records.newRecord(JobReport.class);
  report.setJobId(jobId);
  report.setJobName(jobName);
  report.setUser(userName);
  report.setJobState(state);
  report.setSubmitTime(submitTime);
  report.setStartTime(startTime);
  report.setFinishTime(finishTime);
  report.setSetupProgress(setupProgress);
  report.setCleanupProgress(cleanupProgress);
  report.setMapProgress(mapProgress);
  report.setReduceProgress(reduceProgress);
  report.setJobFile(jobFile);
  report.setAMInfos(amInfos);
  report.setIsUber(isUber);
  report.setDiagnostics(diagnostics);
  return report;
}
 
源代码8 项目: big-c   文件: TestTypeConverter.java
@Test
public void testFromYarnJobReport() throws Exception {
  int jobStartTime = 612354;
  int jobFinishTime = 612355;
  JobState state = JobState.RUNNING;
  JobId jobId = Records.newRecord(JobId.class);
  JobReport jobReport = Records.newRecord(JobReport.class);
  ApplicationId applicationId = ApplicationId.newInstance(0, 0);
  jobId.setAppId(applicationId);
  jobId.setId(0);    
  jobReport.setJobId(jobId);
  jobReport.setJobState(state);
  jobReport.setStartTime(jobStartTime);
  jobReport.setFinishTime(jobFinishTime);
  jobReport.setUser("TestTypeConverter-user");    
  JobStatus jobStatus = TypeConverter.fromYarn(jobReport, "dummy-jobfile");
  Assert.assertEquals(jobStartTime, jobStatus.getStartTime());
  Assert.assertEquals(jobFinishTime, jobStatus.getFinishTime());    
  Assert.assertEquals(state.toString(), jobStatus.getState().toString());
}
 
源代码9 项目: incubator-tez   文件: NotRunningJob.java
@Override
public GetJobReportResponse getJobReport(GetJobReportRequest request)
    throws IOException {
  JobReport jobReport =
    recordFactory.newRecordInstance(JobReport.class);
  jobReport.setJobId(request.getJobId());
  jobReport.setJobState(jobState);
  jobReport.setUser(applicationReport.getUser());
  jobReport.setStartTime(applicationReport.getStartTime());
  jobReport.setDiagnostics(applicationReport.getDiagnostics());
  jobReport.setJobName(applicationReport.getName());
  jobReport.setTrackingUrl(applicationReport.getTrackingUrl());
  jobReport.setFinishTime(applicationReport.getFinishTime());

  GetJobReportResponse resp =
      recordFactory.newRecordInstance(GetJobReportResponse.class);
  resp.setJobReport(jobReport);
  return resp;
}
 
源代码10 项目: tez   文件: NotRunningJob.java
@Override
public GetJobReportResponse getJobReport(GetJobReportRequest request)
    throws IOException {
  JobReport jobReport =
    recordFactory.newRecordInstance(JobReport.class);
  jobReport.setJobId(request.getJobId());
  jobReport.setJobState(jobState);
  jobReport.setUser(applicationReport.getUser());
  jobReport.setStartTime(applicationReport.getStartTime());
  jobReport.setDiagnostics(applicationReport.getDiagnostics());
  jobReport.setJobName(applicationReport.getName());
  jobReport.setTrackingUrl(applicationReport.getTrackingUrl());
  jobReport.setFinishTime(applicationReport.getFinishTime());

  GetJobReportResponse resp =
      recordFactory.newRecordInstance(GetJobReportResponse.class);
  resp.setJobReport(jobReport);
  return resp;
}
 
源代码11 项目: hadoop   文件: MockJobs.java
public static JobReport newJobReport(JobId id) {
  JobReport report = Records.newRecord(JobReport.class);
  report.setJobId(id);
  report.setSubmitTime(System.currentTimeMillis()-DT);
  report
      .setStartTime(System.currentTimeMillis() - (int) (Math.random() * DT));
  report.setFinishTime(System.currentTimeMillis()
      + (int) (Math.random() * DT) + 1);
  report.setMapProgress((float) Math.random());
  report.setReduceProgress((float) Math.random());
  report.setJobState(JOB_STATES.next());
  return report;
}
 
源代码12 项目: hadoop   文件: TestClientServiceDelegate.java
private GetJobReportResponse getJobReportResponse() {
  GetJobReportResponse jobReportResponse = Records
      .newRecord(GetJobReportResponse.class);
  JobReport jobReport = Records.newRecord(JobReport.class);
  jobReport.setJobId(jobId);
  jobReport.setJobState(JobState.SUCCEEDED);
  jobReportResponse.setJobReport(jobReport);
  return jobReportResponse;
}
 
源代码13 项目: hadoop   文件: TestClientServiceDelegate.java
private GetJobReportResponse getJobReportResponseFromHistoryServer() {
  GetJobReportResponse jobReportResponse = Records                                              
      .newRecord(GetJobReportResponse.class);                                                   
  JobReport jobReport = Records.newRecord(JobReport.class);                                     
  jobReport.setJobId(jobId);                                                                    
  jobReport.setJobState(JobState.SUCCEEDED);                                                    
  jobReport.setMapProgress(1.0f);
  jobReport.setReduceProgress(1.0f);
  jobReport.setJobFile("TestJobFilePath");
  jobReport.setTrackingUrl("http://TestTrackingUrl");
  jobReportResponse.setJobReport(jobReport);
  return jobReportResponse;
}
 
源代码14 项目: big-c   文件: MockJobs.java
public static JobReport newJobReport(JobId id) {
  JobReport report = Records.newRecord(JobReport.class);
  report.setJobId(id);
  report.setSubmitTime(System.currentTimeMillis()-DT);
  report
      .setStartTime(System.currentTimeMillis() - (int) (Math.random() * DT));
  report.setFinishTime(System.currentTimeMillis()
      + (int) (Math.random() * DT) + 1);
  report.setMapProgress((float) Math.random());
  report.setReduceProgress((float) Math.random());
  report.setJobState(JOB_STATES.next());
  return report;
}
 
源代码15 项目: big-c   文件: TestClientServiceDelegate.java
private GetJobReportResponse getJobReportResponse() {
  GetJobReportResponse jobReportResponse = Records
      .newRecord(GetJobReportResponse.class);
  JobReport jobReport = Records.newRecord(JobReport.class);
  jobReport.setJobId(jobId);
  jobReport.setJobState(JobState.SUCCEEDED);
  jobReportResponse.setJobReport(jobReport);
  return jobReportResponse;
}
 
源代码16 项目: big-c   文件: TestClientServiceDelegate.java
private GetJobReportResponse getJobReportResponseFromHistoryServer() {
  GetJobReportResponse jobReportResponse = Records                                              
      .newRecord(GetJobReportResponse.class);                                                   
  JobReport jobReport = Records.newRecord(JobReport.class);                                     
  jobReport.setJobId(jobId);                                                                    
  jobReport.setJobState(JobState.SUCCEEDED);                                                    
  jobReport.setMapProgress(1.0f);
  jobReport.setReduceProgress(1.0f);
  jobReport.setJobFile("TestJobFilePath");
  jobReport.setTrackingUrl("http://TestTrackingUrl");
  jobReportResponse.setJobReport(jobReport);
  return jobReportResponse;
}
 
源代码17 项目: hadoop   文件: MRAppMaster.java
@VisibleForTesting
public void shutDownJob() {
  // job has finished
  // this is the only job, so shut down the Appmaster
  // note in a workflow scenario, this may lead to creation of a new
  // job (FIXME?)

  try {
    //if isLastAMRetry comes as true, should never set it to false
    if ( !isLastAMRetry){
      if (((JobImpl)job).getInternalState() != JobStateInternal.REBOOT) {
        LOG.info("We are finishing cleanly so this is the last retry");
        isLastAMRetry = true;
      }
    }
    notifyIsLastAMRetry(isLastAMRetry);
    // Stop all services
    // This will also send the final report to the ResourceManager
    LOG.info("Calling stop for all the services");
    MRAppMaster.this.stop();

    if (isLastAMRetry) {
      // Send job-end notification when it is safe to report termination to
      // users and it is the last AM retry
      if (getConfig().get(MRJobConfig.MR_JOB_END_NOTIFICATION_URL) != null) {
        try {
          LOG.info("Job end notification started for jobID : "
              + job.getReport().getJobId());
          JobEndNotifier notifier = new JobEndNotifier();
          notifier.setConf(getConfig());
          JobReport report = job.getReport();
          // If unregistration fails, the final state is unavailable. However,
          // at the last AM Retry, the client will finally be notified FAILED
          // from RM, so we should let users know FAILED via notifier as well
          if (!context.hasSuccessfullyUnregistered()) {
            report.setJobState(JobState.FAILED);
          }
          notifier.notify(report);
        } catch (InterruptedException ie) {
          LOG.warn("Job end notification interrupted for jobID : "
              + job.getReport().getJobId(), ie);
        }
      }
    }

    try {
      Thread.sleep(5000);
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
    clientService.stop();
  } catch (Throwable t) {
    LOG.warn("Graceful stop failed. Exiting.. ", t);
    ExitUtil.terminate(1, t);
  }

}
 
源代码18 项目: big-c   文件: MRAppMaster.java
@VisibleForTesting
public void shutDownJob() {
  // job has finished
  // this is the only job, so shut down the Appmaster
  // note in a workflow scenario, this may lead to creation of a new
  // job (FIXME?)

  try {
    //if isLastAMRetry comes as true, should never set it to false
    if ( !isLastAMRetry){
      if (((JobImpl)job).getInternalState() != JobStateInternal.REBOOT) {
        LOG.info("We are finishing cleanly so this is the last retry");
        isLastAMRetry = true;
      }
    }
    notifyIsLastAMRetry(isLastAMRetry);
    // Stop all services
    // This will also send the final report to the ResourceManager
    LOG.info("Calling stop for all the services");
    MRAppMaster.this.stop();

    if (isLastAMRetry) {
      // Send job-end notification when it is safe to report termination to
      // users and it is the last AM retry
      if (getConfig().get(MRJobConfig.MR_JOB_END_NOTIFICATION_URL) != null) {
        try {
          LOG.info("Job end notification started for jobID : "
              + job.getReport().getJobId());
          JobEndNotifier notifier = new JobEndNotifier();
          notifier.setConf(getConfig());
          JobReport report = job.getReport();
          // If unregistration fails, the final state is unavailable. However,
          // at the last AM Retry, the client will finally be notified FAILED
          // from RM, so we should let users know FAILED via notifier as well
          if (!context.hasSuccessfullyUnregistered()) {
            report.setJobState(JobState.FAILED);
          }
          notifier.notify(report);
        } catch (InterruptedException ie) {
          LOG.warn("Job end notification interrupted for jobID : "
              + job.getReport().getJobId(), ie);
        }
      }
    }

    try {
      Thread.sleep(5000);
    } catch (InterruptedException e) {
      e.printStackTrace();
    }
    clientService.stop();
  } catch (Throwable t) {
    LOG.warn("Graceful stop failed. Exiting.. ", t);
    ExitUtil.terminate(1, t);
  }

}