Tabnine Logo
RMNodeCleanAppEvent
Code IndexAdd Tabnine to your IDE (free)

How to use
RMNodeCleanAppEvent
in
org.apache.hadoop.yarn.server.resourcemanager.rmnode

Best Java code snippets using org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeCleanAppEvent (Showing top 12 results out of 315)

origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager

 @Override
 public void transition(RMNodeImpl rmNode, RMNodeEvent event) {
  rmNode.finishedApplications.add(((
    RMNodeCleanAppEvent) event).getAppId());
 }
}
origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

 public void transition(RMAppImpl app, RMAppEvent event) {
  RMAppRunningOnNodeEvent nodeAddedEvent = (RMAppRunningOnNodeEvent) event;
  
  // if final state already stored, notify RMNode
  if (isAppInFinalState(app)) {
   app.handler.handle(
     new RMNodeCleanAppEvent(nodeAddedEvent.getNodeId(), nodeAddedEvent
       .getApplicationId()));
   return;
  }
  
  // otherwise, add it to ranNodes for further process
  app.ranNodes.add(nodeAddedEvent.getNodeId());
 };
}
origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager

 public void transition(RMAppImpl app, RMAppEvent event) {
  RMAppRunningOnNodeEvent nodeAddedEvent = (RMAppRunningOnNodeEvent) event;
  
  // if final state already stored, notify RMNode
  if (isAppInFinalState(app)) {
   app.handler.handle(
     new RMNodeCleanAppEvent(nodeAddedEvent.getNodeId(), nodeAddedEvent
       .getApplicationId()));
   return;
  }
  
  // otherwise, add it to ranNodes for further process
  app.ranNodes.add(nodeAddedEvent.getNodeId());
 };
}
origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

 public void transition(RMAppImpl app, RMAppEvent event) {
  RMAppRunningOnNodeEvent nodeAddedEvent = (RMAppRunningOnNodeEvent) event;
  
  // if final state already stored, notify RMNode
  if (isAppInFinalState(app)) {
   app.handler.handle(
     new RMNodeCleanAppEvent(nodeAddedEvent.getNodeId(), nodeAddedEvent
       .getApplicationId()));
   return;
  }
  
  // otherwise, add it to ranNodes for further process
  app.ranNodes.add(nodeAddedEvent.getNodeId());
  if (!app.logAggregationStatus.containsKey(nodeAddedEvent.getNodeId())) {
   app.logAggregationStatus.put(nodeAddedEvent.getNodeId(),
    LogAggregationReport.newInstance(app.applicationId,
     app.logAggregationEnabled ? LogAggregationStatus.NOT_START
       : LogAggregationStatus.DISABLED, ""));
  }
 };
}
origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

 @Override
 public void transition(RMNodeImpl rmNode, RMNodeEvent event) {
  rmNode.finishedApplications.add(((
    RMNodeCleanAppEvent) event).getAppId());
 }
}
origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

