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


Java Event.getType方法代码示例

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


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

示例1: testAppRejectionWithCancelledDelegationToken

import org.apache.hadoop.yarn.event.Event; //导入方法依赖的package包/类
@Test(timeout=60000)
public void testAppRejectionWithCancelledDelegationToken() throws Exception {
  MyFS dfs = (MyFS)FileSystem.get(conf);
  LOG.info("dfs="+(Object)dfs.hashCode() + ";conf="+conf.hashCode());

  MyToken token = dfs.getDelegationToken("user1");
  token.cancelToken();

  Credentials ts = new Credentials();
  ts.addToken(token.getKind(), token);
  
  // register the tokens for renewal
  ApplicationId appId =  BuilderUtils.newApplicationId(0, 0);
  delegationTokenRenewer.addApplicationAsync(appId, ts, true, "user");
  int waitCnt = 20;
  while (waitCnt-- >0) {
    if (!eventQueue.isEmpty()) {
      Event evt = eventQueue.take();
      if (evt.getType() == RMAppEventType.APP_REJECTED) {
        Assert.assertTrue(
            ((RMAppEvent) evt).getApplicationId().equals(appId));
        return;
      }
    } else {
      Thread.sleep(500);
    }
  }
  fail("App submission with a cancelled token should have failed");
}
 
开发者ID:naver,项目名称:hadoop,代码行数:30,代码来源:TestDelegationTokenRenewer.java

示例2: dispatch

