Java Code Examples for org.apache.hadoop.mapreduce.v2.api.records.JobState#RUNNING

The following examples show how to use org.apache.hadoop.mapreduce.v2.api.records.JobState#RUNNING . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JobImpl.java    From hadoop with Apache License 2.0 6 votes vote down vote up
private JobState getExternalState(JobStateInternal smState) {
  switch (smState) {
  case KILL_WAIT:
  case KILL_ABORT:
    return JobState.KILLED;
  case SETUP:
  case COMMITTING:
    return JobState.RUNNING;
  case FAIL_WAIT:
  case FAIL_ABORT:
    return JobState.FAILED;
  case REBOOT:
    if (appContext.isLastAMRetry()) {
      return JobState.ERROR;
    } else {
      // In case of not last retry, return the external state as RUNNING since
      // otherwise JobClient will exit when it polls the AM for job state
      return JobState.RUNNING;
    }
  default:
    return JobState.valueOf(smState.name());
  }
}
 
Example 2
Source File: TestTypeConverter.java    From hadoop with Apache License 2.0 6 votes vote down vote up
@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());
}
 
Example 3
Source File: JobImpl.java    From big-c with Apache License 2.0 6 votes vote down vote up
private JobState getExternalState(JobStateInternal smState) {
  switch (smState) {
  case KILL_WAIT:
  case KILL_ABORT:
    return JobState.KILLED;
  case SETUP:
  case COMMITTING:
    return JobState.RUNNING;
  case FAIL_WAIT:
  case FAIL_ABORT:
    return JobState.FAILED;
  case REBOOT:
    if (appContext.isLastAMRetry()) {
      return JobState.ERROR;
    } else {
      // In case of not last retry, return the external state as RUNNING since
      // otherwise JobClient will exit when it polls the AM for job state
      return JobState.RUNNING;
    }
  default:
    return JobState.valueOf(smState.name());
  }
}
 
Example 4
Source File: TestTypeConverter.java    From big-c with Apache License 2.0 6 votes vote down vote up
@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());
}