@Test(timeout=20000)
public void testUpdateHeartbeatResponseForAppLifeCycle() {
 RMNodeImpl node = getRunningNode();
 NodeId nodeId = node.getNodeID();
 ApplicationId runningAppId = BuilderUtils.newApplicationId(0, 1);
 rmContext.getRMApps().put(runningAppId, Mockito.mock(RMApp.class));
 // Create a running container
 ContainerId runningContainerId = BuilderUtils.newContainerId(
   BuilderUtils.newApplicationAttemptId(
   runningAppId, 0), 0);
 ContainerStatus status = ContainerStatus.newInstance(runningContainerId,
   ContainerState.RUNNING, "", 0);
 List<ContainerStatus> statusList = new ArrayList<ContainerStatus>();
 statusList.add(status);
 NodeHealthStatus nodeHealth = NodeHealthStatus.newInstance(true,
   "", System.currentTimeMillis());
 NodeStatus nodeStatus = NodeStatus.newInstance(nodeId, 0, statusList, null,
   nodeHealth, null, null, null);
 node.handle(new RMNodeStatusEvent(nodeId, nodeStatus, null));
 Assert.assertEquals(1, node.getRunningApps().size());
 // Finish an application
 ApplicationId finishedAppId = runningAppId;
 node.handle(new RMNodeCleanAppEvent(nodeId, finishedAppId));
 Assert.assertEquals(1, node.getAppsToCleanup().size());
 Assert.assertEquals(0, node.getRunningApps().size());
}
origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

 @Override
 public void transition(RMNodeImpl rmNode, RMNodeEvent event) {
  ApplicationId appId = ((RMNodeCleanAppEvent) event).getAppId();
  rmNode.finishedApplications.add(appId);
  rmNode.runningApplications.remove(appId);
 }
}
origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

 public void transition(RMAppImpl app, RMAppEvent event) {
  for (NodeId nodeId : app.getRanNodes()) {
   app.handler.handle(
     new RMNodeCleanAppEvent(nodeId, app.applicationId));
  }
  app.finishTime = app.storedFinishTime;
  if (app.finishTime == 0 ) {
   app.finishTime = app.systemClock.getTime();
  }
  // Recovered apps that are completed were not added to scheduler, so no
  // need to remove them from scheduler.
  if (app.recoveredFinalState == null) {
   app.handler.handle(new AppRemovedSchedulerEvent(app.applicationId,
    finalState));
  }
  app.handler.handle(
    new RMAppManagerEvent(app.applicationId,
    RMAppManagerEventType.APP_COMPLETED));
  app.rmContext.getRMApplicationHistoryWriter()
    .applicationFinished(app, finalState);
  app.rmContext.getSystemMetricsPublisher()
    .appFinished(app, finalState, app.finishTime);
 };
}
origin: com.github.jiayuhan-it/hadoop-yarn-server-resourcemanager

 public void transition(RMAppImpl app, RMAppEvent event) {
  for (NodeId nodeId : app.getRanNodes()) {
   app.handler.handle(
     new RMNodeCleanAppEvent(nodeId, app.applicationId));
  }
  app.finishTime = app.storedFinishTime;
  if (app.finishTime == 0 ) {
   app.finishTime = app.systemClock.getTime();
  }
  // Recovered apps that are completed were not added to scheduler, so no
  // need to remove them from scheduler.
  if (app.recoveredFinalState == null) {
   app.handler.handle(new AppRemovedSchedulerEvent(app.applicationId,
    finalState));
  }
  app.handler.handle(
    new RMAppManagerEvent(app.applicationId,
    RMAppManagerEventType.APP_COMPLETED));
  app.rmContext.getRMApplicationHistoryWriter()
    .applicationFinished(app, finalState);
  app.rmContext.getSystemMetricsPublisher()
    .appFinished(app, finalState, app.finishTime);
 };
}
origin: ch.cern.hadoop/hadoop-yarn-server-resourcemanager

