hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject svn commit: r1179484 [4/6] - in /hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project: ./ conf/ hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/ hadoop-mapreduce-client/hadoop-mapreduce-client-a...
Date Thu, 06 Oct 2011 01:16:57 GMT
Modified: hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/MockApps.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/MockApps.java?rev=1179484&r1=1179483&r2=1179484&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/MockApps.java (original)
+++ hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/MockApps.java Thu Oct  6 01:16:48 2011
@@ -24,7 +24,8 @@ import java.util.List;
 import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.ApplicationReport;
-import org.apache.hadoop.yarn.api.records.ApplicationState;
+import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
+import org.apache.hadoop.yarn.api.records.YarnApplicationState;
 import org.apache.hadoop.yarn.util.Records;
 
 import com.google.common.collect.Iterators;
@@ -39,8 +40,8 @@ public class MockApps {
       "I18nApp<☯>");
   static final Iterator<String> USERS = Iterators.cycle("dorothy", "tinman",
       "scarecrow", "glinda", "nikko", "toto", "winkie", "zeke", "gulch");
-  static final Iterator<ApplicationState> STATES = Iterators.cycle(
-      ApplicationState.values());
+  static final Iterator<YarnApplicationState> STATES = Iterators.cycle(
+      YarnApplicationState.values());
   static final Iterator<String> QUEUES = Iterators.cycle("a.a1", "a.a2",
       "b.b1", "b.b2", "b.b3", "c.c1.c11", "c.c1.c12", "c.c1.c13",
       "c.c2", "c.c3", "c.c4");
