hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vino...@apache.org
Subject svn commit: r1153430 [8/9] - in /hadoop/common/branches/MR-279/mapreduce: mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/ mr-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/loc...
Date Wed, 03 Aug 2011 11:32:10 GMT
Modified: hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmController.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmController.java?rev=1153430&r1=1153429&r2=1153430&view=diff
==============================================================================
--- hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmController.java (original)
+++ hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/RmController.java Wed Aug  3 11:31:34 2011
@@ -26,9 +26,9 @@ import org.apache.hadoop.util.StringUtil
 import org.apache.hadoop.util.VersionInfo;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.Container;
+import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
 import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
-import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager.RMContext;
-import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.Application;
+import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler;
 import org.apache.hadoop.yarn.util.Apps;
@@ -73,7 +73,7 @@ public class RmController extends Contro
     }
     ApplicationId appID = Apps.toAppID(aid);
     RMContext context = getInstance(RMContext.class);
-    Application app = context.getApplications().get(appID);
+    RMApp app = context.getRMApps().get(appID);
     if (app == null) {
       // TODO: handle redirect to jobhistory server
       setStatus(response().SC_NOT_FOUND);
@@ -81,21 +81,22 @@ public class RmController extends Contro
       return;
     }
     setTitle(join("Application ", aid));
-    String trackingUrl = app.getMaster().getTrackingUrl();
+    String trackingUrl = app.getTrackingUrl();
     String ui = trackingUrl == null ? "UNASSIGNED" :
         (app.getFinishTime() == 0 ? "ApplicationMaster" : "JobHistory");
 
     ResponseInfo info = info("Application Overview").
       _("User:", app.getUser()).
       _("Name:", app.getName()).
-      _("State:", app.getMaster().getState()).
+      _("State:", app.getState()).
       _("Started:", Times.format(app.getStartTime())).
       _("Elapsed:", StringUtils.formatTime(
         Times.elapsed(app.getStartTime(), app.getFinishTime()))).
       _("Tracking URL:", trackingUrl == null ? "#" :
         join("http://", trackingUrl), ui).
