当前位置: 首页>>代码示例>>Java>>正文


Java JobStateInternal.REBOOT属性代码示例

本文整理汇总了Java中org.apache.hadoop.mapreduce.v2.app.job.JobStateInternal.REBOOT属性的典型用法代码示例。如果您正苦于以下问题:Java JobStateInternal.REBOOT属性的具体用法?Java JobStateInternal.REBOOT怎么用?Java JobStateInternal.REBOOT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.hadoop.mapreduce.v2.app.job.JobStateInternal的用法示例。


在下文中一共展示了JobStateInternal.REBOOT属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testNoDeletionofStagingOnReboot

@Test (timeout = 30000)
public void testNoDeletionofStagingOnReboot() throws IOException {
  conf.set(MRJobConfig.MAPREDUCE_JOB_DIR, stagingJobDir);
  fs = mock(FileSystem.class);
  when(fs.delete(any(Path.class),anyBoolean())).thenReturn(true);
  String user = UserGroupInformation.getCurrentUser().getShortUserName();
  Path stagingDir = MRApps.getStagingAreaDir(conf, user);
  when(fs.exists(stagingDir)).thenReturn(true);
  ApplicationId appId = ApplicationId.newInstance(System.currentTimeMillis(),
      0);
  ApplicationAttemptId attemptId = ApplicationAttemptId.newInstance(appId, 1);
  ContainerAllocator mockAlloc = mock(ContainerAllocator.class);
  Assert.assertTrue(MRJobConfig.DEFAULT_MR_AM_MAX_ATTEMPTS > 1);
  MRAppMaster appMaster = new TestMRApp(attemptId, mockAlloc,
      JobStateInternal.REBOOT, MRJobConfig.DEFAULT_MR_AM_MAX_ATTEMPTS);
  appMaster.init(conf);
  appMaster.start();
  //shutdown the job, not the lastRetry
  appMaster.shutDownJob();
  //test whether notifyIsLastAMRetry called
  Assert.assertEquals(false, ((TestMRApp)appMaster).getTestIsLastAMRetry());
  verify(fs, times(0)).delete(stagingJobPath, true);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:TestStagingCleanup.java

示例2: testDeletionofStagingOnReboot

public void testDeletionofStagingOnReboot() throws IOException {
  conf.set(MRJobConfig.MAPREDUCE_JOB_DIR, stagingJobDir);
  fs = mock(FileSystem.class);
  when(fs.delete(any(Path.class),anyBoolean())).thenReturn(true);
  String user = UserGroupInformation.getCurrentUser().getShortUserName();
  Path stagingDir = MRApps.getStagingAreaDir(conf, user);
  when(fs.exists(stagingDir)).thenReturn(true);
  ApplicationId appId = ApplicationId.newInstance(System.currentTimeMillis(),
      0);
  ApplicationAttemptId attemptId = ApplicationAttemptId.newInstance(appId, 1);
  ContainerAllocator mockAlloc = mock(ContainerAllocator.class);
  MRAppMaster appMaster = new TestMRApp(attemptId, mockAlloc,
      JobStateInternal.REBOOT, 1); //no retry
  appMaster.init(conf);
  appMaster.start();
  //shutdown the job, is lastRetry
  appMaster.shutDownJob();
  //test whether notifyIsLastAMRetry called
  Assert.assertEquals(true, ((TestMRApp)appMaster).getTestIsLastAMRetry());
  verify(fs).delete(stagingJobPath, true);
}
 
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:TestStagingCleanup.java

示例3: InternalRebootTransition

public InternalRebootTransition(){
  super(JobStateInternal.REBOOT, JobStateInternal.ERROR.toString());
}
 
开发者ID:naver,项目名称:hadoop,代码行数:3,代码来源:JobImpl.java

示例4: shutDownJob

@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);
  }

}
 
开发者ID:naver,项目名称:hadoop,代码行数:57,代码来源:MRAppMaster.java

示例5: shutDownJob

@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("Job finished cleanly, recording last MRAppMaster 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);
    exitMRAppMaster(1, t);
  }
  exitMRAppMaster(0, null);
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:57,代码来源:MRAppMaster.java


注:本文中的org.apache.hadoop.mapreduce.v2.app.job.JobStateInternal.REBOOT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。