@@ -74,46 +75,47 @@ public class MockApps {
 
   public static ApplicationReport newApp(int i) {
     final ApplicationId id = newAppID(i);
-    final ApplicationState state = newAppState();
+    final YarnApplicationState state = newAppState();
     final String user = newUserName();
     final String name = newAppName();
     final String queue = newQueue();
+    final FinalApplicationStatus finishState = FinalApplicationStatus.UNDEFINED;
     return new ApplicationReport() {
       @Override public ApplicationId getApplicationId() { return id; }
       @Override public String getUser() { return user; }
       @Override public String getName() { return name; }
-      @Override public ApplicationState getState() { return state; }
+      @Override public YarnApplicationState getYarnApplicationState() { return state; }
       @Override public String getQueue() { return queue; }
       @Override public String getTrackingUrl() { return ""; }
-      @Override
+      @Override public FinalApplicationStatus getFinalApplicationStatus() { return finishState; }
       public void setApplicationId(ApplicationId applicationId) {
         // TODO Auto-generated method stub
-        
+
       }
       @Override
       public void setTrackingUrl(String url) {
         // TODO Auto-generated method stub
-        
+
       }
       @Override
       public void setName(String name) {
         // TODO Auto-generated method stub
-        
+
       }
       @Override
       public void setQueue(String queue) {
         // TODO Auto-generated method stub
-        
+
       }
       @Override
-      public void setState(ApplicationState state) {
+      public void setYarnApplicationState(YarnApplicationState state) {
         // TODO Auto-generated method stub
-        
+
       }
       @Override
       public void setUser(String user) {
         // TODO Auto-generated method stub
-        
+
       }
       @Override
       public String getDiagnostics() {
@@ -123,7 +125,7 @@ public class MockApps {
       @Override
       public void setDiagnostics(String diagnostics) {
         // TODO Auto-generated method stub
-        
+
       }
       @Override
       public String getHost() {
@@ -133,7 +135,7 @@ public class MockApps {
       @Override
       public void setHost(String host) {
         // TODO Auto-generated method stub
-        
+
       }
       @Override
       public int getRpcPort() {
@@ -143,7 +145,7 @@ public class MockApps {
       @Override
       public void setRpcPort(int rpcPort) {
         // TODO Auto-generated method stub
-        
+
       }
       @Override
       public String getClientToken() {
@@ -153,9 +155,8 @@ public class MockApps {
       @Override
       public void setClientToken(String clientToken) {
         // TODO Auto-generated method stub
-        
+
       }
-      
       @Override
       public long getStartTime() {
         // TODO Auto-generated method stub
@@ -175,7 +176,11 @@ public class MockApps {
       @Override
       public void setFinishTime(long finishTime) {
         // TODO Auto-generated method stub
-        
+
+      }
+      @Override
+      public void setFinalApplicationStatus(FinalApplicationStatus finishState) {
+		// TODO Auto-generated method stub
       }
     };
   }
@@ -194,9 +199,10 @@ public class MockApps {
     return id;
   }
 
-  public static ApplicationState newAppState() {
+  public static YarnApplicationState newAppState() {
     synchronized(STATES) {
       return STATES.next();
     }
   }
+
 }

Modified: hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/Context.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/Context.java?rev=1179484&r1=1179483&r2=1179484&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/Context.java (original)
+++ hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/Context.java Thu Oct  6 01:16:48 2011
@@ -23,6 +23,7 @@ import java.util.concurrent.ConcurrentMa
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 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.server.nodemanager.containermanager.application.Application;
 import org.apache.hadoop.yarn.server.nodemanager.containermanager.container.Container;
 
@@ -32,6 +33,13 @@ import org.apache.hadoop.yarn.server.nod
  */
 public interface Context {
 
+  /**
+   * Return the nodeId. Usable only when the ContainerManager is started.
+   * 
+   * @return the NodeId
+   */
+  NodeId getNodeId();
+
   ConcurrentMap<ApplicationId, Application> getApplications();
 
   ConcurrentMap<ContainerId, Container> getContainers();

Modified: hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java?rev=1179484&r1=1179483&r2=1179484&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java (original)
+++ hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeManager.java Thu Oct  6 01:16:48 2011
@@ -36,6 +36,7 @@ import org.apache.hadoop.yarn.YarnExcept
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 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.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.event.AsyncDispatcher;
 import org.apache.hadoop.yarn.event.Dispatcher;
@@ -48,6 +49,7 @@ import org.apache.hadoop.yarn.server.nod
 import org.apache.hadoop.yarn.server.security.ContainerTokenSecretManager;
 import org.apache.hadoop.yarn.service.CompositeService;
 import org.apache.hadoop.yarn.service.Service;
+import org.apache.hadoop.yarn.util.Records;
 
 public class NodeManager extends CompositeService {
   private static final Log LOG = LogFactory.getLog(NodeManager.class);
@@ -161,6 +163,7 @@ public class NodeManager extends Composi
 
   public static class NMContext implements Context {
 
+    private final NodeId nodeId = Records.newRecord(NodeId.class);
     private final ConcurrentMap<ApplicationId, Application> applications =
         new ConcurrentHashMap<ApplicationId, Application>();
     private final ConcurrentMap<ContainerId, Container> containers =
@@ -175,6 +178,14 @@ public class NodeManager extends Composi
       this.nodeHealthStatus.setLastHealthReportTime(System.currentTimeMillis());
     }
 
+    /**
+     * Usable only after ContainerManager is started.
+     */
+    @Override
+    public NodeId getNodeId() {
+      return this.nodeId;
+    }
+
     @Override
     public ConcurrentMap<ApplicationId, Application> getApplications() {
       return this.applications;

Modified: hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeStatusUpdater.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeStatusUpdater.java?rev=1179484&r1=1179483&r2=1179484&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeStatusUpdater.java (original)
+++ hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeStatusUpdater.java Thu Oct  6 01:16:48 2011
@@ -24,8 +24,5 @@ public interface NodeStatusUpdater exten
 
   byte[] getRMNMSharedSecret();
 
-  String getContainerManagerBindAddress();
-
   void sendOutofBandHeartBeat();
-
 }

Modified: hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeStatusUpdaterImpl.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeStatusUpdaterImpl.java?rev=1179484&r1=1179483&r2=1179484&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeStatusUpdaterImpl.java (original)
+++ hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/NodeStatusUpdaterImpl.java Thu Oct  6 01:16:48 2011
@@ -18,7 +18,6 @@
 
 package org.apache.hadoop.yarn.server.nodemanager;
 
-import java.net.InetAddress;
 import java.net.InetSocketAddress;
 import java.util.ArrayList;
 import java.util.Iterator;
@@ -57,7 +56,6 @@ import org.apache.hadoop.yarn.server.nod
 import org.apache.hadoop.yarn.server.nodemanager.metrics.NodeManagerMetrics;
 import org.apache.hadoop.yarn.server.security.ContainerTokenSecretManager;
 import org.apache.hadoop.yarn.service.AbstractService;
-import org.apache.hadoop.yarn.util.Records;
 
 public class NodeStatusUpdaterImpl extends AbstractService implements
     NodeStatusUpdater {
@@ -69,16 +67,13 @@ public class NodeStatusUpdaterImpl exten
   private final Context context;
   private final Dispatcher dispatcher;
 
+  private NodeId nodeId;
   private ContainerTokenSecretManager containerTokenSecretManager;
   private long heartBeatInterval;
   private ResourceTracker resourceTracker;
   private String rmAddress;
   private Resource totalResource;
-  private String containerManagerBindAddress;
-  private String hostName;
-  private int containerManagerPort;
   private int httpPort;
-  private NodeId nodeId;
   private byte[] secretKeyBytes = new byte[0];
   private boolean isStopped;
   private RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
@@ -114,24 +109,18 @@ public class NodeStatusUpdaterImpl exten
 
   @Override
   public void start() {
-    String cmBindAddressStr =
-        getConfig().get(YarnConfiguration.NM_ADDRESS,
-            YarnConfiguration.DEFAULT_NM_ADDRESS);
-    InetSocketAddress cmBindAddress =
-        NetUtils.createSocketAddr(cmBindAddressStr);
+
+    // NodeManager is the last service to start, so NodeId is available.
+    this.nodeId = this.context.getNodeId();
+
     String httpBindAddressStr =
       getConfig().get(YarnConfiguration.NM_WEBAPP_ADDRESS,
           YarnConfiguration.DEFAULT_NM_WEBAPP_ADDRESS);
     InetSocketAddress httpBindAddress =
       NetUtils.createSocketAddr(httpBindAddressStr);
     try {
-      this.hostName = InetAddress.getLocalHost().getHostAddress();
-      this.containerManagerPort = cmBindAddress.getPort();
+      //      this.hostName = InetAddress.getLocalHost().getCanonicalHostName();
       this.httpPort = httpBindAddress.getPort();
-      this.containerManagerBindAddress =
-          this.hostName + ":" + this.containerManagerPort;
-      LOG.info("Configured ContainerManager Address is "
-          + this.containerManagerBindAddress);
       // Registration has to be in start so that ContainerManager can get the
       // perNM tokens needed to authenticate ContainerTokens.
       registerWithRM();
@@ -150,14 +139,11 @@ public class NodeStatusUpdaterImpl exten
   }
 
   protected ResourceTracker getRMClient() {
-    YarnRPC rpc = YarnRPC.create(getConfig());
+    Configuration conf = getConfig();
+    YarnRPC rpc = YarnRPC.create(conf);
     InetSocketAddress rmAddress = NetUtils.createSocketAddr(this.rmAddress);
-    Configuration rmClientConf = new Configuration(getConfig());
-    rmClientConf.setClass(
-        YarnConfiguration.YARN_SECURITY_INFO,
-        RMNMSecurityInfoClass.class, SecurityInfo.class);
     return (ResourceTracker) rpc.getProxy(ResourceTracker.class, rmAddress,
-        rmClientConf);
+        conf);
   }
 
   private void registerWithRM() throws YarnRemoteException {
@@ -165,9 +151,6 @@ public class NodeStatusUpdaterImpl exten
     LOG.info("Connected to ResourceManager at " + this.rmAddress);
     
     RegisterNodeManagerRequest request = recordFactory.newRecordInstance(RegisterNodeManagerRequest.class);
-    this.nodeId = Records.newRecord(NodeId.class);
-    this.nodeId.setHost(this.hostName);
-    this.nodeId.setPort(this.containerManagerPort);
     request.setHttpPort(this.httpPort);
     request.setResource(this.totalResource);
     request.setNodeId(this.nodeId);
@@ -183,20 +166,15 @@ public class NodeStatusUpdaterImpl exten
       // It is expected that status updater is started by this point and
       // RM gives the shared secret in registration during StatusUpdater#start().
       this.containerTokenSecretManager.setSecretKey(
-          this.getContainerManagerBindAddress(),
+          this.nodeId.toString(),
           this.getRMNMSharedSecret());
     }
-    LOG.info("Registered with ResourceManager as " + this.containerManagerBindAddress
+    LOG.info("Registered with ResourceManager as " + this.nodeId
         + " with total resource of " + this.totalResource);
 
   }
 
   @Override
-  public String getContainerManagerBindAddress() {
-    return this.containerManagerBindAddress;
-  }
-
-  @Override
   public byte[] getRMNMSharedSecret() {
     return this.secretKeyBytes.clone();
   }
@@ -230,8 +208,8 @@ public class NodeStatusUpdaterImpl exten
     }
     nodeStatus.setContainersStatuses(containersStatuses);
 
-    LOG.debug(this.containerManagerBindAddress + " sending out status for " + numActiveContainers
-        + " containers");
+    LOG.debug(this.nodeId + " sending out status for "
+        + numActiveContainers + " containers");
 
     NodeHealthStatus nodeHealthStatus = this.context.getNodeHealthStatus();
     if (this.healthChecker != null) {

Modified: hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/ContainerManagerImpl.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/ContainerManagerImpl.java?rev=1179484&r1=1179483&r2=1179484&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/ContainerManagerImpl.java (original)
+++ hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/ContainerManagerImpl.java Thu Oct  6 01:16:48 2011
@@ -21,7 +21,9 @@ package org.apache.hadoop.yarn.server.no
 import static org.apache.hadoop.yarn.service.Service.STATE.STARTED;
 
 import java.io.IOException;
+import java.net.InetAddress;
 import java.net.InetSocketAddress;
+import java.net.UnknownHostException;
 import java.nio.ByteBuffer;
 import java.util.Map;
 
@@ -36,6 +38,7 @@ import org.apache.hadoop.security.Securi
 import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.security.token.Token;
 import org.apache.hadoop.security.token.TokenIdentifier;
+import org.apache.hadoop.yarn.YarnException;
 import org.apache.hadoop.yarn.api.ContainerManager;
 import org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusRequest;
 import org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusResponse;
@@ -99,7 +102,6 @@ public class ContainerManagerImpl extend
   final Context context;
   private final ContainersMonitor containersMonitor;
   private Server server;
-  private InetSocketAddress cmBindAddressStr;
   private final ResourceLocalizationService rsrcLocalizationSrvc;
   private final ContainersLauncher containersLauncher;
   private final AuxServices auxiluaryServices;
@@ -144,7 +146,7 @@ public class ContainerManagerImpl extend
     addService(this.containersMonitor);
 
     LogAggregationService logAggregationService =
-        createLogAggregationService(this.deletionService);
+        createLogAggregationService(this.context, this.deletionService);
     addService(logAggregationService);
 
     dispatcher.register(ContainerEventType.class,
@@ -159,9 +161,9 @@ public class ContainerManagerImpl extend
     addService(dispatcher);
   }
 
-  protected LogAggregationService createLogAggregationService(
+  protected LogAggregationService createLogAggregationService(Context context,
       DeletionService deletionService) {
-    return new LogAggregationService(deletionService);
+    return new LogAggregationService(context, deletionService);
   }
 
   public ContainersMonitor getContainersMonitor() {
@@ -180,28 +182,32 @@ public class ContainerManagerImpl extend
   }
 
   @Override
-  public void init(Configuration conf) {
-    cmBindAddressStr = NetUtils.createSocketAddr(
-        conf.get(YarnConfiguration.NM_ADDRESS, YarnConfiguration.DEFAULT_NM_ADDRESS));
-    super.init(conf);
-  }
-
-  @Override
   public void start() {
 
     // Enqueue user dirs in deletion context
 
-    YarnRPC rpc = YarnRPC.create(getConfig());
-    Configuration cmConf = new Configuration(getConfig());
-    cmConf.setClass(YarnConfiguration.YARN_SECURITY_INFO,
-        ContainerManagerSecurityInfo.class, SecurityInfo.class);
+    Configuration conf = getConfig();
+    YarnRPC rpc = YarnRPC.create(conf);
+
+    InetSocketAddress initialAddress = NetUtils.createSocketAddr(conf.get(
+        YarnConfiguration.NM_ADDRESS, YarnConfiguration.DEFAULT_NM_ADDRESS));
+
     server =
-        rpc.getServer(ContainerManager.class, this, cmBindAddressStr, cmConf,
+        rpc.getServer(ContainerManager.class, this, initialAddress, conf,
             this.containerTokenSecretManager,
-            cmConf.getInt(YarnConfiguration.NM_CONTAINER_MGR_THREAD_COUNT, 
+            conf.getInt(YarnConfiguration.NM_CONTAINER_MGR_THREAD_COUNT, 
                 YarnConfiguration.DEFAULT_NM_CONTAINER_MGR_THREAD_COUNT));
-    LOG.info("ContainerManager started at " + cmBindAddressStr);
     server.start();
+    InetAddress hostNameResolved = null;
+    try {
+      hostNameResolved = InetAddress.getLocalHost();
+    } catch (UnknownHostException e) {
+      throw new YarnException(e);
+    }
+    this.context.getNodeId().setHost(hostNameResolved.getCanonicalHostName());
+    this.context.getNodeId().setPort(server.getPort());
+    LOG.info("ContainerManager started at "
+        + this.context.getNodeId().toString());
     super.start();
   }
 

Modified: hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/ContainerLocalizer.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/ContainerLocalizer.java?rev=1179484&r1=1179483&r2=1179484&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/ContainerLocalizer.java (original)
+++ hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/ContainerLocalizer.java Thu Oct  6 01:16:48 2011
@@ -114,15 +114,9 @@ public class ContainerLocalizer {
   }
 
   LocalizationProtocol getProxy(final InetSocketAddress nmAddr) {
-    Configuration localizerConf = new Configuration();
-    YarnRPC rpc = YarnRPC.create(localizerConf);
-    if (UserGroupInformation.isSecurityEnabled()) {
-      localizerConf.setClass(
-          YarnConfiguration.YARN_SECURITY_INFO,
-          LocalizerSecurityInfo.class, SecurityInfo.class);
-    }
+    YarnRPC rpc = YarnRPC.create(conf);
     return (LocalizationProtocol)
-      rpc.getProxy(LocalizationProtocol.class, nmAddr, localizerConf);
+      rpc.getProxy(LocalizationProtocol.class, nmAddr, conf);
   }
 
   public int runLocalization(final InetSocketAddress nmAddr)

Modified: hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/ResourceLocalizationService.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/ResourceLocalizationService.java?rev=1179484&r1=1179483&r2=1179484&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/ResourceLocalizationService.java (original)
+++ hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/ResourceLocalizationService.java Thu Oct  6 01:16:48 2011
@@ -227,13 +227,10 @@ public class ResourceLocalizationService
   }
 
   Server createServer() {
-    YarnRPC rpc = YarnRPC.create(getConfig());
-    Configuration conf = new Configuration(getConfig()); // Clone to separate
-                                                         // sec-info classes
+    Configuration conf = getConfig();
+    YarnRPC rpc = YarnRPC.create(conf);
     LocalizerTokenSecretManager secretManager = null;
     if (UserGroupInformation.isSecurityEnabled()) {
-      conf.setClass(YarnConfiguration.YARN_SECURITY_INFO,
-          LocalizerSecurityInfo.class, SecurityInfo.class);
       secretManager = new LocalizerTokenSecretManager();
     }
     

Modified: hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/LogAggregationService.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/LogAggregationService.java?rev=1179484&r1=1179483&r2=1179484&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/LogAggregationService.java (original)
+++ hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/LogAggregationService.java Thu Oct  6 01:16:48 2011
@@ -19,7 +19,6 @@
 package org.apache.hadoop.yarn.server.nodemanager.containermanager.logaggregation;
 
 import java.net.InetAddress;
-import java.net.InetSocketAddress;
 import java.net.UnknownHostException;
 import java.security.PrivilegedExceptionAction;
 import java.util.concurrent.ConcurrentHashMap;
@@ -32,7 +31,6 @@ import org.apache.commons.logging.LogFac
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.net.NetUtils;
 import org.apache.hadoop.security.Credentials;
 import org.apache.hadoop.security.UserGroupInformation;
 import org.apache.hadoop.security.token.Token;
@@ -42,6 +40,7 @@ import org.apache.hadoop.yarn.api.record
 import org.apache.hadoop.yarn.api.records.ContainerId;
 import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.event.EventHandler;
+import org.apache.hadoop.yarn.server.nodemanager.Context;
 import org.apache.hadoop.yarn.server.nodemanager.DeletionService;
 import org.apache.hadoop.yarn.server.nodemanager.containermanager.logaggregation.event.LogAggregatorEvent;
 import org.apache.hadoop.yarn.service.AbstractService;
@@ -53,6 +52,7 @@ public class LogAggregationService exten
   private static final Log LOG = LogFactory
       .getLog(LogAggregationService.class);
 
+  private final Context context;
   private final DeletionService deletionService;
 
   private String[] localRootLogDirs;
@@ -63,8 +63,10 @@ public class LogAggregationService exten
 
   private final ExecutorService threadPool;
 
-  public LogAggregationService(DeletionService deletionService) {
+  public LogAggregationService(Context context,
+      DeletionService deletionService) {
     super(LogAggregationService.class.getName());
+    this.context = context;
     this.deletionService = deletionService;
     this.appLogAggregators =
         new ConcurrentHashMap<ApplicationId, AppLogAggregator>();
@@ -82,16 +84,9 @@ public class LogAggregationService exten
 
   @Override
   public synchronized void start() {
-    String address =
-        getConfig().get(YarnConfiguration.NM_ADDRESS, YarnConfiguration.DEFAULT_NM_ADDRESS);
-    InetSocketAddress cmBindAddress = NetUtils.createSocketAddr(address);
-    try {
-      this.nodeFile =
-          InetAddress.getLocalHost().getHostAddress() + "_"
-              + cmBindAddress.getPort();
-    } catch (UnknownHostException e) {
-      throw new YarnException(e);
-    }
+    // NodeId is only available during start, the following cannot be moved
+    // anywhere else.
+    this.nodeFile = this.context.getNodeId().toString();
     super.start();
   }
 

Modified: hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/DummyContainerManager.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/DummyContainerManager.java?rev=1179484&r1=1179483&r2=1179484&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/DummyContainerManager.java (original)
+++ hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/DummyContainerManager.java Thu Oct  6 01:16:48 2011
@@ -144,9 +144,9 @@ public class DummyContainerManager exten
   }
 
   @Override
-  protected LogAggregationService createLogAggregationService(
+  protected LogAggregationService createLogAggregationService(Context context, 
       DeletionService deletionService) {
-    return new LogAggregationService(deletionService) {
+    return new LogAggregationService(context, deletionService) {
       @Override
       public void handle(LogAggregatorEvent event) {
         switch (event.getType()) {

Modified: hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeStatusUpdater.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeStatusUpdater.java?rev=1179484&r1=1179483&r2=1179484&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeStatusUpdater.java (original)
+++ hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeStatusUpdater.java Thu Oct  6 01:16:48 2011
@@ -104,7 +104,7 @@ public class TestNodeStatusUpdater {
       Resource resource = request.getResource();
       LOG.info("Registering " + nodeId.toString());
       try {
-        Assert.assertEquals(InetAddress.getLocalHost().getHostAddress()
+        Assert.assertEquals(InetAddress.getLocalHost().getCanonicalHostName()
             + ":12345", nodeId.toString());
       } catch (UnknownHostException e) {
         Assert.fail(e.getMessage());

Modified: hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/BaseContainerManagerTest.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/BaseContainerManagerTest.java?rev=1179484&r1=1179483&r2=1179484&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/BaseContainerManagerTest.java (original)
+++ hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/BaseContainerManagerTest.java Thu Oct  6 01:16:48 2011
@@ -29,7 +29,6 @@ import org.apache.hadoop.conf.Configurat
 import org.apache.hadoop.fs.FileContext;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.UnsupportedFileSystemException;
-import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem;
 import org.apache.hadoop.yarn.api.ContainerManager;
 import org.apache.hadoop.yarn.api.protocolrecords.GetContainerStatusRequest;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
@@ -41,7 +40,6 @@ import org.apache.hadoop.yarn.event.Asyn
 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.server.security.ContainerTokenSecretManager;
 import org.apache.hadoop.yarn.server.api.ResourceTracker;
 import org.apache.hadoop.yarn.server.nodemanager.ContainerExecutor;
 import org.apache.hadoop.yarn.server.nodemanager.Context;
@@ -54,6 +52,7 @@ import org.apache.hadoop.yarn.server.nod
 import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.Application;
 import org.apache.hadoop.yarn.server.nodemanager.containermanager.application.ApplicationState;
 import org.apache.hadoop.yarn.server.nodemanager.metrics.NodeManagerMetrics;
+import org.apache.hadoop.yarn.server.security.ContainerTokenSecretManager;
 import org.apache.hadoop.yarn.service.Service.STATE;
 import org.junit.After;
 import org.junit.Before;

Modified: hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/TestLogAggregationService.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/TestLogAggregationService.java?rev=1179484&r1=1179483&r2=1179484&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/TestLogAggregationService.java (original)
+++ hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/TestLogAggregationService.java Thu Oct  6 01:16:48 2011
@@ -98,7 +98,7 @@ public class TestLogAggregationService e
     this.conf.set(YarnConfiguration.NM_REMOTE_APP_LOG_DIR,
         this.remoteRootLogDir.getAbsolutePath());
     LogAggregationService logAggregationService =
-        new LogAggregationService(this.delSrvc);
+        new LogAggregationService(this.context, this.delSrvc);
     logAggregationService.init(this.conf);
     logAggregationService.start();
 
@@ -146,7 +146,7 @@ public class TestLogAggregationService e
     this.conf.set(YarnConfiguration.NM_REMOTE_APP_LOG_DIR,
         this.remoteRootLogDir.getAbsolutePath());
     LogAggregationService logAggregationService =
-        new LogAggregationService(this.delSrvc);
+        new LogAggregationService(this.context, this.delSrvc);
     logAggregationService.init(this.conf);
     logAggregationService.start();
 
@@ -179,7 +179,7 @@ public class TestLogAggregationService e
     this.conf.set(YarnConfiguration.NM_REMOTE_APP_LOG_DIR,
         this.remoteRootLogDir.getAbsolutePath());
     LogAggregationService logAggregationService =
-        new LogAggregationService(this.delSrvc);
+        new LogAggregationService(this.context, this.delSrvc);
     logAggregationService.init(this.conf);
     logAggregationService.start();
 

Modified: hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/AdminService.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/AdminService.java?rev=1179484&r1=1179483&r2=1179484&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/AdminService.java (original)
+++ hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/AdminService.java Thu Oct  6 01:16:48 2011
@@ -92,15 +92,12 @@ public class AdminService extends Abstra
   }
 
   public void start() {
-    YarnRPC rpc = YarnRPC.create(getConfig());
-    Configuration serverConf = new Configuration(getConfig());
-    serverConf.setClass(
-        YarnConfiguration.YARN_SECURITY_INFO,
-        SchedulerSecurityInfo.class, SecurityInfo.class);
+    Configuration conf = getConfig();
+    YarnRPC rpc = YarnRPC.create(conf);
     this.server =
       rpc.getServer(RMAdminProtocol.class, this, masterServiceAddress,
-          serverConf, null,
-          serverConf.getInt(YarnConfiguration.RM_ADMIN_CLIENT_THREAD_COUNT, 
+          conf, null,
+          conf.getInt(YarnConfiguration.RM_ADMIN_CLIENT_THREAD_COUNT, 
               YarnConfiguration.DEFAULT_RM_ADMIN_CLIENT_THREAD_COUNT));
     this.server.start();
     super.start();

Modified: hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ApplicationMasterService.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ApplicationMasterService.java?rev=1179484&r1=1179483&r2=1179484&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ApplicationMasterService.java (original)
+++ hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ApplicationMasterService.java Thu Oct  6 01:16:48 2011
@@ -75,7 +75,7 @@ public class ApplicationMasterService ex
       new ConcurrentHashMap<ApplicationAttemptId, AMResponse>();
   private final AMResponse reboot = recordFactory.newRecordInstance(AMResponse.class);
   private final RMContext rmContext;
-  
+
   public ApplicationMasterService(RMContext rmContext,
       ApplicationTokenSecretManager appTokenManager, YarnScheduler scheduler) {
     super(ApplicationMasterService.class.getName());
@@ -98,19 +98,17 @@ public class ApplicationMasterService ex
 
   @Override
   public void start() {
-    YarnRPC rpc = YarnRPC.create(getConfig());
-    Configuration serverConf = new Configuration(getConfig());
-    serverConf.setClass(YarnConfiguration.YARN_SECURITY_INFO,
-        SchedulerSecurityInfo.class, SecurityInfo.class);
+    Configuration conf = getConfig();
+    YarnRPC rpc = YarnRPC.create(conf);
     this.server =
       rpc.getServer(AMRMProtocol.class, this, masterServiceAddress,
-          serverConf, this.appTokenManager,
-          serverConf.getInt(YarnConfiguration.RM_SCHEDULER_CLIENT_THREAD_COUNT, 
+          conf, this.appTokenManager,
+          conf.getInt(YarnConfiguration.RM_SCHEDULER_CLIENT_THREAD_COUNT, 
               YarnConfiguration.DEFAULT_RM_SCHEDULER_CLIENT_THREAD_COUNT));
     this.server.start();
     super.start();
   }
-  
+
   @Override
   public RegisterApplicationMasterResponse registerApplicationMaster(
       RegisterApplicationMasterRequest request) throws YarnRemoteException {
@@ -123,7 +121,7 @@ public class ApplicationMasterService ex
       String message = "Application doesn't exist in cache "
           + applicationAttemptId;
       LOG.error(message);
-      RMAuditLogger.logFailure(this.rmContext.getRMApps().get(appID).getUser(), 
+      RMAuditLogger.logFailure(this.rmContext.getRMApps().get(appID).getUser(),
           AuditConstants.REGISTER_AM, message, "ApplicationMasterService",
           "Error in registering application master", appID,
           applicationAttemptId);
@@ -141,7 +139,7 @@ public class ApplicationMasterService ex
               .getHost(), request.getRpcPort(), request.getTrackingUrl()));
 
       RMAuditLogger.logSuccess(this.rmContext.getRMApps().get(appID).getUser(),
-          AuditConstants.REGISTER_AM, "ApplicationMasterService", appID, 
+          AuditConstants.REGISTER_AM, "ApplicationMasterService", appID,
           applicationAttemptId);
 
       // Pick up min/max resource from scheduler...
@@ -176,7 +174,7 @@ public class ApplicationMasterService ex
 
       rmContext.getDispatcher().getEventHandler().handle(
           new RMAppAttemptUnregistrationEvent(applicationAttemptId, request
-              .getTrackingUrl(), request.getFinalState(), request
+              .getTrackingUrl(), request.getFinalApplicationStatus(), request
               .getDiagnostics()));
 
       FinishApplicationMasterResponse response = recordFactory
@@ -225,7 +223,7 @@ public class ApplicationMasterService ex
       List<ContainerId> release = request.getReleaseList();
 
       // Send new requests to appAttempt.
-      Allocation allocation = 
+      Allocation allocation =
           this.rScheduler.allocate(appAttemptId, ask, release);
 
       RMApp app = this.rmContext.getRMApps().get(appAttemptId.getApplicationId());

Modified: hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java?rev=1179484&r1=1179483&r2=1179484&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java (original)
+++ hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ClientRMService.java Thu Oct  6 01:16:48 2011
@@ -125,16 +125,13 @@ public class ClientRMService extends Abs
   public void start() {
     // All the clients to appsManager are supposed to be authenticated via
     // Kerberos if security is enabled, so no secretManager.
-    YarnRPC rpc = YarnRPC.create(getConfig());
-    Configuration clientServerConf = new Configuration(getConfig());
-    clientServerConf.setClass(
-        YarnConfiguration.YARN_SECURITY_INFO,
-        ClientRMSecurityInfo.class, SecurityInfo.class);
+    Configuration conf = getConfig();
+    YarnRPC rpc = YarnRPC.create(conf);
     this.server =   
       rpc.getServer(ClientRMProtocol.class, this,
             clientBindAddress,
-            clientServerConf, null,
-            clientServerConf.getInt(YarnConfiguration.RM_CLIENT_THREAD_COUNT, 
+            conf, null,
+            conf.getInt(YarnConfiguration.RM_CLIENT_THREAD_COUNT, 
                 YarnConfiguration.DEFAULT_RM_CLIENT_THREAD_COUNT));
     this.server.start();
     super.start();
@@ -351,7 +348,7 @@ public class ClientRMService extends Abs
     report.setNodeHealthStatus(rmNode.getNodeHealthStatus());
     org.apache.hadoop.yarn.server.resourcemanager.scheduler.SchedulerNodeReport schedulerNodeReport = scheduler
         .getNodeReport(rmNode.getNodeID());
-    report.setUsed(schedulerNodeReport.getUsedResources());
+    report.setUsed(schedulerNodeReport.getUsedResource());
     report.setNumContainers(schedulerNodeReport.getNumContainers());
     return report;
   }

Modified: hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceTrackerService.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceTrackerService.java?rev=1179484&r1=1179483&r2=1179484&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceTrackerService.java (original)
+++ hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/ResourceTrackerService.java Thu Oct  6 01:16:48 2011
@@ -109,15 +109,12 @@ public class ResourceTrackerService exte
     super.start();
     // ResourceTrackerServer authenticates NodeManager via Kerberos if
     // security is enabled, so no secretManager.
-    YarnRPC rpc = YarnRPC.create(getConfig());
-    Configuration rtServerConf = new Configuration(getConfig());
-    rtServerConf.setClass(
-        YarnConfiguration.YARN_SECURITY_INFO,
-        RMNMSecurityInfoClass.class, SecurityInfo.class);
+    Configuration conf = getConfig();
+    YarnRPC rpc = YarnRPC.create(conf);
     this.server =
       rpc.getServer(ResourceTracker.class, this, resourceTrackerAddress,
-          rtServerConf, null,
-          rtServerConf.getInt(YarnConfiguration.RM_RESOURCE_TRACKER_CLIENT_THREAD_COUNT, 
+          conf, null,
+          conf.getInt(YarnConfiguration.RM_RESOURCE_TRACKER_CLIENT_THREAD_COUNT, 
               YarnConfiguration.DEFAULT_RM_RESOURCE_TRACKER_CLIENT_THREAD_COUNT));
     this.server.start();
 

Modified: hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/amlauncher/AMLauncher.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/amlauncher/AMLauncher.java?rev=1179484&r1=1179483&r2=1179484&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/amlauncher/AMLauncher.java (original)
+++ hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/amlauncher/AMLauncher.java Thu Oct  6 01:16:48 2011
@@ -92,12 +92,9 @@ public class AMLauncher implements Runna
       ApplicationTokenSecretManager applicationTokenSecretManager,
       ClientToAMSecretManager clientToAMSecretManager, Configuration conf) {
     this.application = application;
-    this.conf = new Configuration(conf); // Just not to touch the sec-info class
+    this.conf = conf;
     this.applicationTokenSecretManager = applicationTokenSecretManager;
     this.clientToAMSecretManager = clientToAMSecretManager;
-    this.conf.setClass(
-        YarnConfiguration.YARN_SECURITY_INFO,
-        ContainerManagerSecurityInfo.class, SecurityInfo.class);
     this.eventType = eventType;
     this.handler = rmContext.getDispatcher().getEventHandler();
   }

Modified: hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMApp.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMApp.java?rev=1179484&r1=1179483&r2=1179484&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMApp.java (original)
+++ hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMApp.java Thu Oct  6 01:16:48 2011
@@ -20,6 +20,7 @@ package org.apache.hadoop.yarn.server.re
 
 import org.apache.hadoop.yarn.api.protocolrecords.FinishApplicationMasterRequest;
 import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
+import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.ApplicationReport;
 import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
@@ -28,8 +29,8 @@ import org.apache.hadoop.yarn.server.res
 import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttempt;
 
 /**
- * The read interface to an Application in the ResourceManager. Take a 
- * look at {@link RMAppImpl} for its implementation. This interface 
+ * The read interface to an Application in the ResourceManager. Take a
+ * look at {@link RMAppImpl} for its implementation. This interface
  * exposes methods to access various updates in application status/report.
  */
 public interface RMApp extends EventHandler<RMAppEvent> {
@@ -68,7 +69,7 @@ public interface RMApp extends EventHand
   RMAppAttempt getRMAppAttempt(ApplicationAttemptId appAttemptId);
 
   /**
-   * Each Application is submitted to a queue decided by {@link 
+   * Each Application is submitted to a queue decided by {@link
    * ApplicationSubmissionContext#setQueue(String)}.
    * This method returns the queue to which an application was submitted.
    * @return the queue to which the application was submitted to.
@@ -76,7 +77,7 @@ public interface RMApp extends EventHand
   String getQueue();
 
   /**
-   * The name of the application as set in {@link 
+   * The name of the application as set in {@link
    * ApplicationSubmissionContext#setApplicationName(String)}.
    * @return the name of the application.
    */
@@ -85,7 +86,7 @@ public interface RMApp extends EventHand
   /**
    * {@link RMApp} can have multiple application attempts {@link RMAppAttempt}.
    * This method returns the current {@link RMAppAttempt}.
-   * @return the current {@link RMAppAttempt} 
+   * @return the current {@link RMAppAttempt}
    */
   RMAppAttempt getCurrentAppAttempt();
 
@@ -96,7 +97,7 @@ public interface RMApp extends EventHand
   ApplicationReport createAndGetApplicationReport();
 
   /**
-   * Application level metadata is stored in {@link ApplicationStore} whicn 
+   * Application level metadata is stored in {@link ApplicationStore} whicn
    * can persist the information.
    * @return the {@link ApplicationStore}  for this {@link RMApp}.
    */
@@ -125,12 +126,12 @@ public interface RMApp extends EventHand
    * @return the diagnostics information for the application master.
    */
   StringBuilder getDiagnostics();
-  
+
   /**
-   * The final state of the AM when unregistering as in 
-   * {@link FinishApplicationMasterRequest#setFinalState(String)}.
-   * @return the final state of the AM as set in 
-   * {@link FinishApplicationMasterRequest#setFinalState(String)}.
+   * The final finish state of the AM when unregistering as in
+   * {@link FinishApplicationMasterRequest#setFinishApplicationStatus(FinalApplicationStatus)}.
+   * @return the final finish state of the AM as set in
+   * {@link FinishApplicationMasterRequest#setFinishApplicationStatus(FinalApplicationStatus)}.
    */
-  String getAMFinalState();
+  FinalApplicationStatus getFinalApplicationStatus();
 }

Modified: hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java?rev=1179484&r1=1179483&r2=1179484&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java (original)
+++ hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/RMAppImpl.java Thu Oct  6 01:16:48 2011
@@ -32,9 +32,10 @@ import org.apache.commons.logging.LogFac
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.yarn.YarnException;
 import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
+import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.ApplicationReport;
-import org.apache.hadoop.yarn.api.records.ApplicationState;
+import org.apache.hadoop.yarn.api.records.YarnApplicationState;
 import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
 import org.apache.hadoop.yarn.api.records.NodeId;
 import org.apache.hadoop.yarn.conf.YarnConfiguration;
@@ -94,7 +95,7 @@ public class RMAppImpl implements RMApp 
   private static final StateMachineFactory<RMAppImpl,
                                            RMAppState,
                                            RMAppEventType,
-                                           RMAppEvent> stateMachineFactory 
+                                           RMAppEvent> stateMachineFactory
                                = new StateMachineFactory<RMAppImpl,
                                            RMAppState,
                                            RMAppEventType,
@@ -160,7 +161,7 @@ public class RMAppImpl implements RMApp 
   public RMAppImpl(ApplicationId applicationId, RMContext rmContext,
       Configuration config, String name, String user, String queue,
       ApplicationSubmissionContext submissionContext, String clientTokenStr,
-      ApplicationStore appStore, 
+      ApplicationStore appStore,
       YarnScheduler scheduler, ApplicationMasterService masterService) {
 
     this.applicationId = applicationId;
@@ -194,18 +195,23 @@ public class RMAppImpl implements RMApp 
   }
 
   @Override
-  public String getAMFinalState() {
+  public FinalApplicationStatus getFinalApplicationStatus() {
     this.readLock.lock();
     try {
-      if (currentAttempt != null) {
-        return currentAttempt.getAMFinalState();
+      // finish state is obtained based on the state machine's current state 
+      // as a fall-back in case the application has not been unregistered 
+      // ( or if the app never unregistered itself )
+      // when the report is requested
+      if (currentAttempt != null 
+          && currentAttempt.getFinalApplicationStatus() != null) {
+        return currentAttempt.getFinalApplicationStatus();   
       }
-      return "UNKNOWN";
+      return createFinalApplicationStatus(this.stateMachine.getCurrentState());
     } finally {
       this.readLock.unlock();
     }
   }
-  
+
   @Override
   public RMAppState getState() {
     this.readLock.lock();
@@ -273,25 +279,43 @@ public class RMAppImpl implements RMApp 
     return this.appStore;
   }
 
-  private ApplicationState createApplicationState(RMAppState rmAppState) {
+  private YarnApplicationState createApplicationState(RMAppState rmAppState) {
     switch(rmAppState) {
     case NEW:
-      return ApplicationState.NEW;
+      return YarnApplicationState.NEW;
     case SUBMITTED:
     case ACCEPTED:
-      return ApplicationState.SUBMITTED;
+      return YarnApplicationState.SUBMITTED;
     case RUNNING:
-      return ApplicationState.RUNNING;
+      return YarnApplicationState.RUNNING;
     case FINISHED:
-      return ApplicationState.SUCCEEDED;
+      return YarnApplicationState.FINISHED;
     case KILLED:
-      return ApplicationState.KILLED;
+      return YarnApplicationState.KILLED;
+    case FAILED:
+      return YarnApplicationState.FAILED;
+    }
+    throw new YarnException("Unknown state passed!");
+  }
+
+  private FinalApplicationStatus createFinalApplicationStatus(RMAppState state) {
+    switch(state) {
+    case NEW:
+    case SUBMITTED:
+    case ACCEPTED:
+    case RUNNING:
+      return FinalApplicationStatus.UNDEFINED;    
+    // finished without a proper final state is the same as failed  
+    case FINISHED:
     case FAILED:
-      return ApplicationState.FAILED;
+      return FinalApplicationStatus.FAILED;
+    case KILLED:
+      return FinalApplicationStatus.KILLED;
     }
     throw new YarnException("Unknown state passed!");
   }
 
+  
   @Override
   public ApplicationReport createAndGetApplicationReport() {
     this.readLock.lock();
@@ -301,6 +325,7 @@ public class RMAppImpl implements RMApp 
       String trackingUrl = "N/A";
       String host = "N/A";
       int rpcPort = -1;
+      FinalApplicationStatus finishState = getFinalApplicationStatus();
       if (this.currentAttempt != null) {
         trackingUrl = this.currentAttempt.getTrackingUrl();
         clientToken = this.currentAttempt.getClientToken();
@@ -310,8 +335,8 @@ public class RMAppImpl implements RMApp 
       return BuilderUtils.newApplicationReport(this.applicationId, this.user,
           this.queue, this.name, host, rpcPort, clientToken,
           createApplicationState(this.stateMachine.getCurrentState()),
-          this.diagnostics.toString(), trackingUrl, 
-          this.startTime, this.finishTime);
+          this.diagnostics.toString(), trackingUrl,
+          this.startTime, this.finishTime, finishState);
     } finally {
       this.readLock.unlock();
     }
@@ -432,7 +457,7 @@ public class RMAppImpl implements RMApp 
     @SuppressWarnings("unchecked")
     @Override
     public void transition(RMAppImpl app, RMAppEvent event) {
-      app.handler.handle(new RMAppAttemptEvent(app.currentAttempt.getAppAttemptId(), 
+      app.handler.handle(new RMAppAttemptEvent(app.currentAttempt.getAppAttemptId(),
           RMAppAttemptEventType.KILL));
       super.transition(app, event);
     }
@@ -465,7 +490,7 @@ public class RMAppImpl implements RMApp 
       }
       app.finishTime = System.currentTimeMillis();
       app.handler.handle(
-          new RMAppManagerEvent(app.applicationId, 
+          new RMAppManagerEvent(app.applicationId,
           RMAppManagerEventType.APP_COMPLETED));
     };
   }
@@ -481,7 +506,7 @@ public class RMAppImpl implements RMApp 
 
     @Override
     public RMAppState transition(RMAppImpl app, RMAppEvent event) {
-      
+
       RMAppFailedAttemptEvent failedEvent = ((RMAppFailedAttemptEvent)event);
       if (app.attempts.size() == app.maxRetries) {
         String msg = "Application " + app.getApplicationId()
@@ -495,7 +520,7 @@ public class RMAppImpl implements RMApp 
         return RMAppState.FAILED;
       }
 
-      app.createNewAttempt();     
+      app.createNewAttempt();
       return initialState;
     }
 

Modified: hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttempt.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttempt.java?rev=1179484&r1=1179483&r2=1179484&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttempt.java (original)
+++ hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttempt.java Thu Oct  6 01:16:48 2011
@@ -22,6 +22,7 @@ import java.util.List;
 import java.util.Set;
 
 import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
+import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
 import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
 import org.apache.hadoop.yarn.api.records.Container;
 import org.apache.hadoop.yarn.api.records.ContainerStatus;
@@ -32,8 +33,8 @@ import org.apache.hadoop.yarn.server.res
 
 /**
  * Interface to an Application Attempt in the Resource Manager.
- * A {@link RMApp} can have multiple app attempts based on 
- * {@link YarnConfiguration#RM_AM_MAX_RETRIES}. For specific 
+ * A {@link RMApp} can have multiple app attempts based on
+ * {@link YarnConfiguration#RM_AM_MAX_RETRIES}. For specific
  * implementation take a look at {@link RMAppAttemptImpl}.
  */
 public interface RMAppAttempt extends EventHandler<RMAppAttemptEvent> {
@@ -49,7 +50,7 @@ public interface RMAppAttempt extends Ev
    * @return the state {@link RMAppAttemptState} of this {@link RMAppAttempt}
    */
   RMAppAttemptState getAppAttemptState();
-  
+
   /**
    * The host on which the {@link RMAppAttempt} is running/ran on.
    * @return the host on which the {@link RMAppAttempt} ran/is running on.
@@ -88,11 +89,12 @@ public interface RMAppAttempt extends Ev
   float getProgress();
 
   /**
-   * The final state set by the AM.
-   * @return the final state that is set by the AM when unregistering itself.
+   * The final status set by the AM.
+   * @return the final status that is set by the AM when unregistering itself. Can return a null 
+   * if the AM has not unregistered itself. 
    */
-  String getAMFinalState();
-  
+  FinalApplicationStatus getFinalApplicationStatus();
+
   /**
    * Nodes on which the containers for this {@link RMAppAttempt} ran.
    * @return the set of nodes that ran any containers from this {@link RMAppAttempt}
@@ -100,16 +102,16 @@ public interface RMAppAttempt extends Ev
   Set<NodeId> getRanNodes();
 
   /**
-   * Return a list of the last set of finished containers, resetting the 
+   * Return a list of the last set of finished containers, resetting the
    * finished containers to empty.
    * @return the list of just finished containers, re setting the finished containers.
    */
   List<ContainerStatus> pullJustFinishedContainers();
 
   /**
-   * Return the list of last set of finished containers. This does not reset the 
+   * Return the list of last set of finished containers. This does not reset the
    * finished containers.
-   * @return the list of just finished contianers, this does not reset the 
+   * @return the list of just finished contianers, this does not reset the
    * finished containers.
    */
   List<ContainerStatus> getJustFinishedContainers();

Modified: hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java?rev=1179484&r1=1179483&r2=1179484&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java (original)
+++ hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java Thu Oct  6 01:16:48 2011
@@ -31,6 +31,7 @@ import java.util.concurrent.locks.Reentr
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
+import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
 import org.apache.hadoop.yarn.api.records.Container;
@@ -99,9 +100,9 @@ public class RMAppAttemptImpl implements
   private final ApplicationSubmissionContext submissionContext;
 
   //nodes on while this attempt's containers ran
-  private final Set<NodeId> ranNodes = 
+  private final Set<NodeId> ranNodes =
     new HashSet<NodeId>();
-  private final List<ContainerStatus> justFinishedContainers = 
+  private final List<ContainerStatus> justFinishedContainers =
     new ArrayList<ContainerStatus>();
   private Container masterContainer;
 
@@ -109,7 +110,9 @@ public class RMAppAttemptImpl implements
   private String host = "N/A";
   private int rpcPort;
   private String trackingUrl = "N/A";
-  private String finalState = "N/A";
+  // Set to null initially. Will eventually get set 
+  // if an RMAppAttemptUnregistrationEvent occurs
+  private FinalApplicationStatus finalStatus = null;
   private final StringBuilder diagnostics = new StringBuilder();
 
   private static final StateMachineFactory<RMAppAttemptImpl,
@@ -150,7 +153,7 @@ public class RMAppAttemptImpl implements
       .addTransition(RMAppAttemptState.ALLOCATED,
           RMAppAttemptState.ALLOCATED,
           RMAppAttemptEventType.CONTAINER_ACQUIRED,
-          new ContainerAcquiredTransition())       
+          new ContainerAcquiredTransition())
       .addTransition(RMAppAttemptState.ALLOCATED, RMAppAttemptState.LAUNCHED,
           RMAppAttemptEventType.LAUNCHED, new AMLaunchedTransition())
       .addTransition(RMAppAttemptState.ALLOCATED, RMAppAttemptState.FAILED,
@@ -266,12 +269,12 @@ public class RMAppAttemptImpl implements
   public ApplicationSubmissionContext getSubmissionContext() {
     return this.submissionContext;
   }
-  
+
   @Override
-  public String getAMFinalState() {
+  public FinalApplicationStatus getFinalApplicationStatus() {
     this.readLock.lock();
     try {
-      return this.finalState;
+      return this.finalStatus;
     } finally {
       this.readLock.unlock();
     }
@@ -430,9 +433,9 @@ public class RMAppAttemptImpl implements
 
     @Override
     public void transition(RMAppAttemptImpl appAttempt,
-        RMAppAttemptEvent event) {      
+        RMAppAttemptEvent event) {
     }
-    
+
   }
 
   private static final class AttemptStartedTransition extends BaseTransition {
@@ -459,23 +462,23 @@ public class RMAppAttemptImpl implements
         RMAppAttemptEvent event) {
 
       RMAppAttemptRejectedEvent rejectedEvent = (RMAppAttemptRejectedEvent) event;
-      
+
       // Save the diagnostic message
       String message = rejectedEvent.getMessage();
       appAttempt.setDiagnostics(message);
-      
+
       // Send the rejection event to app
       appAttempt.eventHandler.handle(
           new RMAppRejectedEvent(
-              rejectedEvent.getApplicationAttemptId().getApplicationId(), 
+              rejectedEvent.getApplicationAttemptId().getApplicationId(),
               message)
           );
     }
   }
 
-  private static final List<ContainerId> EMPTY_CONTAINER_RELEASE_LIST = 
+  private static final List<ContainerId> EMPTY_CONTAINER_RELEASE_LIST =
       new ArrayList<ContainerId>();
-  private static final List<ResourceRequest> EMPTY_CONTAINER_REQUEST_LIST = 
+  private static final List<ResourceRequest> EMPTY_CONTAINER_REQUEST_LIST =
     new ArrayList<ResourceRequest>();
 
   private static final class ScheduleTransition extends BaseTransition {
@@ -540,23 +543,23 @@ public class RMAppAttemptImpl implements
       switch (finalAttemptState) {
         case FINISHED:
         {
-          appEvent = 
+          appEvent =
               new RMAppEvent(applicationId, RMAppEventType.ATTEMPT_FINISHED);
         }
         break;
         case KILLED:
         {
-          appEvent = 
-              new RMAppFailedAttemptEvent(applicationId, 
-                  RMAppEventType.ATTEMPT_KILLED, 
+          appEvent =
+              new RMAppFailedAttemptEvent(applicationId,
+                  RMAppEventType.ATTEMPT_KILLED,
                   "Application killed by user.");
         }
         break;
         case FAILED:
         {
-          appEvent = 
-              new RMAppFailedAttemptEvent(applicationId, 
-                  RMAppEventType.ATTEMPT_FAILED, 
+          appEvent =
+              new RMAppFailedAttemptEvent(applicationId,
+                  RMAppEventType.ATTEMPT_FAILED,
                   appAttempt.getDiagnostics());
         }
         break;
@@ -566,7 +569,7 @@ public class RMAppAttemptImpl implements
         }
         break;
       }
-      
+
       appAttempt.eventHandler.handle(appEvent);
       appAttempt.eventHandler.handle(new AppRemovedSchedulerEvent(appAttempt
           .getAppAttemptId(), finalAttemptState));
@@ -657,7 +660,7 @@ public class RMAppAttemptImpl implements
 
       RMAppAttemptContainerFinishedEvent finishEvent =
           ((RMAppAttemptContainerFinishedEvent)event);
-      
+
       // UnRegister from AMLivelinessMonitor
       appAttempt.rmContext.getAMLivelinessMonitor().unregister(
           appAttempt.getAppAttemptId());
@@ -666,7 +669,7 @@ public class RMAppAttemptImpl implements
       ContainerStatus status = finishEvent.getContainerStatus();
       appAttempt.diagnostics.append("AM Container for " +
           appAttempt.getAppAttemptId() + " exited with " +
-          " exitCode: " + status.getExitStatus() + 
+          " exitCode: " + status.getExitStatus() +
           " due to: " +  status.getDiagnostics() + "." +
           "Failing this attempt.");
 
@@ -730,10 +733,9 @@ public class RMAppAttemptImpl implements
 
       RMAppAttemptUnregistrationEvent unregisterEvent
         = (RMAppAttemptUnregistrationEvent) event;
-      unregisterEvent.getFinalState();
       appAttempt.diagnostics.append(unregisterEvent.getDiagnostics());
       appAttempt.trackingUrl = unregisterEvent.getTrackingUrl();
-      appAttempt.finalState = unregisterEvent.getFinalState();
+      appAttempt.finalStatus = unregisterEvent.getFinalApplicationStatus();
 
       // Tell the app and the scheduler
       super.transition(appAttempt, event);
@@ -761,7 +763,7 @@ public class RMAppAttemptImpl implements
 
       RMAppAttemptContainerFinishedEvent containerFinishedEvent
         = (RMAppAttemptContainerFinishedEvent) event;
-      ContainerStatus containerStatus = 
+      ContainerStatus containerStatus =
           containerFinishedEvent.getContainerStatus();
 
       // Is this container the AmContainer? If the finished container is same as
@@ -771,7 +773,7 @@ public class RMAppAttemptImpl implements
         // Setup diagnostic message
         appAttempt.diagnostics.append("AM Container for " +
             appAttempt.getAppAttemptId() + " exited with " +
-            " exitCode: " + containerStatus.getExitStatus() + 
+            " exitCode: " + containerStatus.getExitStatus() +
             " due to: " +  containerStatus.getDiagnostics() + "." +
             "Failing this attempt.");
 

Modified: hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/event/RMAppAttemptUnregistrationEvent.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/event/RMAppAttemptUnregistrationEvent.java?rev=1179484&r1=1179483&r2=1179484&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/event/RMAppAttemptUnregistrationEvent.java (original)
+++ hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/event/RMAppAttemptUnregistrationEvent.java Thu Oct  6 01:16:48 2011
@@ -19,20 +19,21 @@
 package org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.event;
 
 import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
+import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
 import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptEvent;
 import org.apache.hadoop.yarn.server.resourcemanager.rmapp.attempt.RMAppAttemptEventType;
 
 public class RMAppAttemptUnregistrationEvent extends RMAppAttemptEvent {
 
   private final String trackingUrl;
-  private final String finalState;
+  private final FinalApplicationStatus finalStatus;
   private final String diagnostics;
 
   public RMAppAttemptUnregistrationEvent(ApplicationAttemptId appAttemptId,
-      String trackingUrl, String finalState, String diagnostics) {
+      String trackingUrl, FinalApplicationStatus finalStatus, String diagnostics) {
     super(appAttemptId, RMAppAttemptEventType.UNREGISTERED);
     this.trackingUrl = trackingUrl;
-    this.finalState = finalState;
+    this.finalStatus = finalStatus;
     this.diagnostics = diagnostics;
   }
 
@@ -40,12 +41,12 @@ public class RMAppAttemptUnregistrationE
     return this.trackingUrl;
   }
 
-  public String getFinalState() {
-    return this.finalState;
+  public FinalApplicationStatus getFinalApplicationStatus() {
+    return this.finalStatus;
   }
 
   public String getDiagnostics() {
     return this.diagnostics;
   }
 
-}
\ No newline at end of file
+}

Modified: hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/QueueMetrics.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/QueueMetrics.java?rev=1179484&r1=1179483&r2=1179484&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/QueueMetrics.java (original)
+++ hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/QueueMetrics.java Thu Oct  6 01:16:48 2011
@@ -110,7 +110,7 @@ public class QueueMetrics {
         "Metrics for queue: " + queueName, metrics);
   }
 
-  synchronized QueueMetrics getUserMetrics(String userName) {
+  public synchronized QueueMetrics getUserMetrics(String userName) {
     if (users == null) {
       return null;
     }
@@ -280,27 +280,27 @@ public class QueueMetrics {
       parent.unreserveResource(user, res);
     }
   }
-  
+
   public int getAppsSubmitted() {
     return appsSubmitted.value();
   }
-  
+
   public int getAppsRunning() {
     return appsRunning.value();
   }
-  
+
   public int getAppsPending() {
     return appsPending.value();
   }
-  
+
   public int getAppsCompleted() {
     return appsCompleted.value();
   }
-  
+
   public int getAppsKilled() {
     return appsKilled.value();
   }
-  
+
   public int getAppsFailed() {
     return appsFailed.value();
   }
@@ -312,7 +312,7 @@ public class QueueMetrics {
   public int getAllocatedContainers() {
     return allocatedContainers.value();
   }
-  
+
   public int getAvailableGB() {
     return availableGB.value();
   }  

Modified: hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerApp.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerApp.java?rev=1179484&r1=1179483&r2=1179484&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerApp.java (original)
+++ hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerApp.java Thu Oct  6 01:16:48 2011
@@ -136,6 +136,10 @@ public class SchedulerApp {
     return this.appSchedulingInfo.getResource(priority);
   }
 
+  /**
+   * Is this application pending?
+   * @return true if it is else false.
+   */
   public boolean isPending() {
     return this.appSchedulingInfo.isPending();
   }
@@ -144,6 +148,10 @@ public class SchedulerApp {
     return this.appSchedulingInfo.getQueueName();
   }
 
+  /**
+   * Get the list of live containers
+   * @return All of the live containers
+   */
   public synchronized Collection<RMContainer> getLiveContainers() {
     return new ArrayList<RMContainer>(liveContainers.values());
   }
@@ -419,7 +427,11 @@ public class SchedulerApp {
     return Math.min(((float)requiredResources / clusterNodes), 1.0f);
   }
 
-  public synchronized List<RMContainer> getAllReservedContainers() {
+  /**
+   * Get the list of reserved containers
+   * @return All of the reserved containers.
+   */
+  public synchronized List<RMContainer> getReservedContainers() {
     List<RMContainer> reservedContainers = new ArrayList<RMContainer>();
     for (Map.Entry<Priority, Map<NodeId, RMContainer>> e : 
       this.reservedContainers.entrySet()) {
@@ -447,5 +459,4 @@ public class SchedulerApp {
   public Queue getQueue() {
     return queue;
   }
-
 }

Modified: hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerNodeReport.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerNodeReport.java?rev=1179484&r1=1179483&r2=1179484&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerNodeReport.java (original)
+++ hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerNodeReport.java Thu Oct  6 01:16:48 2011
@@ -28,19 +28,34 @@ import org.apache.hadoop.yarn.api.record
 @Private
 @Stable
 public class SchedulerNodeReport {
-  private final Resource usedResources;
-  private final int numContainers;
+  private final Resource used;
+  private final Resource avail;
+  private final int num;
   
-  public SchedulerNodeReport(Resource used, int numContainers) {
-    this.usedResources = used;
-    this.numContainers = numContainers;
+  public SchedulerNodeReport(SchedulerNode node) {
+    this.used = node.getUsedResource();
+    this.avail = node.getAvailableResource();
+    this.num = node.getNumContainers();
+  }
+  
+  /**
+   * @return the amount of resources currently used by the node.
+   */
+  public Resource getUsedResource() {
+    return used;
   }
 
-  public Resource getUsedResources() {
-    return usedResources;
+  /**
+   * @return the amount of resources currently available on the node
+   */
+  public Resource getAvailableResource() {
+    return avail;
   }
 
+  /**
+   * @return the number of containers currently running on this node.
+   */
   public int getNumContainers() {
-    return numContainers;
+    return num;
   }
 }

Modified: hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/YarnScheduler.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/YarnScheduler.java?rev=1179484&r1=1179483&r2=1179484&view=diff
==============================================================================
--- hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/YarnScheduler.java (original)
+++ hadoop/common/branches/HDFS-1623/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/YarnScheduler.java Thu Oct  6 01:16:48 2011
@@ -21,8 +21,9 @@ package org.apache.hadoop.yarn.server.re
 import java.io.IOException;
 import java.util.List;
 
-import org.apache.hadoop.classification.InterfaceAudience.Private;
+import org.apache.hadoop.classification.InterfaceAudience.LimitedPrivate;
 import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Evolving;
 import org.apache.hadoop.classification.InterfaceStability.Stable;
 import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
 import org.apache.hadoop.yarn.api.records.ContainerId;
@@ -57,7 +58,6 @@ public interface YarnScheduler extends E
   /**
    * Get acls for queues for current user.
    * @return acls for queues for current user
-   * @throws IOException
    */
   @Public
   @Stable
@@ -99,28 +99,27 @@ public interface YarnScheduler extends E
   /**
    * Get node resource usage report.
    * @param nodeId
-   * @return the {@link SchedulerNodeReport} for the node
+   * @return the {@link SchedulerNodeReport} for the node or null
+   * if nodeId does not point to a defined node.
    */
-  @Private
+  @LimitedPrivate("yarn")
   @Stable
   public SchedulerNodeReport getNodeReport(NodeId nodeId);
   
   /**
-   * Get used resources on the node
-   * @param nodeId node
-   * @return used resources on the node
+   * Get the Scheduler app for a given app attempt Id.
+   * @param appAttemptId the id of the application attempt
+   * @return SchedulerApp for this given attempt.
    */
-  @Private
+  @LimitedPrivate("yarn")
   @Stable
-  Resource getUsedResource(NodeId nodeId);
+  SchedulerAppReport getSchedulerAppInfo(ApplicationAttemptId appAttemptId);
 
   /**
-   * Get available resources on the node
-   * @param nodeId node
-   * @return available resources on the node
+   * Get the root queue for the scheduler.
+   * @return the root queue for the scheduler.
    */
-  @Private
-  @Stable
-  Resource getAvailableResource(NodeId nodeId);
-  
+  @LimitedPrivate("yarn")
+  @Evolving
+  QueueMetrics getRootQueueMetrics();
 }



Mime
View raw message