Java 类org.apache.hadoop.mapreduce.v2.app.job.event.JobDiagnosticsUpdateEvent 实例源码

项目:hadoop    文件:MRClientService.java   
@SuppressWarnings("unchecked")
@Override
public KillJobResponse killJob(KillJobRequest request) 
  throws IOException {
  JobId jobId = request.getJobId();
  UserGroupInformation callerUGI = UserGroupInformation.getCurrentUser();
  String message = "Kill job " + jobId + " received from " + callerUGI
      + " at " + Server.getRemoteAddress();
  LOG.info(message);
  verifyAndGetJob(jobId, JobACL.MODIFY_JOB, false);
  appContext.getEventHandler().handle(
      new JobDiagnosticsUpdateEvent(jobId, message));
  appContext.getEventHandler().handle(
      new JobEvent(jobId, JobEventType.JOB_KILL));
  KillJobResponse response = 
    recordFactory.newRecordInstance(KillJobResponse.class);
  return response;
}
项目:hadoop    文件:TestJobImpl.java   
@Test
public void testReportDiagnostics() throws Exception {
  JobID jobID = JobID.forName("job_1234567890000_0001");
  JobId jobId = TypeConverter.toYarn(jobID);
  final String diagMsg = "some diagnostic message";
  final JobDiagnosticsUpdateEvent diagUpdateEvent =
      new JobDiagnosticsUpdateEvent(jobId, diagMsg);
  MRAppMetrics mrAppMetrics = MRAppMetrics.create();
  AppContext mockContext = mock(AppContext.class);
  when(mockContext.hasSuccessfullyUnregistered()).thenReturn(true);
  JobImpl job = new JobImpl(jobId, Records
      .newRecord(ApplicationAttemptId.class), new Configuration(),
      mock(EventHandler.class),
      null, mock(JobTokenSecretManager.class), null,
      new SystemClock(), null,
      mrAppMetrics, null, true, null, 0, null, mockContext, null, null);
  job.handle(diagUpdateEvent);
  String diagnostics = job.getReport().getDiagnostics();
  Assert.assertNotNull(diagnostics);
  Assert.assertTrue(diagnostics.contains(diagMsg));

  job = new JobImpl(jobId, Records
      .newRecord(ApplicationAttemptId.class), new Configuration(),
      mock(EventHandler.class),
      null, mock(JobTokenSecretManager.class), null,
      new SystemClock(), null,
      mrAppMetrics, null, true, null, 0, null, mockContext, null, null);
  job.handle(new JobEvent(jobId, JobEventType.JOB_KILL));
  job.handle(diagUpdateEvent);
  diagnostics = job.getReport().getDiagnostics();
  Assert.assertNotNull(diagnostics);
  Assert.assertTrue(diagnostics.contains(diagMsg));
}
项目:aliyun-oss-hadoop-fs    文件:MRClientService.java   
@SuppressWarnings("unchecked")
@Override
public KillJobResponse killJob(KillJobRequest request) 
  throws IOException {
  JobId jobId = request.getJobId();
  UserGroupInformation callerUGI = UserGroupInformation.getCurrentUser();
  String message = "Kill job " + jobId + " received from " + callerUGI
      + " at " + Server.getRemoteAddress();
  LOG.info(message);
  verifyAndGetJob(jobId, JobACL.MODIFY_JOB, false);
  appContext.getEventHandler().handle(
      new JobDiagnosticsUpdateEvent(jobId, message));
  appContext.getEventHandler().handle(
      new JobEvent(jobId, JobEventType.JOB_KILL));
  KillJobResponse response = 
    recordFactory.newRecordInstance(KillJobResponse.class);
  return response;
}
项目:big-c    文件:MRClientService.java   
@SuppressWarnings("unchecked")
@Override
public KillJobResponse killJob(KillJobRequest request) 
  throws IOException {
  JobId jobId = request.getJobId();
  UserGroupInformation callerUGI = UserGroupInformation.getCurrentUser();
  String message = "Kill job " + jobId + " received from " + callerUGI
      + " at " + Server.getRemoteAddress();
  LOG.info(message);
  verifyAndGetJob(jobId, JobACL.MODIFY_JOB, false);
  appContext.getEventHandler().handle(
      new JobDiagnosticsUpdateEvent(jobId, message));
  appContext.getEventHandler().handle(
      new JobEvent(jobId, JobEventType.JOB_KILL));
  KillJobResponse response = 
    recordFactory.newRecordInstance(KillJobResponse.class);
  return response;
}
项目:hadoop-2.6.0-cdh5.4.3    文件:MRClientService.java   
@SuppressWarnings("unchecked")
@Override
public KillJobResponse killJob(KillJobRequest request) 
  throws IOException {
  JobId jobId = request.getJobId();
  UserGroupInformation callerUGI = UserGroupInformation.getCurrentUser();
  String message = "Kill job " + jobId + " received from " + callerUGI
      + " at " + Server.getRemoteAddress();
  LOG.info(message);
  verifyAndGetJob(jobId, JobACL.MODIFY_JOB);
  appContext.getEventHandler().handle(
      new JobDiagnosticsUpdateEvent(jobId, message));
  appContext.getEventHandler().handle(
      new JobEvent(jobId, JobEventType.JOB_KILL));
  KillJobResponse response = 
    recordFactory.newRecordInstance(KillJobResponse.class);
  return response;
}
项目:hadoop-plus    文件:MRClientService.java   
@SuppressWarnings("unchecked")
@Override
public KillJobResponse killJob(KillJobRequest request) 
  throws IOException {
  JobId jobId = request.getJobId();
  String message = "Kill Job received from client " + jobId;
  LOG.info(message);
 verifyAndGetJob(jobId, true);
  appContext.getEventHandler().handle(
      new JobDiagnosticsUpdateEvent(jobId, message));
  appContext.getEventHandler().handle(
      new JobEvent(jobId, JobEventType.JOB_KILL));
  KillJobResponse response = 
    recordFactory.newRecordInstance(KillJobResponse.class);
  return response;
}
项目:FlexMap    文件:MRClientService.java   
@SuppressWarnings("unchecked")
@Override
public KillJobResponse killJob(KillJobRequest request) 
  throws IOException {
  JobId jobId = request.getJobId();
  UserGroupInformation callerUGI = UserGroupInformation.getCurrentUser();
  String message = "Kill job " + jobId + " received from " + callerUGI
      + " at " + Server.getRemoteAddress();
  LOG.info(message);
  verifyAndGetJob(jobId, JobACL.MODIFY_JOB);
  appContext.getEventHandler().handle(
      new JobDiagnosticsUpdateEvent(jobId, message));
  appContext.getEventHandler().handle(
      new JobEvent(jobId, JobEventType.JOB_KILL));
  KillJobResponse response = 
    recordFactory.newRecordInstance(KillJobResponse.class);
  return response;
}
项目:hops    文件:MRClientService.java   
@SuppressWarnings("unchecked")
@Override
public KillJobResponse killJob(KillJobRequest request) 
  throws IOException {
  JobId jobId = request.getJobId();
  UserGroupInformation callerUGI = UserGroupInformation.getCurrentUser();
  String message = "Kill job " + jobId + " received from " + callerUGI
      + " at " + Server.getRemoteAddress();
  LOG.info(message);
  verifyAndGetJob(jobId, JobACL.MODIFY_JOB, false);
  appContext.getEventHandler().handle(
      new JobDiagnosticsUpdateEvent(jobId, message));
  appContext.getEventHandler().handle(
      new JobEvent(jobId, JobEventType.JOB_KILL));
  KillJobResponse response = 
    recordFactory.newRecordInstance(KillJobResponse.class);
  return response;
}
项目:hadoop-TCP    文件:MRClientService.java   
@SuppressWarnings("unchecked")
@Override
public KillJobResponse killJob(KillJobRequest request) 
  throws IOException {
  JobId jobId = request.getJobId();
  UserGroupInformation callerUGI = UserGroupInformation.getCurrentUser();
  String message = "Kill job " + jobId + " received from " + callerUGI
      + " at " + Server.getRemoteAddress();
  LOG.info(message);
  verifyAndGetJob(jobId, JobACL.MODIFY_JOB);
  appContext.getEventHandler().handle(
      new JobDiagnosticsUpdateEvent(jobId, message));
  appContext.getEventHandler().handle(
      new JobEvent(jobId, JobEventType.JOB_KILL));
  KillJobResponse response = 
    recordFactory.newRecordInstance(KillJobResponse.class);
  return response;
}
项目:hardfs    文件:MRClientService.java   
@SuppressWarnings("unchecked")
@Override
public KillJobResponse killJob(KillJobRequest request) 
  throws IOException {
  JobId jobId = request.getJobId();
  UserGroupInformation callerUGI = UserGroupInformation.getCurrentUser();
  String message = "Kill job " + jobId + " received from " + callerUGI
      + " at " + Server.getRemoteAddress();
  LOG.info(message);
  verifyAndGetJob(jobId, JobACL.MODIFY_JOB);
  appContext.getEventHandler().handle(
      new JobDiagnosticsUpdateEvent(jobId, message));
  appContext.getEventHandler().handle(
      new JobEvent(jobId, JobEventType.JOB_KILL));
  KillJobResponse response = 
    recordFactory.newRecordInstance(KillJobResponse.class);
  return response;
}
项目:hadoop-on-lustre2    文件:MRClientService.java   
@SuppressWarnings("unchecked")
@Override
public KillJobResponse killJob(KillJobRequest request) 
  throws IOException {
  JobId jobId = request.getJobId();
  UserGroupInformation callerUGI = UserGroupInformation.getCurrentUser();
  String message = "Kill job " + jobId + " received from " + callerUGI
      + " at " + Server.getRemoteAddress();
  LOG.info(message);
  verifyAndGetJob(jobId, JobACL.MODIFY_JOB);
  appContext.getEventHandler().handle(
      new JobDiagnosticsUpdateEvent(jobId, message));
  appContext.getEventHandler().handle(
      new JobEvent(jobId, JobEventType.JOB_KILL));
  KillJobResponse response = 
    recordFactory.newRecordInstance(KillJobResponse.class);
  return response;
}
项目:hadoop    文件:TaskAttemptImpl.java   
@SuppressWarnings("unchecked")
@Override
public void handle(TaskAttemptEvent event) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Processing " + event.getTaskAttemptID() + " of type "
        + event.getType());
  }
  writeLock.lock();
  try {
    final TaskAttemptStateInternal oldState = getInternalState()  ;
    try {
      stateMachine.doTransition(event.getType(), event);
    } catch (InvalidStateTransitonException e) {
      LOG.error("Can't handle this event at current state for "
          + this.attemptId, e);
      eventHandler.handle(new JobDiagnosticsUpdateEvent(
          this.attemptId.getTaskId().getJobId(), "Invalid event " + event.getType() + 
          " on TaskAttempt " + this.attemptId));
      eventHandler.handle(new JobEvent(this.attemptId.getTaskId().getJobId(),
          JobEventType.INTERNAL_ERROR));
    }
    if (oldState != getInternalState()) {
        LOG.info(attemptId + " TaskAttempt Transitioned from " 
         + oldState + " to "
         + getInternalState());
    }
  } finally {
    writeLock.unlock();
  }
}
项目:hadoop    文件:TaskImpl.java   
protected void internalError(TaskEventType type) {
  LOG.error("Invalid event " + type + " on Task " + this.taskId);
  eventHandler.handle(new JobDiagnosticsUpdateEvent(
      this.taskId.getJobId(), "Invalid event " + type + 
      " on Task " + this.taskId));
  eventHandler.handle(new JobEvent(this.taskId.getJobId(),
      JobEventType.INTERNAL_ERROR));
}
项目:aliyun-oss-hadoop-fs    文件:TaskAttemptImpl.java   
@SuppressWarnings("unchecked")
@Override
public void handle(TaskAttemptEvent event) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Processing " + event.getTaskAttemptID() + " of type "
        + event.getType());
  }
  writeLock.lock();
  try {
    final TaskAttemptStateInternal oldState = getInternalState()  ;
    try {
      stateMachine.doTransition(event.getType(), event);
    } catch (InvalidStateTransitionException e) {
      LOG.error("Can't handle this event at current state for "
          + this.attemptId, e);
      eventHandler.handle(new JobDiagnosticsUpdateEvent(
          this.attemptId.getTaskId().getJobId(), "Invalid event " + event.getType() + 
          " on TaskAttempt " + this.attemptId));
      eventHandler.handle(new JobEvent(this.attemptId.getTaskId().getJobId(),
          JobEventType.INTERNAL_ERROR));
    }
    if (oldState != getInternalState()) {
        LOG.info(attemptId + " TaskAttempt Transitioned from " 
         + oldState + " to "
         + getInternalState());
    }
  } finally {
    writeLock.unlock();
  }
}
项目:aliyun-oss-hadoop-fs    文件:TaskImpl.java   
protected void internalError(TaskEventType type) {
  LOG.error("Invalid event " + type + " on Task " + this.taskId);
  eventHandler.handle(new JobDiagnosticsUpdateEvent(
      this.taskId.getJobId(), "Invalid event " + type + 
      " on Task " + this.taskId));
  eventHandler.handle(new JobEvent(this.taskId.getJobId(),
      JobEventType.INTERNAL_ERROR));
}
项目:aliyun-oss-hadoop-fs    文件:TestJobImpl.java   
@Test
public void testReportDiagnostics() throws Exception {
  JobID jobID = JobID.forName("job_1234567890000_0001");
  JobId jobId = TypeConverter.toYarn(jobID);
  final String diagMsg = "some diagnostic message";
  final JobDiagnosticsUpdateEvent diagUpdateEvent =
      new JobDiagnosticsUpdateEvent(jobId, diagMsg);
  MRAppMetrics mrAppMetrics = MRAppMetrics.create();
  AppContext mockContext = mock(AppContext.class);
  when(mockContext.hasSuccessfullyUnregistered()).thenReturn(true);
  JobImpl job = new JobImpl(jobId, Records
      .newRecord(ApplicationAttemptId.class), new Configuration(),
      mock(EventHandler.class),
      null, mock(JobTokenSecretManager.class), null,
      new SystemClock(), null,
      mrAppMetrics, null, true, null, 0, null, mockContext, null, null);
  job.handle(diagUpdateEvent);
  String diagnostics = job.getReport().getDiagnostics();
  Assert.assertNotNull(diagnostics);
  Assert.assertTrue(diagnostics.contains(diagMsg));

  job = new JobImpl(jobId, Records
      .newRecord(ApplicationAttemptId.class), new Configuration(),
      mock(EventHandler.class),
      null, mock(JobTokenSecretManager.class), null,
      new SystemClock(), null,
      mrAppMetrics, null, true, null, 0, null, mockContext, null, null);
  job.handle(new JobEvent(jobId, JobEventType.JOB_KILL));
  job.handle(diagUpdateEvent);
  diagnostics = job.getReport().getDiagnostics();
  Assert.assertNotNull(diagnostics);
  Assert.assertTrue(diagnostics.contains(diagMsg));
}
项目:big-c    文件:TaskAttemptImpl.java   
@SuppressWarnings("unchecked")
@Override
public void handle(TaskAttemptEvent event) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Processing " + event.getTaskAttemptID() + " of type "
        + event.getType());
  }
  writeLock.lock();
  try {
    final TaskAttemptStateInternal oldState = getInternalState()  ;
    try {
      stateMachine.doTransition(event.getType(), event);
    } catch (InvalidStateTransitonException e) {
      LOG.error("Can't handle this event at current state for "
          + this.attemptId, e);
      eventHandler.handle(new JobDiagnosticsUpdateEvent(
          this.attemptId.getTaskId().getJobId(), "Invalid event " + event.getType() + 
          " on TaskAttempt " + this.attemptId));
      eventHandler.handle(new JobEvent(this.attemptId.getTaskId().getJobId(),
          JobEventType.INTERNAL_ERROR));
    }
    if (oldState != getInternalState()) {
        LOG.info(attemptId + " TaskAttempt Transitioned from " 
         + oldState + " to "
         + getInternalState());
    }
  } finally {
    writeLock.unlock();
  }
}
项目:big-c    文件:TaskImpl.java   
protected void internalError(TaskEventType type) {
  LOG.error("Invalid event " + type + " on Task " + this.taskId);
  eventHandler.handle(new JobDiagnosticsUpdateEvent(
      this.taskId.getJobId(), "Invalid event " + type + 
      " on Task " + this.taskId));
  eventHandler.handle(new JobEvent(this.taskId.getJobId(),
      JobEventType.INTERNAL_ERROR));
}
项目:big-c    文件:TestJobImpl.java   
@Test
public void testReportDiagnostics() throws Exception {
  JobID jobID = JobID.forName("job_1234567890000_0001");
  JobId jobId = TypeConverter.toYarn(jobID);
  final String diagMsg = "some diagnostic message";
  final JobDiagnosticsUpdateEvent diagUpdateEvent =
      new JobDiagnosticsUpdateEvent(jobId, diagMsg);
  MRAppMetrics mrAppMetrics = MRAppMetrics.create();
  AppContext mockContext = mock(AppContext.class);
  when(mockContext.hasSuccessfullyUnregistered()).thenReturn(true);
  JobImpl job = new JobImpl(jobId, Records
      .newRecord(ApplicationAttemptId.class), new Configuration(),
      mock(EventHandler.class),
      null, mock(JobTokenSecretManager.class), null,
      new SystemClock(), null,
      mrAppMetrics, null, true, null, 0, null, mockContext, null, null);
  job.handle(diagUpdateEvent);
  String diagnostics = job.getReport().getDiagnostics();
  Assert.assertNotNull(diagnostics);
  Assert.assertTrue(diagnostics.contains(diagMsg));

  job = new JobImpl(jobId, Records
      .newRecord(ApplicationAttemptId.class), new Configuration(),
      mock(EventHandler.class),
      null, mock(JobTokenSecretManager.class), null,
      new SystemClock(), null,
      mrAppMetrics, null, true, null, 0, null, mockContext, null, null);
  job.handle(new JobEvent(jobId, JobEventType.JOB_KILL));
  job.handle(diagUpdateEvent);
  diagnostics = job.getReport().getDiagnostics();
  Assert.assertNotNull(diagnostics);
  Assert.assertTrue(diagnostics.contains(diagMsg));
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TaskAttemptImpl.java   
@SuppressWarnings("unchecked")
@Override
public void handle(TaskAttemptEvent event) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Processing " + event.getTaskAttemptID() + " of type "
        + event.getType());
  }
  writeLock.lock();
  try {
    final TaskAttemptStateInternal oldState = getInternalState()  ;
    try {
      stateMachine.doTransition(event.getType(), event);
    } catch (InvalidStateTransitonException e) {
      LOG.error("Can't handle this event at current state for "
          + this.attemptId, e);
      eventHandler.handle(new JobDiagnosticsUpdateEvent(
          this.attemptId.getTaskId().getJobId(), "Invalid event " + event.getType() + 
          " on TaskAttempt " + this.attemptId));
      eventHandler.handle(new JobEvent(this.attemptId.getTaskId().getJobId(),
          JobEventType.INTERNAL_ERROR));
    }
    if (oldState != getInternalState()) {
        LOG.info(attemptId + " TaskAttempt Transitioned from " 
         + oldState + " to "
         + getInternalState());
    }
  } finally {
    writeLock.unlock();
  }
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TaskImpl.java   
protected void internalError(TaskEventType type) {
  LOG.error("Invalid event " + type + " on Task " + this.taskId);
  eventHandler.handle(new JobDiagnosticsUpdateEvent(
      this.taskId.getJobId(), "Invalid event " + type + 
      " on Task " + this.taskId));
  eventHandler.handle(new JobEvent(this.taskId.getJobId(),
      JobEventType.INTERNAL_ERROR));
}
项目:hadoop-2.6.0-cdh5.4.3    文件:TestJobImpl.java   
@Test
public void testReportDiagnostics() throws Exception {
  JobID jobID = JobID.forName("job_1234567890000_0001");
  JobId jobId = TypeConverter.toYarn(jobID);
  final String diagMsg = "some diagnostic message";
  final JobDiagnosticsUpdateEvent diagUpdateEvent =
      new JobDiagnosticsUpdateEvent(jobId, diagMsg);
  MRAppMetrics mrAppMetrics = MRAppMetrics.create();
  AppContext mockContext = mock(AppContext.class);
  when(mockContext.hasSuccessfullyUnregistered()).thenReturn(true);
  JobImpl job = new JobImpl(jobId, Records
      .newRecord(ApplicationAttemptId.class), new Configuration(),
      mock(EventHandler.class),
      null, mock(JobTokenSecretManager.class), null,
      new SystemClock(), null,
      mrAppMetrics, null, true, null, 0, null, mockContext, null, null);
  job.handle(diagUpdateEvent);
  String diagnostics = job.getReport().getDiagnostics();
  Assert.assertNotNull(diagnostics);
  Assert.assertTrue(diagnostics.contains(diagMsg));

  job = new JobImpl(jobId, Records
      .newRecord(ApplicationAttemptId.class), new Configuration(),
      mock(EventHandler.class),
      null, mock(JobTokenSecretManager.class), null,
      new SystemClock(), null,
      mrAppMetrics, null, true, null, 0, null, mockContext, null, null);
  job.handle(new JobEvent(jobId, JobEventType.JOB_KILL));
  job.handle(diagUpdateEvent);
  diagnostics = job.getReport().getDiagnostics();
  Assert.assertNotNull(diagnostics);
  Assert.assertTrue(diagnostics.contains(diagMsg));
}
项目:hadoop-plus    文件:TaskAttemptImpl.java   
@SuppressWarnings("unchecked")
@Override
public void handle(TaskAttemptEvent event) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Processing " + event.getTaskAttemptID() + " of type "
        + event.getType());
  }
  writeLock.lock();
  try {
    final TaskAttemptStateInternal oldState = getInternalState()  ;
    try {
      stateMachine.doTransition(event.getType(), event);
    } catch (InvalidStateTransitonException e) {
      LOG.error("Can't handle this event at current state for "
          + this.attemptId, e);
      eventHandler.handle(new JobDiagnosticsUpdateEvent(
          this.attemptId.getTaskId().getJobId(), "Invalid event " + event.getType() + 
          " on TaskAttempt " + this.attemptId));
      eventHandler.handle(new JobEvent(this.attemptId.getTaskId().getJobId(),
          JobEventType.INTERNAL_ERROR));
    }
    if (oldState != getInternalState()) {
        LOG.info(attemptId + " TaskAttempt Transitioned from " 
         + oldState + " to "
         + getInternalState());
    }
  } finally {
    writeLock.unlock();
  }
}
项目:hadoop-plus    文件:TaskImpl.java   
protected void internalError(TaskEventType type) {
  LOG.error("Invalid event " + type + " on Task " + this.taskId);
  eventHandler.handle(new JobDiagnosticsUpdateEvent(
      this.taskId.getJobId(), "Invalid event " + type + 
      " on Task " + this.taskId));
  eventHandler.handle(new JobEvent(this.taskId.getJobId(),
      JobEventType.INTERNAL_ERROR));
}
项目:hadoop-plus    文件:TestJobImpl.java   
@Test
public void testReportDiagnostics() throws Exception {
  JobID jobID = JobID.forName("job_1234567890000_0001");
  JobId jobId = TypeConverter.toYarn(jobID);
  final String diagMsg = "some diagnostic message";
  final JobDiagnosticsUpdateEvent diagUpdateEvent =
      new JobDiagnosticsUpdateEvent(jobId, diagMsg);
  MRAppMetrics mrAppMetrics = MRAppMetrics.create();
  JobImpl job = new JobImpl(jobId, Records
      .newRecord(ApplicationAttemptId.class), new Configuration(),
      mock(EventHandler.class),
      null, mock(JobTokenSecretManager.class), null,
      new SystemClock(), null,
      mrAppMetrics, null, true, null, 0, null, null, null, null);
  job.handle(diagUpdateEvent);
  String diagnostics = job.getReport().getDiagnostics();
  Assert.assertNotNull(diagnostics);
  Assert.assertTrue(diagnostics.contains(diagMsg));

  job = new JobImpl(jobId, Records
      .newRecord(ApplicationAttemptId.class), new Configuration(),
      mock(EventHandler.class),
      null, mock(JobTokenSecretManager.class), null,
      new SystemClock(), null,
      mrAppMetrics, null, true, null, 0, null, null, null, null);
  job.handle(new JobEvent(jobId, JobEventType.JOB_KILL));
  job.handle(diagUpdateEvent);
  diagnostics = job.getReport().getDiagnostics();
  Assert.assertNotNull(diagnostics);
  Assert.assertTrue(diagnostics.contains(diagMsg));
}
项目:FlexMap    文件:TaskAttemptImpl.java   
@SuppressWarnings("unchecked")
@Override
public void handle(TaskAttemptEvent event) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Processing " + event.getTaskAttemptID() + " of type "
        + event.getType());
  }
  writeLock.lock();
  try {
    final TaskAttemptStateInternal oldState = getInternalState()  ;
    try {
      stateMachine.doTransition(event.getType(), event);
    } catch (InvalidStateTransitonException e) {
      LOG.error("Can't handle this event at current state for "
          + this.attemptId, e);
      eventHandler.handle(new JobDiagnosticsUpdateEvent(
          this.attemptId.getTaskId().getJobId(), "Invalid event " + event.getType() + 
          " on TaskAttempt " + this.attemptId));
      eventHandler.handle(new JobEvent(this.attemptId.getTaskId().getJobId(),
          JobEventType.INTERNAL_ERROR));
    }
    if (oldState != getInternalState()) {
        LOG.info(attemptId + " TaskAttempt Transitioned from " 
         + oldState + " to "
         + getInternalState());
    }
  } finally {
    writeLock.unlock();
  }
}
项目:FlexMap    文件:TaskImpl.java   
protected void internalError(TaskEventType type) {
  LOG.error("Invalid event " + type + " on Task " + this.taskId);
  eventHandler.handle(new JobDiagnosticsUpdateEvent(
      this.taskId.getJobId(), "Invalid event " + type + 
      " on Task " + this.taskId));
  eventHandler.handle(new JobEvent(this.taskId.getJobId(),
      JobEventType.INTERNAL_ERROR));
}
项目:FlexMap    文件:TestJobImpl.java   
@Test
public void testReportDiagnostics() throws Exception {
  JobID jobID = JobID.forName("job_1234567890000_0001");
  JobId jobId = TypeConverter.toYarn(jobID);
  final String diagMsg = "some diagnostic message";
  final JobDiagnosticsUpdateEvent diagUpdateEvent =
      new JobDiagnosticsUpdateEvent(jobId, diagMsg);
  MRAppMetrics mrAppMetrics = MRAppMetrics.create();
  AppContext mockContext = mock(AppContext.class);
  when(mockContext.hasSuccessfullyUnregistered()).thenReturn(true);
  JobImpl job = new JobImpl(jobId, Records
      .newRecord(ApplicationAttemptId.class), new Configuration(),
      mock(EventHandler.class),
      null, mock(JobTokenSecretManager.class), null,
      new SystemClock(), null,
      mrAppMetrics, null, true, null, 0, null, mockContext, null, null);
  job.handle(diagUpdateEvent);
  String diagnostics = job.getReport().getDiagnostics();
  Assert.assertNotNull(diagnostics);
  Assert.assertTrue(diagnostics.contains(diagMsg));

  job = new JobImpl(jobId, Records
      .newRecord(ApplicationAttemptId.class), new Configuration(),
      mock(EventHandler.class),
      null, mock(JobTokenSecretManager.class), null,
      new SystemClock(), null,
      mrAppMetrics, null, true, null, 0, null, mockContext, null, null);
  job.handle(new JobEvent(jobId, JobEventType.JOB_KILL));
  job.handle(diagUpdateEvent);
  diagnostics = job.getReport().getDiagnostics();
  Assert.assertNotNull(diagnostics);
  Assert.assertTrue(diagnostics.contains(diagMsg));
}
项目:hops    文件:TaskAttemptImpl.java   
@SuppressWarnings("unchecked")
@Override
public void handle(TaskAttemptEvent event) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Processing " + event.getTaskAttemptID() + " of type "
        + event.getType());
  }
  writeLock.lock();
  try {
    final TaskAttemptStateInternal oldState = getInternalState()  ;
    try {
      stateMachine.doTransition(event.getType(), event);
    } catch (InvalidStateTransitionException e) {
      LOG.error("Can't handle this event at current state for "
          + this.attemptId, e);
      eventHandler.handle(new JobDiagnosticsUpdateEvent(
          this.attemptId.getTaskId().getJobId(), "Invalid event " + event.getType() + 
          " on TaskAttempt " + this.attemptId));
      eventHandler.handle(new JobEvent(this.attemptId.getTaskId().getJobId(),
          JobEventType.INTERNAL_ERROR));
    }
    if (oldState != getInternalState()) {
      if (getInternalState() == TaskAttemptStateInternal.FAILED) {
        String nodeId = null == this.container ? "Not-assigned"
            : this.container.getNodeId().toString();
        LOG.info(attemptId + " transitioned from state " + oldState + " to "
            + getInternalState() + ", event type is " + event.getType()
            + " and nodeId=" + nodeId);
      } else {
        LOG.info(attemptId + " TaskAttempt Transitioned from " + oldState
            + " to " + getInternalState());
      }
    }
  } finally {
    writeLock.unlock();
  }
}
项目:hops    文件:TaskImpl.java   
protected void internalError(TaskEventType type) {
  LOG.error("Invalid event " + type + " on Task " + this.taskId);
  eventHandler.handle(new JobDiagnosticsUpdateEvent(
      this.taskId.getJobId(), "Invalid event " + type + 
      " on Task " + this.taskId));
  eventHandler.handle(new JobEvent(this.taskId.getJobId(),
      JobEventType.INTERNAL_ERROR));
}
项目:hops    文件:TestJobImpl.java   
@Test
public void testReportDiagnostics() throws Exception {
  JobID jobID = JobID.forName("job_1234567890000_0001");
  JobId jobId = TypeConverter.toYarn(jobID);
  final String diagMsg = "some diagnostic message";
  final JobDiagnosticsUpdateEvent diagUpdateEvent =
      new JobDiagnosticsUpdateEvent(jobId, diagMsg);
  MRAppMetrics mrAppMetrics = MRAppMetrics.create();
  AppContext mockContext = mock(AppContext.class);
  when(mockContext.hasSuccessfullyUnregistered()).thenReturn(true);
  JobImpl job = new JobImpl(jobId, Records
      .newRecord(ApplicationAttemptId.class), new Configuration(),
      mock(EventHandler.class),
      null, mock(JobTokenSecretManager.class), null,
      new SystemClock(), null,
      mrAppMetrics, null, true, null, 0, null, mockContext, null, null);
  job.handle(diagUpdateEvent);
  String diagnostics = job.getReport().getDiagnostics();
  Assert.assertNotNull(diagnostics);
  Assert.assertTrue(diagnostics.contains(diagMsg));

  job = new JobImpl(jobId, Records
      .newRecord(ApplicationAttemptId.class), new Configuration(),
      mock(EventHandler.class),
      null, mock(JobTokenSecretManager.class), null,
      new SystemClock(), null,
      mrAppMetrics, null, true, null, 0, null, mockContext, null, null);
  job.handle(new JobEvent(jobId, JobEventType.JOB_KILL));
  job.handle(diagUpdateEvent);
  diagnostics = job.getReport().getDiagnostics();
  Assert.assertNotNull(diagnostics);
  Assert.assertTrue(diagnostics.contains(diagMsg));
}
项目:hadoop-TCP    文件:TaskAttemptImpl.java   
@SuppressWarnings("unchecked")
@Override
public void handle(TaskAttemptEvent event) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Processing " + event.getTaskAttemptID() + " of type "
        + event.getType());
  }
  writeLock.lock();
  try {
    final TaskAttemptStateInternal oldState = getInternalState()  ;
    try {
      stateMachine.doTransition(event.getType(), event);
    } catch (InvalidStateTransitonException e) {
      LOG.error("Can't handle this event at current state for "
          + this.attemptId, e);
      eventHandler.handle(new JobDiagnosticsUpdateEvent(
          this.attemptId.getTaskId().getJobId(), "Invalid event " + event.getType() + 
          " on TaskAttempt " + this.attemptId));
      eventHandler.handle(new JobEvent(this.attemptId.getTaskId().getJobId(),
          JobEventType.INTERNAL_ERROR));
    }
    if (oldState != getInternalState()) {
        LOG.info(attemptId + " TaskAttempt Transitioned from " 
         + oldState + " to "
         + getInternalState());
    }
  } finally {
    writeLock.unlock();
  }
}
项目:hadoop-TCP    文件:TaskImpl.java   
protected void internalError(TaskEventType type) {
  LOG.error("Invalid event " + type + " on Task " + this.taskId);
  eventHandler.handle(new JobDiagnosticsUpdateEvent(
      this.taskId.getJobId(), "Invalid event " + type + 
      " on Task " + this.taskId));
  eventHandler.handle(new JobEvent(this.taskId.getJobId(),
      JobEventType.INTERNAL_ERROR));
}
项目:hadoop-TCP    文件:TestJobImpl.java   
@Test
public void testReportDiagnostics() throws Exception {
  JobID jobID = JobID.forName("job_1234567890000_0001");
  JobId jobId = TypeConverter.toYarn(jobID);
  final String diagMsg = "some diagnostic message";
  final JobDiagnosticsUpdateEvent diagUpdateEvent =
      new JobDiagnosticsUpdateEvent(jobId, diagMsg);
  MRAppMetrics mrAppMetrics = MRAppMetrics.create();
  AppContext mockContext = mock(AppContext.class);
  when(mockContext.hasSuccessfullyUnregistered()).thenReturn(true);
  JobImpl job = new JobImpl(jobId, Records
      .newRecord(ApplicationAttemptId.class), new Configuration(),
      mock(EventHandler.class),
      null, mock(JobTokenSecretManager.class), null,
      new SystemClock(), null,
      mrAppMetrics, null, true, null, 0, null, mockContext, null, null);
  job.handle(diagUpdateEvent);
  String diagnostics = job.getReport().getDiagnostics();
  Assert.assertNotNull(diagnostics);
  Assert.assertTrue(diagnostics.contains(diagMsg));

  job = new JobImpl(jobId, Records
      .newRecord(ApplicationAttemptId.class), new Configuration(),
      mock(EventHandler.class),
      null, mock(JobTokenSecretManager.class), null,
      new SystemClock(), null,
      mrAppMetrics, null, true, null, 0, null, mockContext, null, null);
  job.handle(new JobEvent(jobId, JobEventType.JOB_KILL));
  job.handle(diagUpdateEvent);
  diagnostics = job.getReport().getDiagnostics();
  Assert.assertNotNull(diagnostics);
  Assert.assertTrue(diagnostics.contains(diagMsg));
}
项目:hardfs    文件:TaskAttemptImpl.java   
@SuppressWarnings("unchecked")
@Override
public void handle(TaskAttemptEvent event) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Processing " + event.getTaskAttemptID() + " of type "
        + event.getType());
  }
  writeLock.lock();
  try {
    final TaskAttemptStateInternal oldState = getInternalState()  ;
    try {
      stateMachine.doTransition(event.getType(), event);
    } catch (InvalidStateTransitonException e) {
      LOG.error("Can't handle this event at current state for "
          + this.attemptId, e);
      eventHandler.handle(new JobDiagnosticsUpdateEvent(
          this.attemptId.getTaskId().getJobId(), "Invalid event " + event.getType() + 
          " on TaskAttempt " + this.attemptId));
      eventHandler.handle(new JobEvent(this.attemptId.getTaskId().getJobId(),
          JobEventType.INTERNAL_ERROR));
    }
    if (oldState != getInternalState()) {
        LOG.info(attemptId + " TaskAttempt Transitioned from " 
         + oldState + " to "
         + getInternalState());
    }
  } finally {
    writeLock.unlock();
  }
}
项目:hardfs    文件:TaskImpl.java   
protected void internalError(TaskEventType type) {
  LOG.error("Invalid event " + type + " on Task " + this.taskId);
  eventHandler.handle(new JobDiagnosticsUpdateEvent(
      this.taskId.getJobId(), "Invalid event " + type + 
      " on Task " + this.taskId));
  eventHandler.handle(new JobEvent(this.taskId.getJobId(),
      JobEventType.INTERNAL_ERROR));
}
项目:hardfs    文件:TestJobImpl.java   
@Test
public void testReportDiagnostics() throws Exception {
  JobID jobID = JobID.forName("job_1234567890000_0001");
  JobId jobId = TypeConverter.toYarn(jobID);
  final String diagMsg = "some diagnostic message";
  final JobDiagnosticsUpdateEvent diagUpdateEvent =
      new JobDiagnosticsUpdateEvent(jobId, diagMsg);
  MRAppMetrics mrAppMetrics = MRAppMetrics.create();
  AppContext mockContext = mock(AppContext.class);
  when(mockContext.hasSuccessfullyUnregistered()).thenReturn(true);
  JobImpl job = new JobImpl(jobId, Records
      .newRecord(ApplicationAttemptId.class), new Configuration(),
      mock(EventHandler.class),
      null, mock(JobTokenSecretManager.class), null,
      new SystemClock(), null,
      mrAppMetrics, null, true, null, 0, null, mockContext, null, null);
  job.handle(diagUpdateEvent);
  String diagnostics = job.getReport().getDiagnostics();
  Assert.assertNotNull(diagnostics);
  Assert.assertTrue(diagnostics.contains(diagMsg));

  job = new JobImpl(jobId, Records
      .newRecord(ApplicationAttemptId.class), new Configuration(),
      mock(EventHandler.class),
      null, mock(JobTokenSecretManager.class), null,
      new SystemClock(), null,
      mrAppMetrics, null, true, null, 0, null, mockContext, null, null);
  job.handle(new JobEvent(jobId, JobEventType.JOB_KILL));
  job.handle(diagUpdateEvent);
  diagnostics = job.getReport().getDiagnostics();
  Assert.assertNotNull(diagnostics);
  Assert.assertTrue(diagnostics.contains(diagMsg));
}
项目:hadoop-on-lustre2    文件:TaskAttemptImpl.java   
@SuppressWarnings("unchecked")
@Override
public void handle(TaskAttemptEvent event) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Processing " + event.getTaskAttemptID() + " of type "
        + event.getType());
  }
  writeLock.lock();
  try {
    final TaskAttemptStateInternal oldState = getInternalState()  ;
    try {
      stateMachine.doTransition(event.getType(), event);
    } catch (InvalidStateTransitonException e) {
      LOG.error("Can't handle this event at current state for "
          + this.attemptId, e);
      eventHandler.handle(new JobDiagnosticsUpdateEvent(
          this.attemptId.getTaskId().getJobId(), "Invalid event " + event.getType() + 
          " on TaskAttempt " + this.attemptId));
      eventHandler.handle(new JobEvent(this.attemptId.getTaskId().getJobId(),
          JobEventType.INTERNAL_ERROR));
    }
    if (oldState != getInternalState()) {
        LOG.info(attemptId + " TaskAttempt Transitioned from " 
         + oldState + " to "
         + getInternalState());
    }
  } finally {
    writeLock.unlock();
  }
}
项目:hadoop-on-lustre2    文件:TaskImpl.java   
protected void internalError(TaskEventType type) {
  LOG.error("Invalid event " + type + " on Task " + this.taskId);
  eventHandler.handle(new JobDiagnosticsUpdateEvent(
      this.taskId.getJobId(), "Invalid event " + type + 
      " on Task " + this.taskId));
  eventHandler.handle(new JobEvent(this.taskId.getJobId(),
      JobEventType.INTERNAL_ERROR));
}
项目:hadoop-on-lustre2    文件:TestJobImpl.java   
@Test
public void testReportDiagnostics() throws Exception {
  JobID jobID = JobID.forName("job_1234567890000_0001");
  JobId jobId = TypeConverter.toYarn(jobID);
  final String diagMsg = "some diagnostic message";
  final JobDiagnosticsUpdateEvent diagUpdateEvent =
      new JobDiagnosticsUpdateEvent(jobId, diagMsg);
  MRAppMetrics mrAppMetrics = MRAppMetrics.create();
  AppContext mockContext = mock(AppContext.class);
  when(mockContext.hasSuccessfullyUnregistered()).thenReturn(true);
  JobImpl job = new JobImpl(jobId, Records
      .newRecord(ApplicationAttemptId.class), new Configuration(),
      mock(EventHandler.class),
      null, mock(JobTokenSecretManager.class), null,
      new SystemClock(), null,
      mrAppMetrics, null, true, null, 0, null, mockContext, null, null);
  job.handle(diagUpdateEvent);
  String diagnostics = job.getReport().getDiagnostics();
  Assert.assertNotNull(diagnostics);
  Assert.assertTrue(diagnostics.contains(diagMsg));

  job = new JobImpl(jobId, Records
      .newRecord(ApplicationAttemptId.class), new Configuration(),
      mock(EventHandler.class),
      null, mock(JobTokenSecretManager.class), null,
      new SystemClock(), null,
      mrAppMetrics, null, true, null, 0, null, mockContext, null, null);
  job.handle(new JobEvent(jobId, JobEventType.JOB_KILL));
  job.handle(diagUpdateEvent);
  diagnostics = job.getReport().getDiagnostics();
  Assert.assertNotNull(diagnostics);
  Assert.assertTrue(diagnostics.contains(diagMsg));
}