@Test(timeout=20000)
public void testUpdateHeartbeatResponseForCleanup() {
 RMNodeImpl node = getRunningNode();
 NodeId nodeId = node.getNodeID();
 // Expire a container
   ContainerId completedContainerId = BuilderUtils.newContainerId(
       BuilderUtils.newApplicationAttemptId(
           BuilderUtils.newApplicationId(0, 0), 0), 0);
 node.handle(new RMNodeCleanContainerEvent(nodeId, completedContainerId));
 Assert.assertEquals(1, node.getContainersToCleanUp().size());
 // Finish an application
 ApplicationId finishedAppId = BuilderUtils.newApplicationId(0, 1);
 node.handle(new RMNodeCleanAppEvent(nodeId, finishedAppId));
 Assert.assertEquals(1, node.getAppsToCleanup().size());
 // Verify status update does not clear containers/apps to cleanup
 // but updating heartbeat response for cleanup does
 RMNodeStatusEvent statusEvent = getMockRMNodeStatusEvent();
 node.handle(statusEvent);
 Assert.assertEquals(1, node.getContainersToCleanUp().size());
 Assert.assertEquals(1, node.getAppsToCleanup().size());
 NodeHeartbeatResponse hbrsp = Records.newRecord(NodeHeartbeatResponse.class);
 node.updateNodeHeartbeatResponseForCleanup(hbrsp);
 Assert.assertEquals(0, node.getContainersToCleanUp().size());
 Assert.assertEquals(0, node.getAppsToCleanup().size());
 Assert.assertEquals(1, hbrsp.getContainersToCleanup().size());
 Assert.assertEquals(completedContainerId, hbrsp.getContainersToCleanup().get(0));
 Assert.assertEquals(1, hbrsp.getApplicationsToCleanup().size());
 Assert.assertEquals(finishedAppId, hbrsp.getApplicationsToCleanup().get(0));
}
origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

 public void transition(RMAppImpl app, RMAppEvent event) {
  app.logAggregationStartTime = app.systemClock.getTime();
  for (NodeId nodeId : app.getRanNodes()) {
   app.handler.handle(
     new RMNodeCleanAppEvent(nodeId, app.applicationId));
  }
  app.finishTime = app.storedFinishTime;
  if (app.finishTime == 0 ) {
   app.finishTime = app.systemClock.getTime();
  }
  // Recovered apps that are completed were not added to scheduler, so no
  // need to remove them from scheduler.
  if (app.recoveredFinalState == null) {
   app.handler.handle(new AppRemovedSchedulerEvent(app.applicationId,
    finalState));
  }
  app.handler.handle(
    new RMAppManagerEvent(app.applicationId,
    RMAppManagerEventType.APP_COMPLETED));
  app.rmContext.getRMApplicationHistoryWriter()
    .applicationFinished(app, finalState);
  app.rmContext.getSystemMetricsPublisher()
    .appFinished(app, finalState, app.finishTime);
  // set the memory free
  app.clearUnusedFields();
  appAdminClientCleanUp(app);
 };
}
origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

@Test(timeout=20000)
public void testUpdateHeartbeatResponseForCleanup() {
 RMNodeImpl node = getRunningNode();
 NodeId nodeId = node.getNodeID();
 // Expire a container
 ContainerId completedContainerId = BuilderUtils.newContainerId(
   BuilderUtils.newApplicationAttemptId(
     BuilderUtils.newApplicationId(0, 0), 0), 0);
 node.handle(new RMNodeCleanContainerEvent(nodeId, completedContainerId));
 Assert.assertEquals(1, node.getContainersToCleanUp().size());
 // Finish an application
 ApplicationId finishedAppId = BuilderUtils.newApplicationId(0, 1);
 node.handle(new RMNodeCleanAppEvent(nodeId, finishedAppId));
 Assert.assertEquals(1, node.getAppsToCleanup().size());
 // Verify status update does not clear containers/apps to cleanup
 // but updating heartbeat response for cleanup does
 RMNodeStatusEvent statusEvent = getMockRMNodeStatusEvent(null);
 node.handle(statusEvent);
 Assert.assertEquals(1, node.getContainersToCleanUp().size());
 Assert.assertEquals(1, node.getAppsToCleanup().size());
 NodeHeartbeatResponse hbrsp = Records.newRecord(NodeHeartbeatResponse.class);
 node.setAndUpdateNodeHeartbeatResponse(hbrsp);
 Assert.assertEquals(0, node.getContainersToCleanUp().size());
 Assert.assertEquals(0, node.getAppsToCleanup().size());
 Assert.assertEquals(1, hbrsp.getContainersToCleanup().size());
 Assert.assertEquals(completedContainerId, hbrsp.getContainersToCleanup().get(0));
 Assert.assertEquals(1, hbrsp.getApplicationsToCleanup().size());
 Assert.assertEquals(finishedAppId, hbrsp.getApplicationsToCleanup().get(0));
}
org.apache.hadoop.yarn.server.resourcemanager.rmnodeRMNodeCleanAppEvent

Most used methods

  • <init>
  • getAppId

Popular in Java

  • Running tasks concurrently on multiple threads
  • setContentView (Activity)
  • getResourceAsStream (ClassLoader)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • Hashtable (java.util)
    A plug-in replacement for JDK1.5 java.util.Hashtable. This version is based on org.cliffc.high_scale
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now