@Override public String toString() { StringBuilder sb = new StringBuilder(super.toString()); sb.append(" ").append(getAppId()); sb.append(" ").append(getContainer().getContainerId()); return sb.toString(); }
@Override public void handle(SchedulerEvent event) { switch (event.getType()) { case NODE_LABELS_UPDATE: receivedEvent = true; updatedNodeToLabels = ((NodeLabelsUpdateSchedulerEvent) event).getUpdatedNodeToLabels(); break; default: break; } } }
@Override protected void expire(ContainerId containerId) { dispatcher.handle(new ContainerExpiredSchedulerEvent(containerId)); } }
@Override public Void answer(InvocationOnMock invocation) throws Throwable { final SchedulerEvent event = (SchedulerEvent)(invocation.getArguments()[0]); eventType = event.getType(); if (eventType == SchedulerEventType.NODE_UPDATE) { List<UpdatedContainerInfo> lastestContainersInfoList = ((NodeUpdateSchedulerEvent)event).getRMNode().pullContainerUpdates(); for(UpdatedContainerInfo lastestContainersInfo : lastestContainersInfoList) { completedContainers.addAll(lastestContainersInfo.getCompletedContainers()); } } return null; } }
private void verifyAppRemovedSchedulerEvent(RMAppState finalState) { Assert.assertEquals(SchedulerEventType.APP_REMOVED, schedulerDispatcher.lastSchedulerEvent.getType()); if(schedulerDispatcher.lastSchedulerEvent instanceof AppRemovedSchedulerEvent) { AppRemovedSchedulerEvent appRemovedEvent = (AppRemovedSchedulerEvent) schedulerDispatcher.lastSchedulerEvent; Assert.assertEquals(finalState, appRemovedEvent.getFinalState()); } } }
protected ApplicationAttemptId submitApp(CapacityScheduler newCS, String user, String queue, String parentQueue) { ApplicationId appId = BuilderUtils.newApplicationId(1, 1); SchedulerEvent addAppEvent = new AppAddedSchedulerEvent(appId, queue, user, new ApplicationPlacementContext(queue, parentQueue)); ApplicationAttemptId appAttemptId = BuilderUtils.newApplicationAttemptId( appId, 1); SchedulerEvent addAttemptEvent = new AppAttemptAddedSchedulerEvent( appAttemptId, false); newCS.handle(addAppEvent); newCS.handle(addAttemptEvent); return appAttemptId; }
@Override public void transition(RMAppImpl app, RMAppEvent event) { app.handler.handle( new AppAddedSchedulerEvent(app.user, app.submissionContext, false, app.applicationPriority, app.placementContext)); // send the ATS create Event app.sendATSCreateEvent(); } }
public NodeUpdateSchedulerEventWrapper(NodeUpdateSchedulerEvent event) { super(new RMNodeWrapper(event.getRMNode())); }
@Override public Void answer(InvocationOnMock invocation) throws Throwable { final SchedulerEvent event = (SchedulerEvent)(invocation.getArguments()[0]); eventType = event.getType(); if (eventType == SchedulerEventType.NODE_UPDATE) { //DO NOTHING } return null; } }
private void sendEnoughNodeUpdatesToAssignFully() { for (RMNode node : rmNodes) { NodeUpdateSchedulerEvent nodeUpdateSchedulerEvent = new NodeUpdateSchedulerEvent(node); for (int i = 0; i < NODE_CAPACITY_MULTIPLE; i++) { scheduler.handle(nodeUpdateSchedulerEvent); } } }
private void addAppAttempt(ApplicationAttemptId attId) { AppAttemptAddedSchedulerEvent attempAddedEvent = new AppAttemptAddedSchedulerEvent(attId, false); scheduler.handle(attempAddedEvent); }
@Override public boolean matches(Object o) { return appAttId.equals(((ContainerPreemptEvent)o).getAppId()) && type.equals(((ContainerPreemptEvent)o).getType()); } @Override
@Override public Void answer(InvocationOnMock invocation) throws Throwable { final SchedulerEvent event = (SchedulerEvent)(invocation.getArguments()[0]); eventType = event.getType(); if (eventType == SchedulerEventType.NODE_UPDATE) { List<UpdatedContainerInfo> lastestContainersInfoList = ((NodeUpdateSchedulerEvent)event).getRMNode().pullContainerUpdates(); for(UpdatedContainerInfo lastestContainersInfo : lastestContainersInfoList) { completedContainers.addAll(lastestContainersInfo.getCompletedContainers()); } } return null; } }
private void verifyAppRemovedSchedulerEvent(RMAppState finalState) { Assert.assertEquals(SchedulerEventType.APP_REMOVED, schedulerDispatcher.lastSchedulerEvent.getType()); if(schedulerDispatcher.lastSchedulerEvent instanceof AppRemovedSchedulerEvent) { AppRemovedSchedulerEvent appRemovedEvent = (AppRemovedSchedulerEvent) schedulerDispatcher.lastSchedulerEvent; Assert.assertEquals(finalState, appRemovedEvent.getFinalState()); } }
@Override public void transition(RMAppImpl app, RMAppEvent event) { app.handler.handle(new AppAddedSchedulerEvent(app.applicationId, app.submissionContext.getQueue(), app.user, app.submissionContext.getReservationID())); } }
private void sendEnoughNodeUpdatesToAssignFully() { for (RMNode node : rmNodes) { NodeUpdateSchedulerEvent nodeUpdateSchedulerEvent = new NodeUpdateSchedulerEvent(node); for (int i = 0; i < NODE_CAPACITY_MULTIPLE; i++) { scheduler.handle(nodeUpdateSchedulerEvent); } } } }
@Override protected void expire(ContainerId containerId) { dispatcher.handle(new ContainerExpiredSchedulerEvent(containerId)); } }
@Override public void transition(RMAppImpl app, RMAppEvent event) { app.handler.handle(new AppAddedSchedulerEvent(app.applicationId, app.submissionContext.getQueue(), app.user, app.submissionContext.getReservationID())); } }
@Override protected void expire(AllocationExpirationInfo allocationExpirationInfo) { dispatcher.handle(new ContainerExpiredSchedulerEvent( allocationExpirationInfo.getContainerId(), allocationExpirationInfo.isIncrease())); } }