-      _("Diagnostics:", app.getMaster().getDiagnostics());
-    Container masterContainer = app.getMasterContainer();
+      _("Diagnostics:", app.getDiagnostics());
+    Container masterContainer = app.getCurrentAppAttempt()
+        .getMasterContainer();
     if (masterContainer != null) {
       String url = join("http://", masterContainer.getNodeHttpAddress(),
           "/yarn", "/containerlogs/",

Modified: hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/Application.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/Application.java?rev=1153430&r1=1153429&r2=1153430&view=diff
==============================================================================
--- hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/Application.java (original)
+++ hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/Application.java Wed Aug  3 11:31:34 2011
@@ -79,7 +79,7 @@ public class Application {
   
   final private Set<ResourceRequest> ask = 
     new TreeSet<ResourceRequest>(
-        new org.apache.hadoop.yarn.server.resourcemanager.resource.ResourceRequest.Comparator());
+        new org.apache.hadoop.yarn.util.BuilderUtils.ResourceRequestComparator());
   final private Set<Container> release = 
     new TreeSet<Container>(
         new org.apache.hadoop.yarn.util.BuilderUtils.ContainerComparator());
@@ -197,7 +197,7 @@ public class Application {
       
     // Off-switch
     addResourceRequest(priority, requests, 
-        org.apache.hadoop.yarn.server.resourcemanager.scheduler.NodeManager.ANY, 
+        org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode.ANY, 
         capability);
   }
   
@@ -230,7 +230,7 @@ public class Application {
     ResourceRequest request = requests.get(resourceName);
     if (request == null) {
       request = 
-        org.apache.hadoop.yarn.server.resourcemanager.resource.ResourceRequest.create(
+        org.apache.hadoop.yarn.util.BuilderUtils.create(
             priority, resourceName, capability, 1);
       requests.put(resourceName, request);
     } else {
@@ -240,7 +240,7 @@ public class Application {
     // Note this down for next interaction with ResourceManager
     ask.remove(request);
     ask.add(
-        org.apache.hadoop.yarn.server.resourcemanager.resource.ResourceRequest.create(
+        org.apache.hadoop.yarn.util.BuilderUtils.create(
             request)); // clone to ensure the RM doesn't manipulate the same obj
     
     LOG.info("DEBUG --- addResourceRequest:" +
@@ -386,7 +386,7 @@ public class Application {
     
     updateResourceRequest(
         requests.get(
-            org.apache.hadoop.yarn.server.resourcemanager.scheduler.NodeManager.ANY)
+            org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode.ANY)
             );
     
     LOG.info("DEBUG --- updateResourceRequests:" +
@@ -400,7 +400,7 @@ public class Application {
     // Note this for next interaction with ResourceManager
     ask.remove(request);
     ask.add(
-        org.apache.hadoop.yarn.server.resourcemanager.resource.ResourceRequest.create(
+        org.apache.hadoop.yarn.util.BuilderUtils.create(
         request)); // clone to ensure the RM doesn't manipulate the same obj
 
     LOG.info("DEBUG --- updateResourceRequest:" +

Modified: hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockNodes.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockNodes.java?rev=1153430&r1=1153429&r2=1153430&view=diff
==============================================================================
--- hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockNodes.java (original)
+++ hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockNodes.java Wed Aug  3 11:31:34 2011
@@ -18,21 +18,23 @@
 
 package org.apache.hadoop.yarn.server.resourcemanager;
 
-import com.google.common.collect.Lists;
-
 import java.util.List;
+import java.util.Map;
 
 import org.apache.hadoop.net.Node;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.Container;
+import org.apache.hadoop.yarn.api.records.NodeHealthStatus;
 import org.apache.hadoop.yarn.api.records.NodeId;
 import org.apache.hadoop.yarn.api.records.Priority;
 import org.apache.hadoop.yarn.api.records.Resource;
 import org.apache.hadoop.yarn.factories.RecordFactory;
 import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
-import org.apache.hadoop.yarn.server.api.records.NodeHealthStatus;
-import org.apache.hadoop.yarn.server.resourcemanager.resourcetracker.NodeInfo;
-import org.apache.hadoop.yarn.server.resourcemanager.scheduler.Application;
+import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode;
+import org.apache.hadoop.yarn.server.resourcemanager.scheduler.AppSchedulingInfo;
+import org.apache.hadoop.yarn.server.resourcemanager.scheduler.NodeResponse;
+
+import com.google.common.collect.Lists;
 
 /**
  * Test helper to generate mock nodes
@@ -41,9 +43,9 @@ public class MockNodes {
   private static int NODE_ID = 0;
   private static RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
 
-  public static List<NodeInfo> newNodes(int racks, int nodesPerRack,
+  public static List<RMNode> newNodes(int racks, int nodesPerRack,
                                         Resource perNode) {
-    List<NodeInfo> list = Lists.newArrayList();
+    List<RMNode> list = Lists.newArrayList();
     for (int i = 0; i < racks; ++i) {
       for (int j = 0; j < nodesPerRack; ++j) {
         list.add(newNodeInfo(i, perNode));
@@ -76,7 +78,7 @@ public class MockNodes {
     return rs;
   }
 
-  public static NodeInfo newNodeInfo(int rack, final Resource perNode) {
+  public static RMNode newNodeInfo(int rack, final Resource perNode) {
     final String rackName = "rack"+ rack;
     final int nid = NODE_ID++;
     final NodeId nodeID = newNodeID(nid);
@@ -87,7 +89,7 @@ public class MockNodes {
     final Resource used = newUsedResource(perNode);
     final Resource avail = newAvailResource(perNode, used);
     final int containers = (int)(Math.random() * 8);
-    return new NodeInfo() {
+    return new RMNode() {
       @Override
       public NodeId getNodeID() {
         return nodeID;
@@ -144,7 +146,7 @@ public class MockNodes {
       }
 
       @Override
-      public Application getReservedApplication() {
+      public AppSchedulingInfo getReservedApplication() {
         return null;
       }
 
@@ -154,12 +156,12 @@ public class MockNodes {
       }
 
       @Override
-      public void reserveResource(Application application, Priority priority,
+      public void reserveResource(AppSchedulingInfo application, Priority priority,
           Resource resource) {
       }
 
       @Override
-      public void unreserveResource(Application application, Priority priority) {
+      public void unreserveResource(AppSchedulingInfo application, Priority priority) {
       }
 
       @Override
@@ -183,6 +185,31 @@ public class MockNodes {
       public String getNodeHostName() {
         return hostName;
       }
+
+      @Override
+      public boolean releaseContainer(Container container) {
+        // TODO Auto-generated method stub
+        return false;
+      }
+
+      @Override
+      public void updateHealthStatus(NodeHealthStatus healthStatus) {
+        // TODO Auto-generated method stub
+        
+      }
+
+      @Override
+      public NodeResponse
+          statusUpdate(Map<String, List<Container>> containers) {
+        // TODO Auto-generated method stub
+        return null;
+      }
+
+      @Override
+      public void finishedApplication(ApplicationId applicationId) {
+        // TODO Auto-generated method stub
+        
+      }
     };
   }
 }

Added: hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockRM.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockRM.java?rev=1153430&view=auto
==============================================================================
--- hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockRM.java (added)
+++ hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/MockRM.java Wed Aug  3 11:31:34 2011
@@ -0,0 +1,303 @@
+package org.apache.hadoop.yarn.server.resourcemanager;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import junit.framework.Assert;
+
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.yarn.api.ClientRMProtocol;
+import org.apache.hadoop.yarn.api.protocolrecords.AllocateRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.AllocateResponse;
+import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationIdRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationIdResponse;
+import org.apache.hadoop.yarn.api.protocolrecords.RegisterApplicationMasterRequest;
+import org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationRequest;
+import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
+import org.apache.hadoop.yarn.api.records.ApplicationId;
+import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
+import org.apache.hadoop.yarn.api.records.Container;
+import org.apache.hadoop.yarn.api.records.ContainerId;
+import org.apache.hadoop.yarn.api.records.NodeHealthStatus;
+import org.apache.hadoop.yarn.api.records.NodeId;
+import org.apache.hadoop.yarn.api.records.Priority;
+import org.apache.hadoop.yarn.api.records.Resource;
+import org.apache.hadoop.yarn.api.records.ResourceRequest;
+import org.apache.hadoop.yarn.factories.RecordFactory;
+import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
+import org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatRequest;
+import org.apache.hadoop.yarn.server.api.protocolrecords.RegisterNodeManagerRequest;
+import org.apache.hadoop.yarn.server.api.records.NodeStatus;
+import org.apache.hadoop.yarn.server.resourcemanager.amlauncher.AMLauncherEvent;
+import org.apache.hadoop.yarn.server.resourcemanager.amlauncher.ApplicationMasterLauncher;
+import org.apache.hadoop.yarn.server.resourcemanager.ams.ApplicationMasterService;
+import org.apache.hadoop.yarn.server.resourcemanager.recovery.StoreFactory;
+import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
+import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppState;
+import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttempt;
+import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptEvent;
+import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptEventType;
+import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptState;
+import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.event.RMAppAttemptLaunchFailedEvent;
+import org.apache.log4j.Level;
+import org.apache.log4j.LogManager;
+import org.apache.log4j.Logger;
+
+
+public class MockRM extends ResourceManager {
+
+  private RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
+
+  public MockRM() {
+    this(new Configuration());
+  }
+
+  public MockRM(Configuration conf) {
+    super(StoreFactory.getStore(conf));
+    init(conf);
+    Logger rootLogger = LogManager.getRootLogger();
+    rootLogger.setLevel(Level.DEBUG);
+  }
+
+  public void waitForState(ApplicationId appId, RMAppState finalState) 
+      throws Exception {
+    RMApp app = getRMContext().getRMApps().get(appId);
+    int timeoutSecs = 0;
+    while (!finalState.equals(app.getState()) &&
+        timeoutSecs++ < 20) {
+      System.out.println("App State is : " + app.getState() +
+          " Waiting for state : " + finalState);
+      Thread.sleep(500);
+    }
+    System.out.println("App State is : " + app.getState());
+    Assert.assertEquals("App state is not correct (timedout)",
+        finalState, app.getState());
+  }
+
+  public void waitForState(ApplicationAttemptId attemptId, RMAppAttemptState finalState)
+      throws Exception {
+    RMApp app = getRMContext().getRMApps().get(attemptId.getApplicationId());
+    RMAppAttempt attempt = app.getRMAppAttempt(attemptId);
+    int timeoutSecs = 0;
+    while (!finalState.equals(attempt.getAppAttemptState())
+        && timeoutSecs++ < 20) {
+      System.out
+          .println("AppAttempt State is : " + attempt.getAppAttemptState()
+              + " Waiting for state : " + finalState);
+      Thread.sleep(500);
+    }
+    System.out.println("AppAttempt State is : " + attempt.getAppAttemptState());
+    Assert.assertEquals("AppAttempt state is not correct (timedout)",
+        finalState, attempt.getAppAttemptState());
+  }
+
+  //client
+  public RMApp submitApp(int masterMemory) throws Exception {
+    ClientRMProtocol client = getClientRMService();
+    GetNewApplicationIdResponse resp = client.getNewApplicationId(recordFactory.newRecordInstance(GetNewApplicationIdRequest.class));
+    ApplicationId appId = resp.getApplicationId();
+    
+    SubmitApplicationRequest req = recordFactory.newRecordInstance(SubmitApplicationRequest.class);
+    ApplicationSubmissionContext sub = recordFactory.newRecordInstance(ApplicationSubmissionContext.class);
+    sub.setApplicationId(appId);
+    sub.setApplicationName("");
+    sub.setUser("");
+    Resource capability = recordFactory.newRecordInstance(Resource.class);
+    capability.setMemory(masterMemory);
+    sub.setMasterCapability(capability);
+    req.setApplicationSubmissionContext(sub);
+    
+    client.submitApplication(req);
+    waitForState(appId, RMAppState.ACCEPTED);
+    return getRMContext().getRMApps().get(appId);
+  }
+
+  public void killApp(ApplicationId appId) throws Exception {
+    ClientRMProtocol client = getClientRMService();
+    FinishApplicationRequest req = recordFactory.newRecordInstance(FinishApplicationRequest.class);
+    req.setApplicationId(appId);
+    client.finishApplication(req);
+  }
+
+  //from AMLauncher
+  public void sendAMLaunched(ApplicationAttemptId appAttemptId) throws Exception {
+    waitForState(appAttemptId, RMAppAttemptState.ALLOCATED);
+    getRMContext().getDispatcher().getEventHandler().handle(
+        new RMAppAttemptEvent(appAttemptId, RMAppAttemptEventType.LAUNCHED));
+  }
+
+  public void sendAMLaunchFailed(ApplicationAttemptId appAttemptId) throws Exception {
+    waitForState(appAttemptId, RMAppAttemptState.ALLOCATED);
+    getRMContext().getDispatcher().getEventHandler().handle(
+        new RMAppAttemptLaunchFailedEvent(appAttemptId, "Failed"));
+  }
+
+  //from AMS
+  public void registerAppAttempt(ApplicationAttemptId attemptId) throws Exception {
+    waitForState(attemptId, RMAppAttemptState.LAUNCHED);
+    RegisterApplicationMasterRequest req = recordFactory.newRecordInstance(RegisterApplicationMasterRequest.class);
+    req.setApplicationAttemptId(attemptId);
+    req.setHost("");
+    req.setRpcPort(1);
+    req.setTrackingUrl("");
+    masterService.registerApplicationMaster(req);
+  }
+
+  public List<Container> allocateFromAM(ApplicationAttemptId attemptId, 
+      String host, int memory, int numContainers, 
+      List<ContainerId> releases) throws Exception {
+    ResourceRequest req = recordFactory.newRecordInstance(ResourceRequest.class);
+    req.setHostName(host);
+    req.setNumContainers(numContainers);
+    Priority pri = recordFactory.newRecordInstance(Priority.class);
+    pri.setPriority(1);
+    req.setPriority(pri);
+    Resource capability = recordFactory.newRecordInstance(Resource.class);
+    capability.setMemory(memory);
+    req.setCapability(capability);
+    List<Container> toRelease = new ArrayList<Container>();
+    for (ContainerId id : releases) {
+      Container cont = recordFactory.newRecordInstance(Container.class);
+      cont.setId(id);
+      cont.setContainerManagerAddress("");
+      //TOOD: set all fields
+    }
+    return allocateFromAM(attemptId, toRelease, 
+        Arrays.asList(new ResourceRequest[] {req}));
+  }
+
+  public List<Container> allocateFromAM(ApplicationAttemptId attemptId, 
+      List<Container> releases, List<ResourceRequest> resourceRequest) 
+      throws Exception {
+    AllocateRequest req = recordFactory.newRecordInstance(AllocateRequest.class);
+    req.setApplicationAttemptId(attemptId);
+    req.addAllAsks(resourceRequest);
+    req.addAllReleases(releases);
+    AllocateResponse resp = masterService.allocate(req);
+    return resp.getAMResponse().getContainerList();
+  }
+
+  public void unregisterAppAttempt(ApplicationAttemptId attemptId) throws Exception {
+    waitForState(attemptId, RMAppAttemptState.RUNNING);
+    FinishApplicationMasterRequest req = recordFactory.newRecordInstance(FinishApplicationMasterRequest.class);
+    req.setAppAttemptId(attemptId);
+    req.setDiagnostics("");
+    req.setFinalState("");
+    req.setTrackingUrl("");
+    masterService.finishApplicationMaster(req);
+  }
+
+  //from Node
+  public void containerStatus(Container container, int nodeIntId) throws Exception {
+    Map<ApplicationId, List<Container>> conts = new HashMap<ApplicationId, List<Container>>();
+    conts.put(container.getId().getAppId(), Arrays.asList(new Container[]{}));
+    nodeHeartbeat(nodeIntId, conts, true);
+  }
+
+  public void registerNode(int nodeIntId, String host, int memory) throws Exception {
+    NodeId nodeId = recordFactory.newRecordInstance(NodeId.class);
+    nodeId.setId(nodeIntId);
+    RegisterNodeManagerRequest req = recordFactory.newRecordInstance(RegisterNodeManagerRequest.class);
+    req.setContainerManagerPort(1);
+    req.setHost(host);
+    req.setHttpPort(2);
+    Resource resource = recordFactory.newRecordInstance(Resource.class);
+    resource.setMemory(memory);
+    req.setResource(resource);
+    getResourceTrackerService().registerNodeManager(req);
+  }
+
+  public void nodeHeartbeat(int i, boolean b) throws Exception {
+    nodeHeartbeat(i, new HashMap<ApplicationId, List<Container>>(), b);
+  }
+
+  public void nodeHeartbeat(int nodeIntId, Map<ApplicationId, 
+      List<Container>> conts, boolean isHealthy) throws Exception {
+    NodeId nodeId = recordFactory.newRecordInstance(NodeId.class);
+    nodeId.setId(nodeIntId);
+    NodeHeartbeatRequest req = recordFactory.newRecordInstance(NodeHeartbeatRequest.class);
+    NodeStatus status = recordFactory.newRecordInstance(NodeStatus.class);
+    status.setNodeId(nodeId);
+    for (Map.Entry<ApplicationId, List<Container>> entry : conts.entrySet()) {
+      status.setContainers(entry.getKey(), entry.getValue());
+    }
+    NodeHealthStatus healthStatus = recordFactory.newRecordInstance(NodeHealthStatus.class);
+    healthStatus.setHealthReport("");
+    healthStatus.setIsNodeHealthy(isHealthy);
+    healthStatus.setLastHealthReportTime(1);
+    status.setNodeHealthStatus(healthStatus);
+    status.setResponseId(1);
+    req.setNodeStatus(status);
+    getResourceTrackerService().nodeHeartbeat(req);
+  }
+
+  @Override
+  protected ClientRMService createClientRMService() {
+    return new ClientRMService(getRMContext(), amLivelinessMonitor,
+        clientToAMSecretManager, getResourceScheduler()) {
+      @Override
+      public void start() {
+        //override to not start rpc handler
+      }
+    };
+  }
+
+  @Override
+  protected ResourceTrackerService createResourceTrackerService() {
+    return new ResourceTrackerService(getRMContext(), nodesListManager,
+        this.nmLivelinessMonitor, this.containerTokenSecretManager){
+      @Override
+      public void start() {
+        //override to not start rpc handler
+      }
+    };
+  }
+
+  @Override
+  protected ApplicationMasterService createApplicationMasterService() {
+    return new ApplicationMasterService(getRMContext(),
+        this.amLivelinessMonitor, this.appTokenSecretManager, scheduler){
+      @Override
+      public void start() {
+        //override to not start rpc handler
+      }
+    };
+  }
+
+  @Override
+  protected ApplicationMasterLauncher createAMLauncher() {
+    return new ApplicationMasterLauncher(
+        this.appTokenSecretManager, this.clientToAMSecretManager,
+        getRMContext()) {
+      @Override
+      public void start() {
+        //override to not start rpc handler
+      }
+      @Override
+      public void  handle(AMLauncherEvent appEvent) {
+        //don't do anything
+      }
+    };
+  }
+
+  protected AdminService createAdminService() {
+    return new AdminService(getConfig(), scheduler, getRMContext(), 
+        this.nodesListManager){
+      @Override
+      public void start() {
+        //override to not start rpc handler
+      }
+    };
+  }
+
+  @Override
+  protected void startWepApp() {
+    //override to disable webapp
+  }
+
+}

Modified: hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/NodeManager.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/NodeManager.java?rev=1153430&r1=1153429&r2=1153430&view=diff
==============================================================================
--- hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/NodeManager.java (original)
+++ hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/NodeManager.java Wed Aug  3 11:31:34 2011
@@ -41,18 +41,20 @@ import org.apache.hadoop.yarn.api.record
 import org.apache.hadoop.yarn.api.records.ContainerId;
 import org.apache.hadoop.yarn.api.records.ContainerLaunchContext;
 import org.apache.hadoop.yarn.api.records.ContainerState;
+import org.apache.hadoop.yarn.api.records.NodeHealthStatus;
 import org.apache.hadoop.yarn.api.records.NodeId;
 import org.apache.hadoop.yarn.api.records.Resource;
 import org.apache.hadoop.yarn.exceptions.YarnRemoteException;
 import org.apache.hadoop.yarn.factories.RecordFactory;
 import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
 import org.apache.hadoop.yarn.ipc.RPCUtil;
+import org.apache.hadoop.yarn.server.api.protocolrecords.NodeHeartbeatRequest;
+import org.apache.hadoop.yarn.server.api.protocolrecords.RegisterNodeManagerRequest;
 import org.apache.hadoop.yarn.server.api.records.HeartbeatResponse;
 import org.apache.hadoop.yarn.server.api.records.NodeStatus;
 import org.apache.hadoop.yarn.server.api.records.RegistrationResponse;
 import org.apache.hadoop.yarn.server.resourcemanager.resource.Resources;
-import org.apache.hadoop.yarn.server.resourcemanager.resourcetracker.NodeInfo;
-import org.apache.hadoop.yarn.server.resourcemanager.resourcetracker.RMResourceTrackerImpl;
+import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode;
 import org.apache.hadoop.yarn.util.BuilderUtils;
 
 @Private
@@ -68,26 +70,32 @@ public class NodeManager implements Cont
   Resource available = recordFactory.newRecordInstance(Resource.class);
   Resource used = recordFactory.newRecordInstance(Resource.class);
 
-  final RMResourceTrackerImpl resourceTracker;
-  final NodeInfo nodeInfo;
+  final ResourceTrackerService resourceTrackerService;
+  final RMNode nodeInfo;
   final Map<String, List<Container>> containers = 
     new HashMap<String, List<Container>>();
   
   public NodeManager(String hostName, int containerManagerPort, int httpPort,
-      String rackName, int memory, RMResourceTrackerImpl resourceTracker)
+      String rackName, int memory,
+      ResourceTrackerService resourceTrackerService, RMContext rmContext)
       throws IOException {
     this.containerManagerAddress = hostName + ":" + containerManagerPort;
     this.nodeHttpAddress = hostName + ":" + httpPort;
     this.rackName = rackName;
-    this.resourceTracker = resourceTracker;
+    this.resourceTrackerService = resourceTrackerService;
     this.capability = Resources.createResource(memory);
     Resources.addTo(available, capability);
 
-    RegistrationResponse response =
-        resourceTracker.registerNodeManager(hostName, containerManagerPort, 
-            httpPort, capability);
+    RegisterNodeManagerRequest request = recordFactory
+        .newRecordInstance(RegisterNodeManagerRequest.class);
+    request.setContainerManagerPort(containerManagerPort);
+    request.setHost(hostName);
+    request.setHttpPort(httpPort);
+    request.setResource(capability);
+    RegistrationResponse response = resourceTrackerService
+        .registerNodeManager(request).getRegistrationResponse();
     this.nodeId = response.getNodeId();
-    this.nodeInfo = resourceTracker.getNodeManager(nodeId);
+    this.nodeInfo = rmContext.getNodesCollection().getNodeInfo(nodeId);
    
     // Sanity check
     Assert.assertEquals(memory, 
@@ -122,10 +130,14 @@ public class NodeManager implements Cont
   
   public void heartbeat() throws IOException {
     NodeStatus nodeStatus = 
-      org.apache.hadoop.yarn.server.resourcemanager.resourcetracker.NodeStatus.createNodeStatus(
+      org.apache.hadoop.yarn.server.resourcemanager.NodeManager.createNodeStatus(
           nodeId, containers);
     nodeStatus.setResponseId(responseID);
-    HeartbeatResponse response = resourceTracker.nodeHeartbeat(nodeStatus);
+    NodeHeartbeatRequest request = recordFactory
+        .newRecordInstance(NodeHeartbeatRequest.class);
+    request.setNodeStatus(nodeStatus);
+    HeartbeatResponse response = resourceTrackerService
+        .nodeHeartbeat(request).getHeartbeatResponse();
     responseID = response.getResponseId();
   }
 
@@ -152,7 +164,7 @@ public class NodeManager implements Cont
 
     Container container =
         BuilderUtils.newContainer(containerLaunchContext.getContainerId(),
-            containerManagerAddress, nodeHttpAddress,
+            this.nodeId, containerManagerAddress, nodeHttpAddress,
             containerLaunchContext.getResource());
 
     applicationContainers.add(container);
@@ -236,4 +248,17 @@ public class NodeManager implements Cont
     GetContainerStatusResponse response = recordFactory.newRecordInstance(GetContainerStatusResponse.class);
     return response;
   }
+
+  public static org.apache.hadoop.yarn.server.api.records.NodeStatus createNodeStatus(
+      NodeId nodeId, Map<String, List<Container>> containers) {
+    RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
+    org.apache.hadoop.yarn.server.api.records.NodeStatus nodeStatus = recordFactory.newRecordInstance(org.apache.hadoop.yarn.server.api.records.NodeStatus.class);
+    nodeStatus.setNodeId(nodeId);
+    nodeStatus.addAllContainers(containers);
+    NodeHealthStatus nodeHealthStatus = 
+      recordFactory.newRecordInstance(NodeHealthStatus.class);
+    nodeHealthStatus.setIsNodeHealthy(true);
+    nodeStatus.setNodeHealthStatus(nodeHealthStatus);
+    return nodeStatus;
+  }
 }

Modified: hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/Task.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/Task.java?rev=1153430&r1=1153429&r2=1153430&view=diff
==============================================================================
--- hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/Task.java (original)
+++ hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/Task.java Wed Aug  3 11:31:34 2011
@@ -58,7 +58,7 @@ public class Task {
     // Special case: Don't care about locality
     if (!(hosts.length == 1 && 
         hosts[0].equals(
-            org.apache.hadoop.yarn.server.resourcemanager.scheduler.NodeManager.ANY))) {
+            org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode.ANY))) {
       for (String host : hosts) {
         this.hosts.add(host);
         this.racks.add(Application.resolve(host));

Added: hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRM.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRM.java?rev=1153430&view=auto
==============================================================================
--- hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRM.java (added)
+++ hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRM.java Wed Aug  3 11:31:34 2011
@@ -0,0 +1,38 @@
+package org.apache.hadoop.yarn.server.resourcemanager;
+
+import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
+import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttempt;
+import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptState;
+import org.apache.log4j.Level;
+import org.apache.log4j.LogManager;
+import org.apache.log4j.Logger;
+import org.junit.Test;
+
+public class TestRM {
+
+  @Test
+  public void testApp() throws Exception {
+    Logger rootLogger = LogManager.getRootLogger();
+    rootLogger.setLevel(Level.DEBUG);
+    MockRM rm = new MockRM();
+    rm.start();
+    rm.registerNode(1, "h1", 5000);
+    rm.registerNode(2, "h2", 10000);
+    
+    RMApp app = rm.submitApp(2000);
+
+    //kick the scheduling
+    rm.nodeHeartbeat(1, true);
+
+    RMAppAttempt attempt = app.getCurrentAppAttempt();
+    rm.sendAMLaunched(attempt.getAppAttemptId());
+    rm.registerAppAttempt(attempt.getAppAttemptId());
+    rm.unregisterAppAttempt(attempt.getAppAttemptId());
+    rm.waitForState(attempt.getAppAttemptId(), RMAppAttemptState.FINISHED);
+  }
+
+  public static void main(String[] args) throws Exception {
+    TestRM t = new TestRM();
+    t.testApp();
+  }
+}

Modified: hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestResourceManager.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestResourceManager.java?rev=1153430&r1=1153429&r2=1153430&view=diff
==============================================================================
--- hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestResourceManager.java (original)
+++ hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestResourceManager.java Wed Aug  3 11:31:34 2011
@@ -26,12 +26,10 @@ import org.apache.hadoop.conf.Configurat
 import org.apache.hadoop.net.NetworkTopology;
 import org.apache.hadoop.yarn.api.records.Priority;
 import org.apache.hadoop.yarn.api.records.Resource;
-import org.apache.hadoop.yarn.server.resourcemanager.resource.Resources;
-import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
 import org.apache.hadoop.yarn.server.resourcemanager.recovery.Store;
 import org.apache.hadoop.yarn.server.resourcemanager.recovery.StoreFactory;
-import org.apache.hadoop.yarn.server.resourcemanager.scheduler.NodeManager;
-
+import org.apache.hadoop.yarn.server.resourcemanager.resource.Resources;
+import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -58,7 +56,8 @@ public class TestResourceManager {
           String rackName, int memory) throws IOException {
     return new org.apache.hadoop.yarn.server.resourcemanager.NodeManager(
         hostName, containerManagerPort, httpPort, rackName, memory,
-        resourceManager.getResourceTracker());
+        resourceManager.getResourceTrackerService(), resourceManager
+            .getRMContext());
   }
   
   @Test
@@ -165,7 +164,7 @@ public class TestResourceManager {
     Task t2 = new Task(application, priority1, new String[] {host1, host2});
     application.addTask(t2);
 
-    Task t3 = new Task(application, priority0, new String[] {NodeManager.ANY});
+    Task t3 = new Task(application, priority0, new String[] {RMNode.ANY});
     application.addTask(t3);
 
     // Send resource requests to the scheduler

Modified: hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/MockAsm.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/MockAsm.java?rev=1153430&r1=1153429&r2=1153430&view=diff
==============================================================================
--- hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/MockAsm.java (original)
+++ hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/MockAsm.java Wed Aug  3 11:31:34 2011
@@ -38,6 +38,7 @@ import org.apache.hadoop.yarn.security.c
 import org.apache.hadoop.yarn.server.resourcemanager.ApplicationsManager;
 import org.apache.hadoop.yarn.server.resourcemanager.recovery.ApplicationsStore.ApplicationStore;
 import org.apache.hadoop.yarn.server.resourcemanager.recovery.Store.RMState;
+import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.AMLivelinessMonitor;
 import org.apache.hadoop.yarn.service.AbstractService;
 import org.apache.hadoop.yarn.util.Records;
 
@@ -169,7 +170,7 @@ public abstract class MockAsm extends Mo
     }
   }
 
-  public static class ApplicationBase implements Application {
+  public static class ApplicationBase implements AppAttempt {
     @Override
     public ApplicationSubmissionContext getSubmissionContext() {
       throw new UnsupportedOperationException("Not supported yet.");
@@ -270,7 +271,7 @@ public abstract class MockAsm extends Mo
     };
   }
 
-  public static Application newApplication(int i) {
+  public static AppAttempt newApplication(int i) {
     final ApplicationId id = newAppID(i);
     final ApplicationMaster master = newAppMaster(id);
     final Container masterContainer = Records.newRecord(Container.class);
@@ -333,8 +334,8 @@ public abstract class MockAsm extends Mo
     };
   }
   
-  public static List<Application> newApplications(int n) {
-    List<Application> list = Lists.newArrayList();
+  public static List<AppAttempt> newApplications(int n) {
+    List<AppAttempt> list = Lists.newArrayList();
     for (int i = 0; i < n; ++i) {
       list.add(newApplication(i));
     }

Modified: hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMLaunchFailure.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMLaunchFailure.java?rev=1153430&r1=1153429&r2=1153430&view=diff
==============================================================================
--- hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMLaunchFailure.java (original)
+++ hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMLaunchFailure.java Wed Aug  3 11:31:34 2011
@@ -47,9 +47,10 @@ import org.apache.hadoop.yarn.factory.pr
 import org.apache.hadoop.yarn.security.ApplicationTokenSecretManager;
 import org.apache.hadoop.yarn.server.resourcemanager.ClientRMService;
 import org.apache.hadoop.yarn.server.resourcemanager.RMConfig;
+import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
+import org.apache.hadoop.yarn.server.resourcemanager.RMContextImpl;
 import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
-import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager.RMContext;
-import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.AMLauncherEventType;
+import org.apache.hadoop.yarn.server.resourcemanager.amlauncher.AMLauncherEventType;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ASMEvent;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationEvent;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationEventType;
@@ -85,13 +86,8 @@ public class TestAMLaunchFailure {
     }
 
     @Override
-    public void doneApplication(ApplicationId applicationId, boolean finishApplication)
-        throws IOException {
-    }
-
-    @Override
     public QueueInfo getQueueInfo(String queueName,
-        boolean includeApplications, boolean includeChildQueues,
+        boolean includeChildQueues,
         boolean recursive) throws IOException {
       return null;
     }
@@ -136,7 +132,7 @@ public class TestAMLaunchFailure {
 
     private  class DummyApplicationMasterLauncher implements EventHandler<ASMEvent<AMLauncherEventType>> {
       private AtomicInteger notify = new AtomicInteger();
-      private Application app;
+      private AppAttempt app;
 
       public DummyApplicationMasterLauncher(RMContext context) {
         context.getDispatcher().register(AMLauncherEventType.class, this);
@@ -190,7 +186,7 @@ public class TestAMLaunchFailure {
 
   @Before
   public void setUp() {
-    context = new ResourceManager.RMContextImpl(new MemStore());
+    context = new RMContextImpl(new MemStore());
     Configuration conf = new Configuration();
 
     context.getDispatcher().register(ApplicationEventType.class,
@@ -202,7 +198,7 @@ public class TestAMLaunchFailure {
     asmImpl = new ExtApplicationsManagerImpl(applicationTokenSecretManager, scheduler);
     clientService = new ClientRMService(context, asmImpl
         .getAmLivelinessMonitor(), asmImpl.getClientToAMSecretManager(),
-        null, scheduler);
+        scheduler);
     clientService.init(conf);
     new DummyApplicationTracker();
     conf.setLong(YarnConfiguration.AM_EXPIRY_INTERVAL, 3000L);
@@ -230,7 +226,7 @@ public class TestAMLaunchFailure {
         .newRecordInstance(SubmitApplicationRequest.class);
     request.setApplicationSubmissionContext(submissionContext);
     clientService.submitApplication(request);
-    Application application = context.getApplications().get(appID); 
+    AppAttempt application = context.getApplications().get(appID); 
 
     while (application.getState() != ApplicationState.FAILED) {
       LOG.info("Waiting for application to go to FAILED state."

Modified: hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMRMRPCResponseId.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMRMRPCResponseId.java?rev=1153430&r1=1153429&r2=1153430&view=diff
==============================================================================
--- hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMRMRPCResponseId.java (original)
+++ hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMRMRPCResponseId.java Wed Aug  3 11:31:34 2011
@@ -42,10 +42,11 @@ import org.apache.hadoop.yarn.api.record
 import org.apache.hadoop.yarn.factories.RecordFactory;
 import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
 import org.apache.hadoop.yarn.security.ApplicationTokenSecretManager;
-import org.apache.hadoop.yarn.server.resourcemanager.ApplicationMasterService;
 import org.apache.hadoop.yarn.server.resourcemanager.ClientRMService;
+import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
+import org.apache.hadoop.yarn.server.resourcemanager.RMContextImpl;
 import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
-import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager.RMContext;
+import org.apache.hadoop.yarn.server.resourcemanager.ams.ApplicationMasterService;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationEventType;
 import org.apache.hadoop.yarn.server.resourcemanager.recovery.ApplicationsStore.ApplicationStore;
 import org.apache.hadoop.yarn.server.resourcemanager.recovery.MemStore;
@@ -83,13 +84,8 @@ public class TestAMRMRPCResponseId {
     }
 
     @Override
-    public void doneApplication(ApplicationId applicationId, boolean finishApplication)
-        throws IOException {
-    }
-
-    @Override
     public QueueInfo getQueueInfo(String queueName,
-        boolean includeApplications, boolean includeChildQueues,
+        boolean includeChildQueues,
         boolean recursive) throws IOException {
       return null;
     }
@@ -121,7 +117,7 @@ public class TestAMRMRPCResponseId {
   
   @Before
   public void setUp() {
-    context = new ResourceManager.RMContextImpl(new MemStore());
+    context = new RMContextImpl(new MemStore());
 
     context.getDispatcher().register(ApplicationEventType.class,
         new ResourceManager.ApplicationEventDispatcher(context));
@@ -132,7 +128,7 @@ public class TestAMRMRPCResponseId {
     Configuration conf = new Configuration();
     this.clientService = new ClientRMService(context, applicationsManager
         .getAmLivelinessMonitor(), applicationsManager
-        .getClientToAMSecretManager(), null, scheduler);
+        .getClientToAMSecretManager(), scheduler);
     this.clientService.init(conf);
     amService = new ApplicationMasterService(appTokenManager, scheduler,
         context);

Modified: hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMRestart.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMRestart.java?rev=1153430&r1=1153429&r2=1153430&view=diff
==============================================================================
--- hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMRestart.java (original)
+++ hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestAMRestart.java Wed Aug  3 11:31:34 2011
@@ -20,6 +20,7 @@ import org.apache.hadoop.yarn.api.record
 import org.apache.hadoop.yarn.api.records.Container;
 import org.apache.hadoop.yarn.api.records.ContainerId;
 import org.apache.hadoop.yarn.api.records.ContainerToken;
+import org.apache.hadoop.yarn.api.records.NodeId;
 import org.apache.hadoop.yarn.api.records.Priority;
 import org.apache.hadoop.yarn.api.records.QueueInfo;
 import org.apache.hadoop.yarn.api.records.QueueUserACLInfo;
@@ -32,9 +33,10 @@ import org.apache.hadoop.yarn.factory.pr
 import org.apache.hadoop.yarn.security.ApplicationTokenSecretManager;
 import org.apache.hadoop.yarn.server.resourcemanager.ClientRMService;
 import org.apache.hadoop.yarn.server.resourcemanager.RMConfig;
+import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
+import org.apache.hadoop.yarn.server.resourcemanager.RMContextImpl;
 import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
-import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager.RMContext;
-import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.AMLauncherEventType;
+import org.apache.hadoop.yarn.server.resourcemanager.amlauncher.AMLauncherEventType;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ASMEvent;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationEvent;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationEventType;
@@ -43,8 +45,7 @@ import org.apache.hadoop.yarn.server.res
 import org.apache.hadoop.yarn.server.resourcemanager.recovery.MemStore;
 import org.apache.hadoop.yarn.server.resourcemanager.recovery.Store.RMState;
 import org.apache.hadoop.yarn.server.resourcemanager.resource.Resources;
-import org.apache.hadoop.yarn.server.resourcemanager.resourcetracker.ClusterTracker;
-import org.apache.hadoop.yarn.server.resourcemanager.resourcetracker.NodeInfo;
+import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.Allocation;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.YarnScheduler;
@@ -60,7 +61,7 @@ import org.junit.Test;
 public class TestAMRestart {
   private static final Log LOG = LogFactory.getLog(TestAMRestart.class);
   ApplicationsManagerImpl appImpl;
-  RMContext asmContext = new ResourceManager.RMContextImpl(new MemStore());
+  RMContext asmContext = new RMContextImpl(new MemStore());
   ApplicationTokenSecretManager appTokenSecretManager = 
     new ApplicationTokenSecretManager();
   DummyResourceScheduler scheduler;
@@ -139,7 +140,7 @@ public class TestAMRestart {
   private class DummyResourceScheduler implements ResourceScheduler {
    
     @Override
-    public void removeNode(NodeInfo node) {
+    public void removeNode(RMNode node) {
     }
     
     @Override
@@ -147,6 +148,7 @@ public class TestAMRestart {
         List<ResourceRequest> ask, List<Container> release) throws IOException {
       Container container = recordFactory.newRecordInstance(Container.class);
       container.setContainerToken(recordFactory.newRecordInstance(ContainerToken.class));
+      container.setNodeId(recordFactory.newRecordInstance(NodeId.class));
       container.setContainerManagerAddress("localhost");
       container.setNodeHttpAddress("localhost:9999");
       container.setId(recordFactory.newRecordInstance(ContainerId.class));
@@ -178,12 +180,8 @@ public class TestAMRestart {
     }
 
     @Override
-    public void doneApplication(ApplicationId applicationId, boolean finishApplication)
-        throws IOException {
-    }
-    @Override
     public QueueInfo getQueueInfo(String queueName,
-        boolean includeApplications, boolean includeChildQueues,
+        boolean includeChildQueues,
         boolean recursive) throws IOException {
       return null;
     }
@@ -198,19 +196,19 @@ public class TestAMRestart {
         throws IOException {
     }
     @Override
-    public void addNode(NodeInfo nodeInfo) {
+    public void addNode(RMNode nodeInfo) {
     }
     @Override
     public void recover(RMState state) throws Exception {
     }
     @Override
     public void reinitialize(Configuration conf,
-        ContainerTokenSecretManager secretManager, ClusterTracker clusterTracker)
+        ContainerTokenSecretManager secretManager, RMContext rmContext)
         throws IOException {
     }
 
     @Override
-    public void nodeUpdate(NodeInfo nodeInfo,
+    public void nodeUpdate(RMNode nodeInfo,
         Map<String, List<Container>> containers) {      
     }
 
@@ -250,7 +248,7 @@ public class TestAMRestart {
 
     this.clientRMService = new ClientRMService(asmContext, appImpl
         .getAmLivelinessMonitor(), appImpl.getClientToAMSecretManager(),
-        null, scheduler); 
+        scheduler); 
     this.clientRMService.init(conf);
   }
 
@@ -258,7 +256,7 @@ public class TestAMRestart {
   public void tearDown() {
   }
 
-  private void waitForFailed(Application application, ApplicationState 
+  private void waitForFailed(AppAttempt application, ApplicationState 
       finalState) throws Exception {
     int count = 0;
     while(application.getState() != finalState && count < 10) {
@@ -281,7 +279,7 @@ public class TestAMRestart {
         .newRecordInstance(SubmitApplicationRequest.class);
     request.setApplicationSubmissionContext(subContext);
     clientRMService.submitApplication(request);
-    Application application = asmContext.getApplications().get(appID); 
+    AppAttempt application = asmContext.getApplications().get(appID); 
     synchronized (schedulerNotify) {
       while(schedulerNotify.get() == 0) {
         schedulerNotify.wait();

Modified: hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestASMStateMachine.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestASMStateMachine.java?rev=1153430&r1=1153429&r2=1153430&view=diff
==============================================================================
--- hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestASMStateMachine.java (original)
+++ hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestASMStateMachine.java Wed Aug  3 11:31:34 2011
@@ -32,20 +32,21 @@ import org.apache.hadoop.yarn.api.record
 import org.apache.hadoop.yarn.event.EventHandler;
 import org.apache.hadoop.yarn.factories.RecordFactory;
 import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
-import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
-import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager.RMContext;
-import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.AMLauncherEventType;
-import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ASMEvent;
-import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationEvent;
-import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationEventType;
-import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.AMFinishEvent;
+import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
+import org.apache.hadoop.yarn.server.resourcemanager.RMContextImpl;
+import org.apache.hadoop.yarn.server.resourcemanager.amlauncher.AMLauncherEventType;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.AMAllocatedEvent;
+import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.AMFinishEvent;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.AMRegistrationEvent;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.AMStatusUpdateEvent;
+import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ASMEvent;
+import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationEvent;
+import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationEventType;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationTrackerEventType;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.SNEventType;
 import org.apache.hadoop.yarn.server.resourcemanager.recovery.MemStore;
 import org.apache.hadoop.yarn.server.resourcemanager.recovery.StoreFactory;
+import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.AMLivelinessMonitor;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -53,7 +54,7 @@ import org.junit.Test;
 public class TestASMStateMachine {
   private static final Log LOG = LogFactory.getLog(TestASMStateMachine.class);
   private static RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
-  RMContext context = new ResourceManager.RMContextImpl(new MemStore());
+  RMContext context = new RMContextImpl(new MemStore());
   EventHandler handler;
   private boolean snreceivedCleanUp = false;
   private boolean snAllocateReceived = false;
@@ -80,7 +81,7 @@ public class TestASMStateMachine {
   }
 
   private class DummyAMLaunchEventHandler implements EventHandler<ASMEvent<AMLauncherEventType>> {
-    Application application;
+    AppAttempt application;
     AtomicInteger amsync = new AtomicInteger(0);
 
     public DummyAMLaunchEventHandler() {
@@ -105,7 +106,7 @@ public class TestASMStateMachine {
   }
 
   private class DummySNEventHandler implements EventHandler<ASMEvent<SNEventType>> {
-    Application application;
+    AppAttempt application;
     AtomicInteger snsync = new AtomicInteger(0);
 
     public DummySNEventHandler() {
@@ -120,7 +121,7 @@ public class TestASMStateMachine {
         break;
       case SCHEDULE:
         snAllocateReceived = true;
-        application = event.getApplication();
+        application = event.getAppAttempt();
         context.getDispatcher().getEventHandler().handle(
             new AMAllocatedEvent(application.getApplicationID(),
                 application.getMasterContainer()));
@@ -161,7 +162,7 @@ public class TestASMStateMachine {
   }
 
   private void waitForState( ApplicationState 
-      finalState, ApplicationImpl masterInfo) throws Exception {
+      finalState, AppAttemptImpl masterInfo) throws Exception {
     int count = 0;
     while(masterInfo.getState() != finalState && count < 10) {
       Thread.sleep(500);
@@ -180,7 +181,7 @@ public class TestASMStateMachine {
     submissioncontext.getApplicationId().setId(1);
     submissioncontext.getApplicationId().setClusterTimestamp(System.currentTimeMillis());
 
-    ApplicationImpl masterInfo = new ApplicationImpl(context,
+    AppAttemptImpl masterInfo = new AppAttemptImpl(context,
         conf, "dummyuser", submissioncontext, "dummyToken", StoreFactory
             .createVoidAppStore(), new AMLivelinessMonitor(context
             .getDispatcher().getEventHandler()));

Modified: hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestApplicationCleanup.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestApplicationCleanup.java?rev=1153430&r1=1153429&r2=1153430&view=diff
==============================================================================
--- hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestApplicationCleanup.java (original)
+++ hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestApplicationCleanup.java Wed Aug  3 11:31:34 2011
@@ -33,7 +33,6 @@ import org.apache.hadoop.conf.Configurat
 import org.apache.hadoop.net.NetworkTopology;
 import org.apache.hadoop.net.Node;
 import org.apache.hadoop.net.NodeBase;
-import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.yarn.api.protocolrecords.SubmitApplicationRequest;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.ApplicationState;
@@ -48,25 +47,22 @@ import org.apache.hadoop.yarn.factories.
 import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
 import org.apache.hadoop.yarn.security.ApplicationTokenSecretManager;
 import org.apache.hadoop.yarn.server.resourcemanager.ClientRMService;
-import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
-import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager.RMContext;
-import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.AMLauncherEventType;
+import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
+import org.apache.hadoop.yarn.server.resourcemanager.RMContextImpl;
+import org.apache.hadoop.yarn.server.resourcemanager.amlauncher.AMLauncherEventType;
+import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.AMAllocatedEvent;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ASMEvent;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationEvent;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationEventType;
-import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.AMAllocatedEvent;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationTrackerEventType;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.SNEventType;
 import org.apache.hadoop.yarn.server.resourcemanager.recovery.MemStore;
-import org.apache.hadoop.yarn.server.resourcemanager.resourcetracker.NodeInfo;
-import org.apache.hadoop.yarn.server.resourcemanager.resourcetracker.NodeInfoTracker;
-import org.apache.hadoop.yarn.server.resourcemanager.resourcetracker.RMResourceTrackerImpl;
-import org.apache.hadoop.yarn.server.resourcemanager.scheduler.NodeManager;
+import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode;
+import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNodeImpl;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.NodeResponse;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.YarnScheduler;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.fifo.FifoScheduler;
-import org.apache.hadoop.yarn.server.security.ContainerTokenSecretManager;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Ignore;
@@ -86,34 +82,13 @@ public class TestApplicationCleanup {
   private ExtASM asm;
   private static final int memoryNeeded = 100;
 
-  private final RMContext context = new ResourceManager.RMContextImpl(new MemStore());
+  private final RMContext context = new RMContextImpl(new MemStore());
   private ClientRMService clientService;
-  private TestRMResourceTrackerImpl clusterTracker;
-
-  private class TestRMResourceTrackerImpl extends RMResourceTrackerImpl {
-
-    public TestRMResourceTrackerImpl(
-        ContainerTokenSecretManager containerTokenSecretManager, RMContext context) {
-      super(containerTokenSecretManager, context);
-    }
-    
-    @Override
-    protected NodeInfoTracker getAndAddNodeInfoTracker(NodeId nodeId,
-        String host, int cmPort, int httpPort, Node node, Resource capability) {
-      return super.getAndAddNodeInfoTracker(nodeId, host, cmPort, httpPort, node, capability);
-    }
-    
-    @Override
-    protected void updateListener(NodeInfo nodeManager, Map<String, List<Container>> containers) {
-      super.updateListener(nodeManager, containers);
-    }
-  }
 
   @Before
   public void setUp() {
     new DummyApplicationTracker();
-    this.clusterTracker = new TestRMResourceTrackerImpl(new ContainerTokenSecretManager(), context);
-    scheduler = new FifoScheduler(clusterTracker);
+    scheduler = new FifoScheduler();
     context.getDispatcher().register(ApplicationTrackerEventType.class, scheduler);
     Configuration conf = new Configuration();
     context.getDispatcher().init(conf);
@@ -122,7 +97,7 @@ public class TestApplicationCleanup {
     asm.init(conf);
     clientService = new ClientRMService(context,
         asm.getAmLivelinessMonitor(), asm.getClientToAMSecretManager(),
-        clusterTracker, scheduler);
+        scheduler);
   }
 
   @After
@@ -150,7 +125,7 @@ public class TestApplicationCleanup {
 
     private class DummyApplicationMasterLauncher implements EventHandler<ASMEvent<AMLauncherEventType>> {
       private AtomicInteger notify = new AtomicInteger(0);
-      private Application application;
+      private AppAttempt application;
 
       public DummyApplicationMasterLauncher(RMContext context) {
         context.getDispatcher().register(AMLauncherEventType.class, this);
@@ -179,7 +154,7 @@ public class TestApplicationCleanup {
 
     private class DummySchedulerNegotiator implements EventHandler<ASMEvent<SNEventType>> {
       private AtomicInteger snnotify = new AtomicInteger(0);
-      Application application;
+      AppAttempt application;
       public  DummySchedulerNegotiator(RMContext context) {
         context.getDispatcher().register(SNEventType.class, this);
       }
@@ -193,7 +168,7 @@ public class TestApplicationCleanup {
           break;
         case SCHEDULE:
           schedulerScheduleCalled = true;
-          application = appEvent.getApplication();
+          application = appEvent.getAppAttempt();
           context.getDispatcher().getEventHandler().handle(
               new AMAllocatedEvent(application.getApplicationID(),
                   application.getMasterContainer()));
@@ -223,7 +198,7 @@ public class TestApplicationCleanup {
   }
 
   private void waitForState(ApplicationState 
-      finalState, Application application) throws Exception {
+      finalState, AppAttempt application) throws Exception {
     int count = 0;
     while(application.getState() != finalState && count < 10) {
       Thread.sleep(500);
@@ -244,15 +219,14 @@ public class TestApplicationCleanup {
     return request;
   }
 
-  protected NodeManager addNodes(String commonName, int i, int memoryCapability) throws IOException {
+  protected RMNode addNodes(String commonName, int i, int memoryCapability) throws IOException {
     NodeId nodeId = recordFactory.newRecordInstance(NodeId.class);
     nodeId.setId(i);
     String hostName = commonName + "_" + i;
     Node node = new NodeBase(hostName, NetworkTopology.DEFAULT_RACK);
     Resource capability = recordFactory.newRecordInstance(Resource.class);
-    capability.setMemory(1024);
-    NodeInfoTracker nTracker = clusterTracker.getAndAddNodeInfoTracker(nodeId, hostName, i, -1, node, capability);
-    return nTracker.getNodeManager();
+    capability.setMemory(memoryCapability);
+    return new RMNodeImpl(nodeId, hostName, i, -i, node, capability);
   }
 
   @Test
@@ -274,18 +248,18 @@ public class TestApplicationCleanup {
     reqs.add(createNewResourceRequest(memoryNeeded, 2));
     List<Container> release = new ArrayList<Container>();
     scheduler.allocate(appID, reqs, release);
-    ArrayList<NodeManager> nodesAdded = new ArrayList<NodeManager>();
+    ArrayList<RMNode> nodesAdded = new ArrayList<RMNode>();
     for (int i = 0; i < 10; i++) {
       nodesAdded.add(addNodes("localhost", i, memoryCapability));
     }
     /* let one node heartbeat */
     Map<String, List<Container>> containers = new HashMap<String, List<Container>>();
-    NodeManager firstNode = nodesAdded.get(0);
+    RMNode firstNode = nodesAdded.get(0);
     int firstNodeMemory = firstNode.getAvailableResource().getMemory();
-    NodeManager secondNode = nodesAdded.get(1);
+    RMNode secondNode = nodesAdded.get(1);
   
-    clusterTracker.updateListener(firstNode, containers);
-    clusterTracker.updateListener(secondNode, containers);
+    context.getNodesCollection().updateListener(firstNode, containers);
+    context.getNodesCollection().updateListener(secondNode, containers);
     LOG.info("Available resource on first node" + firstNode.getAvailableResource());
     LOG.info("Available resource on second node" + secondNode.getAvailableResource());
     /* only allocate the containers to the first node */
@@ -301,7 +275,7 @@ public class TestApplicationCleanup {
     Assert.assertTrue(asm.schedulerCleanupCalled);
     Assert.assertTrue(asm.schedulerScheduleCalled);
     /* check for update of completed application */
-    clusterTracker.updateListener(firstNode, containers);
+    context.getNodesCollection().updateListener(firstNode, containers);
     NodeResponse response = firstNode.statusUpdate(containers);
     Assert.assertTrue(response.getFinishedApplications().contains(appID));
     LOG.info("The containers to clean up " + response.getContainersToCleanUp().size());

Modified: hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestApplicationMasterExpiry.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestApplicationMasterExpiry.java?rev=1153430&r1=1153429&r2=1153430&view=diff
==============================================================================
--- hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestApplicationMasterExpiry.java (original)
+++ hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestApplicationMasterExpiry.java Wed Aug  3 11:31:34 2011
@@ -32,10 +32,11 @@ import org.apache.hadoop.yarn.conf.YarnC
 import org.apache.hadoop.yarn.event.EventHandler;
 import org.apache.hadoop.yarn.factories.RecordFactory;
 import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
+import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
+import org.apache.hadoop.yarn.server.resourcemanager.RMContextImpl;
 import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
-import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager.RMContext;
+import org.apache.hadoop.yarn.server.resourcemanager.amlauncher.AMLauncherEventType;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.AMAllocatedEvent;
-import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.AMLauncherEventType;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ASMEvent;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationEvent;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationEventType;
@@ -43,6 +44,7 @@ import org.apache.hadoop.yarn.server.res
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.SNEventType;
 import org.apache.hadoop.yarn.server.resourcemanager.recovery.MemStore;
 import org.apache.hadoop.yarn.server.resourcemanager.recovery.ApplicationsStore.ApplicationStore;
+import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.AMLivelinessMonitor;
 import org.junit.Before;
 import org.junit.Test;
 
@@ -54,7 +56,7 @@ public class TestApplicationMasterExpiry
   private static final Log LOG = LogFactory.getLog(TestApplicationMasterExpiry.class);
   private static RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
   
-  private final RMContext context = new ResourceManager.RMContextImpl(new MemStore());
+  private final RMContext context = new RMContextImpl(new MemStore());
   private AMLivelinessMonitor amLivelinessMonitor;
   
   @Before
@@ -123,7 +125,7 @@ public class TestApplicationMasterExpiry
     }
   }
   
-  private void waitForState(Application application, ApplicationState 
+  private void waitForState(AppAttempt application, ApplicationState 
       finalState) throws Exception {
     int count = 0;
     while(application.getState() != finalState && count < 10) {
@@ -146,7 +148,7 @@ public class TestApplicationMasterExpiry
     ApplicationStore appStore = context.getApplicationsStore()
     .createApplicationStore(submissionContext.getApplicationId(),
         submissionContext);
-    Application application = new ApplicationImpl(context,
+    AppAttempt application = new AppAttemptImpl(context,
         new Configuration(), "dummy", submissionContext, "dummytoken", appStore,
         amLivelinessMonitor);
     context.getApplications()

Modified: hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestApplicationMasterLauncher.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestApplicationMasterLauncher.java?rev=1153430&r1=1153429&r2=1153430&view=diff
==============================================================================
--- hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestApplicationMasterLauncher.java (original)
+++ hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestApplicationMasterLauncher.java Wed Aug  3 11:31:34 2011
@@ -33,15 +33,17 @@ import org.apache.hadoop.yarn.factories.
 import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
 import org.apache.hadoop.yarn.security.ApplicationTokenSecretManager;
 import org.apache.hadoop.yarn.security.client.ClientToAMSecretManager;
-import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
-import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager.RMContext;
-import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.AMLauncherEventType;
+import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
+import org.apache.hadoop.yarn.server.resourcemanager.RMContextImpl;
+import org.apache.hadoop.yarn.server.resourcemanager.amlauncher.AMLauncherEventType;
+import org.apache.hadoop.yarn.server.resourcemanager.amlauncher.ApplicationMasterLauncher;
+import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.AMFinishEvent;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ASMEvent;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationEvent;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationEventType;
-import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.AMFinishEvent;
 import org.apache.hadoop.yarn.server.resourcemanager.recovery.MemStore;
 import org.apache.hadoop.yarn.server.resourcemanager.recovery.StoreFactory;
+import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.AMLivelinessMonitor;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -63,7 +65,7 @@ public class TestApplicationMasterLaunch
   Object doneLaunching = new Object();
   AtomicInteger launched = new AtomicInteger();
   AtomicInteger cleanedUp = new AtomicInteger();
-  private RMContext context = new ResourceManager.RMContextImpl(new MemStore());
+  private RMContext context = new RMContextImpl(new MemStore());
 
   private Configuration conf = new Configuration();
   
@@ -114,7 +116,7 @@ public class TestApplicationMasterLaunch
     }
 
     @Override
-    protected Runnable createRunnableLauncher(Application masterInfo, 
+    protected Runnable createRunnableLauncher(AppAttempt masterInfo, 
         AMLauncherEventType event) {
       Runnable r = null;
       switch (event) {
@@ -154,7 +156,7 @@ public class TestApplicationMasterLaunch
     submissionContext.getApplicationId().setClusterTimestamp(System.currentTimeMillis());
     submissionContext.getApplicationId().setId(1);
     submissionContext.setUser("dummyuser");
-    ApplicationImpl masterInfo = new ApplicationImpl(this.context,
+    AppAttemptImpl masterInfo = new AppAttemptImpl(this.context,
         this.conf, "dummyuser", submissionContext, "dummyclienttoken",
         StoreFactory.createVoidAppStore(), new AMLivelinessMonitor(context
             .getDispatcher().getEventHandler()));

Modified: hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestSchedulerNegotiator.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestSchedulerNegotiator.java?rev=1153430&r1=1153429&r2=1153430&view=diff
==============================================================================
--- hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestSchedulerNegotiator.java (original)
+++ hadoop/common/branches/MR-279/mapreduce/yarn/yarn-server/yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/applicationsmanager/TestSchedulerNegotiator.java Wed Aug  3 11:31:34 2011
@@ -40,9 +40,9 @@ import org.apache.hadoop.yarn.api.record
 import org.apache.hadoop.yarn.event.EventHandler;
 import org.apache.hadoop.yarn.factories.RecordFactory;
 import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
-import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
-import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager.RMContext;
-import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.AMLauncherEventType;
+import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
+import org.apache.hadoop.yarn.server.resourcemanager.RMContextImpl;
+import org.apache.hadoop.yarn.server.resourcemanager.amlauncher.AMLauncherEventType;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ASMEvent;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationEvent;
 import org.apache.hadoop.yarn.server.resourcemanager.applicationsmanager.events.ApplicationEventType;
@@ -52,8 +52,8 @@ import org.apache.hadoop.yarn.server.res
 import org.apache.hadoop.yarn.server.resourcemanager.recovery.Store.RMState;
 import org.apache.hadoop.yarn.server.resourcemanager.recovery.StoreFactory;
 import org.apache.hadoop.yarn.server.resourcemanager.resource.Resources;
-import org.apache.hadoop.yarn.server.resourcemanager.resourcetracker.ClusterTracker;
-import org.apache.hadoop.yarn.server.resourcemanager.resourcetracker.NodeInfo;
+import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.AMLivelinessMonitor;
+import org.apache.hadoop.yarn.server.resourcemanager.rmnode.RMNode;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.Allocation;
 import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler;
 import org.apache.hadoop.yarn.server.security.ContainerTokenSecretManager;
@@ -67,8 +67,8 @@ public class TestSchedulerNegotiator {
   private DummyScheduler scheduler;
   private final int testNum = 99999;
   
-  private final RMContext context = new ResourceManager.RMContextImpl(new MemStore());
-  ApplicationImpl masterInfo;
+  private final RMContext context = new RMContextImpl(new MemStore());
+  AppAttemptImpl masterInfo;
   private EventHandler handler;
   private Configuration conf = new Configuration();
   private class DummyScheduler implements ResourceScheduler {
@@ -86,25 +86,21 @@ public class TestSchedulerNegotiator {
   
   
     @Override
-    public void nodeUpdate(NodeInfo nodeInfo,
+    public void nodeUpdate(RMNode nodeInfo,
         Map<String, List<Container>> containers) {
     }
     
     @Override
-    public void removeNode(NodeInfo node) {
+    public void removeNode(RMNode node) {
     }
 
     @Override
     public void handle(ASMEvent<ApplicationTrackerEventType> event) {
     }
-   
-    @Override
-    public void doneApplication(ApplicationId applicationId, boolean finishApplication)
-        throws IOException {
-    }
+
     @Override
     public QueueInfo getQueueInfo(String queueName,
-        boolean includeApplications, boolean includeChildQueues,
+        boolean includeChildQueues,
         boolean recursive) throws IOException {
       return null;
     }
@@ -121,7 +117,7 @@ public class TestSchedulerNegotiator {
 
 
     @Override
-    public void addNode(NodeInfo nodeInfo) {
+    public void addNode(RMNode nodeInfo) {
     }
 
 
@@ -132,7 +128,7 @@ public class TestSchedulerNegotiator {
 
     @Override
     public void reinitialize(Configuration conf,
-        ContainerTokenSecretManager secretManager, ClusterTracker clusterTracker)
+        ContainerTokenSecretManager secretManager, RMContext rmContext)
         throws IOException {
     }
 
@@ -167,7 +163,7 @@ public class TestSchedulerNegotiator {
     schedulerNegotiator.stop();
   }
   
-  public void waitForState(ApplicationState state, ApplicationImpl info) {
+  public void waitForState(ApplicationState state, AppAttemptImpl info) {
     int count = 0;
     while (info.getState() != state && count < 100) {
       try {
@@ -193,7 +189,7 @@ public class TestSchedulerNegotiator {
     submissionContext.getApplicationId().setClusterTimestamp(System.currentTimeMillis());
     submissionContext.getApplicationId().setId(1);
     
-    masterInfo = new ApplicationImpl(this.context, this.conf, "dummy",
+    masterInfo = new AppAttemptImpl(this.context, this.conf, "dummy",
         submissionContext, "dummyClientToken", StoreFactory
             .createVoidAppStore(), new AMLivelinessMonitor(context
             .getDispatcher().getEventHandler()));



Mime
View raw message