import org.apache.hadoop.yarn.event.Event; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
protected void dispatch(Event event) {
  if (event.getType() == RMFatalEventType.TRANSITION_TO_ACTIVE_FAILED) {
    eventreceived++;
  } else {
    super.dispatch(event);
  }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:10,代码来源:TestRMHA.java

示例3: handle

import org.apache.hadoop.yarn.event.Event; //导入方法依赖的package包/类
@Override
public void handle(Event event) {
  if (event instanceof TaskAttemptEvent)
    if (event.getType() == TaskAttemptEventType.TA_RESCHEDULE) {
      TaskAttempt attempt = mockTask.getAttempt(((TaskAttemptEvent) event).getTaskAttemptID());
      ((MockTaskAttemptImpl)attempt).setRescheduled(true);
    }
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:9,代码来源:TestTaskImpl.java

示例4: dispatch

import org.apache.hadoop.yarn.event.Event; //导入方法依赖的package包/类
@Override
protected void dispatch(Event event) {
  if (event.getType() == eventType) {
    latch.countDown();
  }
  super.dispatch(event);
}
 
开发者ID:apache,项目名称:tajo,代码行数:8,代码来源:TestKillQuery.java

示例5: testAppRejectionWithCancelledDelegationToken

import org.apache.hadoop.yarn.event.Event; //导入方法依赖的package包/类
@Test(timeout=60000)
public void testAppRejectionWithCancelledDelegationToken() throws Exception {
  MyFS dfs = (MyFS)FileSystem.get(conf);
  LOG.info("dfs="+(Object)dfs.hashCode() + ";conf="+conf.hashCode());

  MyToken token = dfs.getDelegationToken(new Text("user1"));
  token.cancelToken();

  Credentials ts = new Credentials();
  ts.addToken(token.getKind(), token);
  
  // register the tokens for renewal
  ApplicationId appId =  BuilderUtils.newApplicationId(0, 0);
  delegationTokenRenewer.addApplicationAsync(appId, ts, true);
  int waitCnt = 20;
  while (waitCnt-- >0) {
    if (!eventQueue.isEmpty()) {
      Event evt = eventQueue.take();
      if (evt.getType() == RMAppEventType.APP_REJECTED) {
        Assert.assertTrue(
            ((RMAppEvent) evt).getApplicationId().equals(appId));
        return;
      }
    } else {
      Thread.sleep(500);
    }
  }
  fail("App submission with a cancelled token should have failed");
}
 
开发者ID:Seagate,项目名称:hadoop-on-lustre2,代码行数:30,代码来源:TestDelegationTokenRenewer.java

示例6: testNodeFailedAtIdle

import org.apache.hadoop.yarn.event.Event; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
@Test
public void testNodeFailedAtIdle() {
  WrappedContainer wc = new WrappedContainer();
  List<Event> outgoingEvents;

  wc.launchContainer();
  wc.containerLaunched();
  wc.assignTaskAttempt(wc.taskAttemptID);
  wc.verifyState(AMContainerState.IDLE);

  wc.nodeFailed();
  // Expecting a complete event from the RM
  wc.verifyState(AMContainerState.STOPPING);
  outgoingEvents = wc.verifyCountAndGetOutgoingEvents(3);
  verifyUnOrderedOutgoingEventTypes(outgoingEvents,
      TaskAttemptEventType.TA_NODE_FAILED,
      TaskAttemptEventType.TA_CONTAINER_TERMINATING,
      AMSchedulerEventType.S_CONTAINER_DEALLOCATE);

  for (Event event : outgoingEvents) {
    if (event.getType() == TaskAttemptEventType.TA_NODE_FAILED) {
      TaskAttemptEventNodeFailed nfEvent = (TaskAttemptEventNodeFailed) event;
      assertEquals("nodeFailed", nfEvent.getDiagnosticInfo());
    }
  }

  wc.containerCompleted(false);
  wc.verifyHistoryStopEvent();
  outgoingEvents = wc.verifyCountAndGetOutgoingEvents(1);
  verifyUnOrderedOutgoingEventTypes(outgoingEvents,
      TaskAttemptEventType.TA_CONTAINER_TERMINATED);

  assertFalse(wc.amContainer.isInErrorState());
}
 
开发者ID:apache,项目名称:incubator-tez,代码行数:36,代码来源:TestAMContainer.java

示例7: testLaunchFailure

import org.apache.hadoop.yarn.event.Event; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
@Test (timeout=5000)
public void testLaunchFailure() {
  WrappedContainer wc = new WrappedContainer();
  List<Event> outgoingEvents;

  wc.launchContainer();
  wc.assignTaskAttempt(wc.taskAttemptID);
  wc.verifyState(AMContainerState.LAUNCHING);
  verify(wc.tal).registerRunningContainer(wc.containerID, 0);
  wc.launchFailed();
  wc.verifyState(AMContainerState.STOPPING);
  verify(wc.tal).registerRunningContainer(wc.containerID, 0);
  verifyUnregisterRunningContainer(wc.tal, wc.containerID, 0, ContainerEndReason.LAUNCH_FAILED,
      "launchFailed");

  outgoingEvents = wc.verifyCountAndGetOutgoingEvents(3);
  verifyUnOrderedOutgoingEventTypes(outgoingEvents,
      TaskAttemptEventType.TA_CONTAINER_TERMINATING,
      AMSchedulerEventType.S_CONTAINER_DEALLOCATE,
      AMNodeEventType.N_CONTAINER_COMPLETED);
  for (Event e : outgoingEvents) {
    if (e.getType() == TaskAttemptEventType.TA_CONTAINER_TERMINATING) {
      Assert.assertEquals(TaskAttemptTerminationCause.CONTAINER_LAUNCH_FAILED,
          ((TaskAttemptEventContainerTerminating)e).getTerminationCause());
    }
  }

  wc.containerCompleted();
  outgoingEvents = wc.verifyCountAndGetOutgoingEvents(1);
  verifyUnOrderedOutgoingEventTypes(outgoingEvents,
      TaskAttemptEventType.TA_CONTAINER_TERMINATED);

  // Valid transition. Container complete, but not with an error.
  assertFalse(wc.amContainer.isInErrorState());
}
 
开发者ID:apache,项目名称:tez,代码行数:37,代码来源:TestAMContainer.java

示例8: testNodeFailedAtRunning

import org.apache.hadoop.yarn.event.Event; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
@Test (timeout=5000)
public void testNodeFailedAtRunning() {
  WrappedContainer wc = new WrappedContainer();
  List<Event> outgoingEvents;

  wc.launchContainer();
  wc.containerLaunched();
  wc.assignTaskAttempt(wc.taskAttemptID);
  wc.verifyState(AMContainerState.RUNNING);

  wc.nodeFailed();
  // Expecting a complete event from the RM
  wc.verifyState(AMContainerState.STOPPING);
  outgoingEvents = wc.verifyCountAndGetOutgoingEvents(4);
  verifyUnOrderedOutgoingEventTypes(outgoingEvents,
      TaskAttemptEventType.TA_NODE_FAILED,
      TaskAttemptEventType.TA_CONTAINER_TERMINATING,
      AMSchedulerEventType.S_CONTAINER_DEALLOCATE,
      AMNodeEventType.N_CONTAINER_COMPLETED);

  for (Event event : outgoingEvents) {
    if (event.getType() == TaskAttemptEventType.TA_NODE_FAILED) {
      TaskAttemptEventNodeFailed nfEvent = (TaskAttemptEventNodeFailed) event;
      assertTrue(nfEvent.getDiagnosticInfo().contains("nodeFailed"));
    }
  }

  wc.containerCompleted();
  wc.verifyHistoryStopEvent();
  outgoingEvents = wc.verifyCountAndGetOutgoingEvents(1);
  verifyUnOrderedOutgoingEventTypes(outgoingEvents,
      TaskAttemptEventType.TA_CONTAINER_TERMINATED);

  assertFalse(wc.amContainer.isInErrorState());
}
 
开发者ID:apache,项目名称:tez,代码行数:37,代码来源:TestAMContainer.java

示例9: findEventByType

import org.apache.hadoop.yarn.event.Event; //导入方法依赖的package包/类
private Event findEventByType(List<Event> events, Enum<?> type) {
  for (Event event : events) {
    if (event.getType() == type) {
      return event;
    }
  }
  return null;
}
 
开发者ID:apache,项目名称:tez,代码行数:9,代码来源:TestAMContainer.java

示例10: testKillJob

import org.apache.hadoop.yarn.event.Event; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
@Test(timeout=10000)
public void testKillJob() throws Exception {
  JobConf conf = new JobConf();
  AppContext context = mock(AppContext.class);
  // a simple event handler solely to detect the container cleaned event
  final CountDownLatch isDone = new CountDownLatch(1);
  EventHandler handler = new EventHandler() {
    @Override
    public void handle(Event event) {
      LOG.info("handling event " + event.getClass() +
          " with type " + event.getType());
      if (event instanceof TaskAttemptEvent) {
        if (event.getType() == TaskAttemptEventType.TA_CONTAINER_CLEANED) {
          isDone.countDown();
        }
      }
    }
  };
  when(context.getEventHandler()).thenReturn(handler);

  // create and start the launcher
  LocalContainerLauncher launcher =
      new LocalContainerLauncher(context, mock(TaskUmbilicalProtocol.class));
  launcher.init(conf);
  launcher.start();

  // create mocked job, task, and task attempt
  // a single-mapper job
  JobId jobId = MRBuilderUtils.newJobId(System.currentTimeMillis(), 1, 1);
  TaskId taskId = MRBuilderUtils.newTaskId(jobId, 1, TaskType.MAP);
  TaskAttemptId taId = MRBuilderUtils.newTaskAttemptId(taskId, 0);

  Job job = mock(Job.class);
  when(job.getTotalMaps()).thenReturn(1);
  when(job.getTotalReduces()).thenReturn(0);
  Map<JobId,Job> jobs = new HashMap<JobId,Job>();
  jobs.put(jobId, job);
  // app context returns the one and only job
  when(context.getAllJobs()).thenReturn(jobs);

  org.apache.hadoop.mapreduce.v2.app.job.Task ytask =
      mock(org.apache.hadoop.mapreduce.v2.app.job.Task.class);
  when(ytask.getType()).thenReturn(TaskType.MAP);
  when(job.getTask(taskId)).thenReturn(ytask);

  // create a sleeping mapper that runs beyond the test timeout
  MapTask mapTask = mock(MapTask.class);
  when(mapTask.isMapOrReduce()).thenReturn(true);
  when(mapTask.isMapTask()).thenReturn(true);
  TaskAttemptID taskID = TypeConverter.fromYarn(taId);
  when(mapTask.getTaskID()).thenReturn(taskID);
  when(mapTask.getJobID()).thenReturn(taskID.getJobID());
  doAnswer(new Answer<Void>() {
    @Override
    public Void answer(InvocationOnMock invocation) throws Throwable {
      // sleep for a long time
      LOG.info("sleeping for 5 minutes...");
      Thread.sleep(5*60*1000);
      return null;
    }
  }).when(mapTask).run(isA(JobConf.class), isA(TaskUmbilicalProtocol.class));

  // pump in a task attempt launch event
  ContainerLauncherEvent launchEvent =
      new ContainerRemoteLaunchEvent(taId, null, createMockContainer(), mapTask);
  launcher.handle(launchEvent);

  Thread.sleep(200);
  // now pump in a container clean-up event
  ContainerLauncherEvent cleanupEvent =
      new ContainerLauncherEvent(taId, null, null, null,
          ContainerLauncher.EventType.CONTAINER_REMOTE_CLEANUP);
  launcher.handle(cleanupEvent);

  // wait for the event to fire: this should be received promptly
  isDone.await();

  launcher.close();
}
 
开发者ID:naver,项目名称:hadoop,代码行数:81,代码来源:TestLocalContainerLauncher.java

示例11: testContainerCleaned

import org.apache.hadoop.yarn.event.Event; //导入方法依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test(timeout = 5000)
public void testContainerCleaned() throws Exception {
  LOG.info("STARTING testContainerCleaned");
  
  CyclicBarrier startLaunchBarrier = new CyclicBarrier(2);
  CyclicBarrier completeLaunchBarrier = new CyclicBarrier(2);

  AppContext mockContext = mock(AppContext.class);
  
  EventHandler mockEventHandler = mock(EventHandler.class);
  when(mockContext.getEventHandler()).thenReturn(mockEventHandler);

  ContainerManagementProtocolClient mockCM =
      new ContainerManagerForTest(startLaunchBarrier, completeLaunchBarrier);
  ContainerLauncherImplUnderTest ut =
      new ContainerLauncherImplUnderTest(mockContext, mockCM);
  
  Configuration conf = new Configuration();
  ut.init(conf);
  ut.start();
  try {
    ContainerId contId = makeContainerId(0l, 0, 0, 1);
    TaskAttemptId taskAttemptId = makeTaskAttemptId(0l, 0, 0, TaskType.MAP, 0);
    String cmAddress = "127.0.0.1:8000";
    StartContainersResponse startResp =
      recordFactory.newRecordInstance(StartContainersResponse.class);
    startResp.setAllServicesMetaData(serviceResponse);
    
   
    LOG.info("inserting launch event");
    ContainerRemoteLaunchEvent mockLaunchEvent = 
      mock(ContainerRemoteLaunchEvent.class);
    when(mockLaunchEvent.getType())
      .thenReturn(EventType.CONTAINER_REMOTE_LAUNCH);
    when(mockLaunchEvent.getContainerID())
      .thenReturn(contId);
    when(mockLaunchEvent.getTaskAttemptID()).thenReturn(taskAttemptId);
    when(mockLaunchEvent.getContainerMgrAddress()).thenReturn(cmAddress);
    when(mockLaunchEvent.getContainerToken()).thenReturn(
        createNewContainerToken(contId, cmAddress));
    ut.handle(mockLaunchEvent);
    
    startLaunchBarrier.await();
    
         
    LOG.info("inserting cleanup event");
    ContainerLauncherEvent mockCleanupEvent = 
      mock(ContainerLauncherEvent.class);
    when(mockCleanupEvent.getType())
      .thenReturn(EventType.CONTAINER_REMOTE_CLEANUP);
    when(mockCleanupEvent.getContainerID())
      .thenReturn(contId);
    when(mockCleanupEvent.getTaskAttemptID()).thenReturn(taskAttemptId);
    when(mockCleanupEvent.getContainerMgrAddress()).thenReturn(cmAddress);
    ut.handle(mockCleanupEvent);

    completeLaunchBarrier.await();
   
    ut.waitForPoolToIdle();
    
    ArgumentCaptor<Event> arg = ArgumentCaptor.forClass(Event.class);
    verify(mockEventHandler, atLeast(2)).handle(arg.capture());
    boolean containerCleaned = false;
    
    for (int i =0; i < arg.getAllValues().size(); i++) {
      LOG.info(arg.getAllValues().get(i).toString());
      Event currentEvent = arg.getAllValues().get(i);
      if (currentEvent.getType() == TaskAttemptEventType.TA_CONTAINER_CLEANED) {
        containerCleaned = true;
      }
    }
    assert(containerCleaned);
    
  } finally {
    ut.stop();
  }
}
 
开发者ID:naver,项目名称:hadoop,代码行数:79,代码来源:TestContainerLauncherImpl.java

示例12: testContainerCleaned

import org.apache.hadoop.yarn.event.Event; //导入方法依赖的package包/类
@SuppressWarnings({ "rawtypes", "unchecked" })
@Test(timeout = 5000)
public void testContainerCleaned() throws Exception {
  LOG.info("STARTING testContainerCleaned");
  
  CyclicBarrier startLaunchBarrier = new CyclicBarrier(2);
  CyclicBarrier completeLaunchBarrier = new CyclicBarrier(2);

  AppContext mockContext = mock(AppContext.class);
  
  EventHandler mockEventHandler = mock(EventHandler.class);
  when(mockContext.getEventHandler()).thenReturn(mockEventHandler);

  ContainerManagementProtocol mockCM =
      new ContainerManagerForTest(startLaunchBarrier, completeLaunchBarrier);
  ContainerLauncherImplUnderTest ut =
      new ContainerLauncherImplUnderTest(mockContext, mockCM);
  
  Configuration conf = new Configuration();
  ut.init(conf);
  ut.start();
  try {
    ContainerId contId = makeContainerId(0l, 0, 0, 1);
    TaskAttemptId taskAttemptId = makeTaskAttemptId(0l, 0, 0, TaskType.MAP, 0);
    String cmAddress = "127.0.0.1:8000";
    StartContainersResponse startResp =
      recordFactory.newRecordInstance(StartContainersResponse.class);
    startResp.setAllServicesMetaData(serviceResponse);
    
   
    LOG.info("inserting launch event");
    ContainerRemoteLaunchEvent mockLaunchEvent = 
      mock(ContainerRemoteLaunchEvent.class);
    when(mockLaunchEvent.getType())
      .thenReturn(EventType.CONTAINER_REMOTE_LAUNCH);
    when(mockLaunchEvent.getContainerID())
      .thenReturn(contId);
    when(mockLaunchEvent.getTaskAttemptID()).thenReturn(taskAttemptId);
    when(mockLaunchEvent.getContainerMgrAddress()).thenReturn(cmAddress);
    when(mockLaunchEvent.getContainerToken()).thenReturn(
        createNewContainerToken(contId, cmAddress));
    ut.handle(mockLaunchEvent);
    
    startLaunchBarrier.await();
    
         
    LOG.info("inserting cleanup event");
    ContainerLauncherEvent mockCleanupEvent = 
      mock(ContainerLauncherEvent.class);
    when(mockCleanupEvent.getType())
      .thenReturn(EventType.CONTAINER_REMOTE_CLEANUP);
    when(mockCleanupEvent.getContainerID())
      .thenReturn(contId);
    when(mockCleanupEvent.getTaskAttemptID()).thenReturn(taskAttemptId);
    when(mockCleanupEvent.getContainerMgrAddress()).thenReturn(cmAddress);
    ut.handle(mockCleanupEvent);

    completeLaunchBarrier.await();
   
    ut.waitForPoolToIdle();
    
    ArgumentCaptor<Event> arg = ArgumentCaptor.forClass(Event.class);
    verify(mockEventHandler, atLeast(2)).handle(arg.capture());
    boolean containerCleaned = false;
    
    for (int i =0; i < arg.getAllValues().size(); i++) {
      LOG.info(arg.getAllValues().get(i).toString());
      Event currentEvent = arg.getAllValues().get(i);
      if (currentEvent.getType() == TaskAttemptEventType.TA_CONTAINER_CLEANED) {
        containerCleaned = true;
      }
    }
    assert(containerCleaned);
    
  } finally {
    ut.stop();
  }
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:79,代码来源:TestContainerLauncherImpl.java

示例13: testNodeFailedAtIdleMultipleAttempts

import org.apache.hadoop.yarn.event.Event; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
@Test
public void testNodeFailedAtIdleMultipleAttempts() {
  WrappedContainer wc = new WrappedContainer();
  List<Event> outgoingEvents;

  wc.launchContainer();
  wc.containerLaunched();
  wc.assignTaskAttempt(wc.taskAttemptID);
  wc.pullTaskToRun();
  wc.taskAttemptSucceeded(wc.taskAttemptID);
  wc.verifyState(AMContainerState.IDLE);

  TezTaskAttemptID taID2 = TezTaskAttemptID.getInstance(wc.taskID, 2);
  wc.assignTaskAttempt(taID2);
  wc.pullTaskToRun();
  wc.taskAttemptSucceeded(taID2);
  wc.verifyState(AMContainerState.IDLE);

  wc.nodeFailed();
  // Expecting a complete event from the RM
  wc.verifyState(AMContainerState.STOPPING);
  outgoingEvents = wc.verifyCountAndGetOutgoingEvents(3);
  verifyUnOrderedOutgoingEventTypes(outgoingEvents,
      TaskAttemptEventType.TA_NODE_FAILED,
      TaskAttemptEventType.TA_NODE_FAILED,
      AMSchedulerEventType.S_CONTAINER_DEALLOCATE);

  for (Event event : outgoingEvents) {
    if (event.getType() == TaskAttemptEventType.TA_NODE_FAILED) {
      TaskAttemptEventNodeFailed nfEvent = (TaskAttemptEventNodeFailed) event;
      assertEquals("nodeFailed", nfEvent.getDiagnosticInfo());
    }
  }

  assertFalse(wc.amContainer.isInErrorState());

  wc.containerCompleted(false);
  wc.verifyNoOutgoingEvents();
  wc.verifyHistoryStopEvent();

  assertNull(wc.amContainer.getRunningTaskAttempt());
  assertEquals(0, wc.amContainer.getQueuedTaskAttempts().size());
  assertEquals(2, wc.amContainer.getAllTaskAttempts().size());
}
 
开发者ID:apache,项目名称:incubator-tez,代码行数:46,代码来源:TestAMContainer.java

示例14: testNodeFailedAtRunningMultipleAttempts

import org.apache.hadoop.yarn.event.Event; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
@Test
public void testNodeFailedAtRunningMultipleAttempts() {
  WrappedContainer wc = new WrappedContainer();
  List<Event> outgoingEvents;

  wc.launchContainer();
  wc.containerLaunched();
  wc.assignTaskAttempt(wc.taskAttemptID);
  wc.pullTaskToRun();
  wc.taskAttemptSucceeded(wc.taskAttemptID);

  TezTaskAttemptID taID2 = TezTaskAttemptID.getInstance(wc.taskID, 2);
  wc.assignTaskAttempt(taID2);
  wc.pullTaskToRun();
  wc.verifyState(AMContainerState.RUNNING);

  wc.nodeFailed();
  // Expecting a complete event from the RM
  wc.verifyState(AMContainerState.STOPPING);
  outgoingEvents = wc.verifyCountAndGetOutgoingEvents(4);
  verifyUnOrderedOutgoingEventTypes(outgoingEvents,
      TaskAttemptEventType.TA_NODE_FAILED,
      TaskAttemptEventType.TA_NODE_FAILED,
      TaskAttemptEventType.TA_CONTAINER_TERMINATING,
      AMSchedulerEventType.S_CONTAINER_DEALLOCATE);

  for (Event event : outgoingEvents) {
    if (event.getType() == TaskAttemptEventType.TA_NODE_FAILED) {
      TaskAttemptEventNodeFailed nfEvent = (TaskAttemptEventNodeFailed) event;
      assertEquals("nodeFailed", nfEvent.getDiagnosticInfo());
    }
  }

  wc.containerCompleted(false);
  wc.verifyHistoryStopEvent();
  outgoingEvents = wc.verifyCountAndGetOutgoingEvents(1);
  verifyUnOrderedOutgoingEventTypes(outgoingEvents,
      TaskAttemptEventType.TA_CONTAINER_TERMINATED);

  assertFalse(wc.amContainer.isInErrorState());
  assertNull(wc.amContainer.getRunningTaskAttempt());
  assertEquals(0, wc.amContainer.getQueuedTaskAttempts().size());
  assertEquals(2, wc.amContainer.getAllTaskAttempts().size());
}
 
开发者ID:apache,项目名称:incubator-tez,代码行数:46,代码来源:TestAMContainer.java

示例15: testNodeFailedAtIdleMultipleAttempts

import org.apache.hadoop.yarn.event.Event; //导入方法依赖的package包/类
@SuppressWarnings("rawtypes")
@Test (timeout=5000)
public void testNodeFailedAtIdleMultipleAttempts() {
  WrappedContainer wc = new WrappedContainer();
  List<Event> outgoingEvents;

  wc.launchContainer();
  wc.containerLaunched();
  wc.assignTaskAttempt(wc.taskAttemptID);
  wc.taskAttemptSucceeded(wc.taskAttemptID);
  wc.verifyState(AMContainerState.IDLE);

  TezTaskAttemptID taID2 = TezTaskAttemptID.getInstance(wc.taskID, 2);
  wc.assignTaskAttempt(taID2);
  wc.taskAttemptSucceeded(taID2);
  wc.verifyState(AMContainerState.IDLE);

  wc.nodeFailed();
  // Expecting a complete event from the RM
  wc.verifyState(AMContainerState.STOPPING);
  outgoingEvents = wc.verifyCountAndGetOutgoingEvents(4);
  verifyUnOrderedOutgoingEventTypes(outgoingEvents,
      TaskAttemptEventType.TA_NODE_FAILED,
      TaskAttemptEventType.TA_NODE_FAILED,
      AMSchedulerEventType.S_CONTAINER_DEALLOCATE,
      AMNodeEventType.N_CONTAINER_COMPLETED);

  for (Event event : outgoingEvents) {
    if (event.getType() == TaskAttemptEventType.TA_NODE_FAILED) {
      TaskAttemptEventNodeFailed nfEvent = (TaskAttemptEventNodeFailed) event;
      assertTrue(nfEvent.getDiagnosticInfo().contains("nodeFailed"));
    }
  }

  assertFalse(wc.amContainer.isInErrorState());

  wc.containerCompleted();
  wc.verifyNoOutgoingEvents();
  wc.verifyHistoryStopEvent();

  assertNull(wc.amContainer.getCurrentTaskAttempt());
  assertEquals(2, wc.amContainer.getAllTaskAttempts().size());
}
 
开发者ID:apache,项目名称:tez,代码行数:44,代码来源:TestAMContainer.java


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