hadoop-mapreduce-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acmur...@apache.org
Subject svn commit: r1169980 [2/3] - in /hadoop/common/trunk/hadoop-mapreduce-project: ./ hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/main/java/org/apache/hadoop/mapreduce/v2/app/job/impl/ hadoop-mapreduce-client/hadoop-mapreduce-client-app/src/mai...
Date Tue, 13 Sep 2011 00:05:53 GMT
Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerLaunchContextPBImpl.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerLaunchContextPBImpl.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerLaunchContextPBImpl.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerLaunchContextPBImpl.java Tue Sep 13 00:05:51 2011
@@ -41,8 +41,11 @@ import org.apache.hadoop.yarn.proto.Yarn
 
 
     
-public class ContainerLaunchContextPBImpl extends ProtoBase<ContainerLaunchContextProto> implements ContainerLaunchContext {
-  ContainerLaunchContextProto proto = ContainerLaunchContextProto.getDefaultInstance();
+public class ContainerLaunchContextPBImpl 
+extends ProtoBase<ContainerLaunchContextProto> 
+implements ContainerLaunchContext {
+  ContainerLaunchContextProto proto = 
+      ContainerLaunchContextProto.getDefaultInstance();
   ContainerLaunchContextProto.Builder builder = null;
   boolean viaProto = false;
   
@@ -72,10 +75,14 @@ public class ContainerLaunchContextPBImp
   }
   
   private void mergeLocalToBuilder() {
-    if (this.containerId != null && !((ContainerIdPBImpl)containerId).getProto().equals(builder.getContainerId())) {
+    if (this.containerId != null && 
+        !((ContainerIdPBImpl)containerId).getProto().equals(
+            builder.getContainerId())) {
       builder.setContainerId(convertToProtoFormat(this.containerId));
     }
-    if (this.resource != null && !((ResourcePBImpl)this.resource).getProto().equals(builder.getResource())) {
+    if (this.resource != null && 
+        !((ResourcePBImpl)this.resource).getProto().equals(
+            builder.getResource())) {
       builder.setResource(convertToProtoFormat(this.resource));
     }
     if (this.localResources != null) {
@@ -131,22 +138,13 @@ public class ContainerLaunchContextPBImp
       builder.clearResource();
     this.resource = resource;
   }
+  
   @Override
-  public List<String> getCommandList() {
+  public List<String> getCommands() {
     initCommands();
     return this.commands;
   }
-  @Override
-  public String getCommand(int index) {
-    initCommands();
-    return this.commands.get(index);
-  }
-  @Override
-  public int getCommandCount() {
-    initCommands();
-    return this.commands.size();
-  }
-  
+
   private void initCommands() {
     if (this.commands != null) {
       return;
@@ -161,11 +159,12 @@ public class ContainerLaunchContextPBImp
   }
   
   @Override
-  public void addAllCommands(final List<String> command) {
-    if (command == null)
+  public void setCommands(final List<String> commands) {
+    if (commands == null)
       return;
     initCommands();
-    this.commands.addAll(command);
+    this.commands.clear();
+    this.commands.addAll(commands);
   }
   
   private void addCommandsToProto() {
@@ -175,21 +174,7 @@ public class ContainerLaunchContextPBImp
       return;
     builder.addAllCommand(this.commands);
   }
-  @Override
-  public void addCommand(String command) {
-    initCommands();
-    this.commands.add(command);
-  }
-  @Override
-  public void removeCommand(int index) {
-    initCommands();
-    this.commands.remove(index);
-  }
-  @Override
-  public void clearCommands() {
-    initCommands();
-    this.commands.clear();
-  }
+  
   @Override
   public String getUser() {
     ContainerLaunchContextProtoOrBuilder p = viaProto ? proto : builder;
@@ -228,17 +213,13 @@ public class ContainerLaunchContextPBImp
       builder.clearContainerId();
     this.containerId = containerId;
   }
+  
   @Override
-  public Map<String, LocalResource> getAllLocalResources() {
+  public Map<String, LocalResource> getLocalResources() {
     initLocalResources();
     return this.localResources;
   }
-  @Override
-  public LocalResource getLocalResource(String key) {
-    initLocalResources();
-    return this.localResources.get(key);
-  }
-  
+
   private void initLocalResources() {
     if (this.localResources != null) {
       return;
@@ -253,10 +234,12 @@ public class ContainerLaunchContextPBImp
   }
   
   @Override
-  public void addAllLocalResources(final Map<String, LocalResource> localResources) {
+  public void setLocalResources(
+      final Map<String, LocalResource> localResources) {
     if (localResources == null)
       return;
     initLocalResources();
+    this.localResources.clear();
     this.localResources.putAll(localResources);
   }
   
@@ -265,7 +248,8 @@ public class ContainerLaunchContextPBImp
     builder.clearLocalResources();
     if (localResources == null)
       return;
-    Iterable<StringLocalResourceMapProto> iterable = new Iterable<StringLocalResourceMapProto>() {
+    Iterable<StringLocalResourceMapProto> iterable = 
+        new Iterable<StringLocalResourceMapProto>() {
       
       @Override
       public Iterator<StringLocalResourceMapProto> iterator() {
@@ -281,7 +265,8 @@ public class ContainerLaunchContextPBImp
           @Override
           public StringLocalResourceMapProto next() {
             String key = keyIter.next();
-            return StringLocalResourceMapProto.newBuilder().setKey(key).setValue(convertToProtoFormat(localResources.get(key))).build();
+            return StringLocalResourceMapProto.newBuilder().setKey(key).
+                setValue(convertToProtoFormat(localResources.get(key))).build();
           }
           
           @Override
@@ -293,21 +278,7 @@ public class ContainerLaunchContextPBImp
     };
     builder.addAllLocalResources(iterable);
   }
-  @Override
-  public void setLocalResource(String key, LocalResource val) {
-    initLocalResources();
-    this.localResources.put(key, val);
-  }
-  @Override
-  public void removeLocalResource(String key) {
-    initLocalResources();
-    this.localResources.remove(key);
-  }
-  @Override
-  public void clearLocalResources() {
-    initLocalResources();
-    this.localResources.clear();
-  }
+  
   @Override
   public ByteBuffer getContainerTokens() {
     ContainerLaunchContextProtoOrBuilder p = viaProto ? proto : builder;
@@ -328,16 +299,12 @@ public class ContainerLaunchContextPBImp
       builder.clearContainerTokens();
     this.containerTokens = containerTokens;
   }
+  
   @Override
-  public Map<String, ByteBuffer> getAllServiceData() {
+  public Map<String, ByteBuffer> getServiceData() {
     initServiceData();
     return this.serviceData;
   }
-  @Override
-  public ByteBuffer getServiceData(String key) {
-    initServiceData();
-    return this.serviceData.get(key);
-  }
   
   private void initServiceData() {
     if (this.serviceData != null) {
@@ -353,7 +320,7 @@ public class ContainerLaunchContextPBImp
   }
   
   @Override
-  public void addAllServiceData(final Map<String, ByteBuffer> serviceData) {
+  public void setServiceData(final Map<String, ByteBuffer> serviceData) {
     if (serviceData == null)
       return;
     initServiceData();
@@ -365,7 +332,8 @@ public class ContainerLaunchContextPBImp
     builder.clearServiceData();
     if (serviceData == null)
       return;
-    Iterable<StringBytesMapProto> iterable = new Iterable<StringBytesMapProto>() {
+    Iterable<StringBytesMapProto> iterable = 
+        new Iterable<StringBytesMapProto>() {
       
       @Override
       public Iterator<StringBytesMapProto> iterator() {
@@ -381,7 +349,8 @@ public class ContainerLaunchContextPBImp
           @Override
           public StringBytesMapProto next() {
             String key = keyIter.next();
-            return StringBytesMapProto.newBuilder().setKey(key).setValue(convertToProtoFormat(serviceData.get(key))).build();
+            return StringBytesMapProto.newBuilder().setKey(key).setValue(
+                convertToProtoFormat(serviceData.get(key))).build();
           }
           
           @Override
@@ -393,31 +362,12 @@ public class ContainerLaunchContextPBImp
     };
     builder.addAllServiceData(iterable);
   }
+  
   @Override
-  public void setServiceData(String key, ByteBuffer val) {
-    initServiceData();
-    this.serviceData.put(key, val);
-  }
-  @Override
-  public void removeServiceData(String key) {
-    initServiceData();
-    this.serviceData.remove(key);
-  }
-  @Override
-  public void clearServiceData() {
-    initServiceData();
-    this.serviceData.clear();
-  }
-  @Override
-  public Map<String, String> getAllEnv() {
+  public Map<String, String> getEnv() {
     initEnv();
     return this.env;
   }
-  @Override
-  public String getEnv(String key) {
-    initEnv();
-    return this.env.get(key);
-  }
   
   private void initEnv() {
     if (this.env != null) {
@@ -433,10 +383,11 @@ public class ContainerLaunchContextPBImp
   }
   
   @Override
-  public void addAllEnv(final Map<String, String> env) {
+  public void setEnv(final Map<String, String> env) {
     if (env == null)
       return;
     initEnv();
+    this.env.clear();
     this.env.putAll(env);
   }
   
@@ -445,7 +396,8 @@ public class ContainerLaunchContextPBImp
     builder.clearEnv();
     if (env == null)
       return;
-    Iterable<StringStringMapProto> iterable = new Iterable<StringStringMapProto>() {
+    Iterable<StringStringMapProto> iterable = 
+        new Iterable<StringStringMapProto>() {
       
       @Override
       public Iterator<StringStringMapProto> iterator() {
@@ -461,7 +413,8 @@ public class ContainerLaunchContextPBImp
           @Override
           public StringStringMapProto next() {
             String key = keyIter.next();
-            return StringStringMapProto.newBuilder().setKey(key).setValue((env.get(key))).build();
+            return StringStringMapProto.newBuilder().setKey(key).setValue(
+                (env.get(key))).build();
           }
           
           @Override
@@ -473,21 +426,6 @@ public class ContainerLaunchContextPBImp
     };
     builder.addAllEnv(iterable);
   }
-  @Override
-  public void setEnv(String key, String val) {
-    initEnv();
-    this.env.put(key, val);
-  }
-  @Override
-  public void removeEnv(String key) {
-    initEnv();
-    this.env.remove(key);
-  }
-  @Override
-  public void clearEnv() {
-    initEnv();
-    this.env.clear();
-  }
 
   private ResourcePBImpl convertFromProtoFormat(ResourceProto p) {
     return new ResourcePBImpl(p);

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerStatusPBImpl.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerStatusPBImpl.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerStatusPBImpl.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/impl/pb/ContainerStatusPBImpl.java Tue Sep 13 00:05:51 2011
@@ -31,7 +31,8 @@ import org.apache.hadoop.yarn.util.Proto
 
 
     
-public class ContainerStatusPBImpl extends ProtoBase<ContainerStatusProto> implements ContainerStatus {
+public class ContainerStatusPBImpl extends ProtoBase<ContainerStatusProto> 
+implements ContainerStatus {
   ContainerStatusProto proto = ContainerStatusProto.getDefaultInstance();
   ContainerStatusProto.Builder builder = null;
   boolean viaProto = false;
@@ -116,13 +117,13 @@ public class ContainerStatusPBImpl exten
     this.containerId = containerId;
   }
   @Override
-  public String getExitStatus() {
+  public int getExitStatus() {
     ContainerStatusProtoOrBuilder p = viaProto ? proto : builder;
-    return (p.getExitStatus());
+    return p.getExitStatus();
   }
 
   @Override
-  public void setExitStatus(String exitStatus) {
+  public void setExitStatus(int exitStatus) {
     maybeInitBuilder();
     builder.setExitStatus(exitStatus);
   }

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_protos.proto Tue Sep 13 00:05:51 2011
@@ -250,7 +250,7 @@ message ContainerStatusProto {
   optional ContainerIdProto container_id = 1;
   optional ContainerStateProto state = 2;
   optional string diagnostics = 3 [default = "N/A"];
-  optional string exit_status = 4 [default = "N/A"];
+  optional int32 exit_status = 4 [default = -1000];
 }
 
 

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/conf/YarnConfiguration.java Tue Sep 13 00:05:51 2011
@@ -351,6 +351,8 @@ public class YarnConfiguration extends C
   public static final String NM_AUX_SERVICE_FMT =
     NM_PREFIX + "aux-services.%s.class";
 
+  public static final int INVALID_CONTAINER_EXIT_STATUS = -1000;
+  public static final int ABORTED_CONTAINER_EXIT_STATUS = -100;
   
   public YarnConfiguration() {
     super();

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/security/ContainerTokenIdentifier.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/security/ContainerTokenIdentifier.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/security/ContainerTokenIdentifier.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/security/ContainerTokenIdentifier.java Tue Sep 13 00:05:51 2011
@@ -68,28 +68,42 @@ public class ContainerTokenIdentifier ex
   @Override
   public void write(DataOutput out) throws IOException {
     LOG.debug("Writing ContainerTokenIdentifier to RPC layer");
-    out.writeInt(this.containerId.getAppId().getId());
-    out.writeInt(this.containerId.getAppAttemptId().getAttemptId());
+    ApplicationAttemptId applicationAttemptId = 
+        containerId.getApplicationAttemptId();
+    ApplicationId applicationId = applicationAttemptId.getApplicationId();
+    out.writeLong(applicationId.getClusterTimestamp());
+    out.writeInt(applicationId.getId());
+    out.writeInt(applicationAttemptId.getAttemptId());
     out.writeInt(this.containerId.getId());
-    // TODO: Cluster time-stamp?
     out.writeUTF(this.nmHostName);
-    out.writeInt(this.resource.getMemory()); // TODO: more resources.
+    out.writeInt(this.resource.getMemory());
   }
 
   @Override
   public void readFields(DataInput in) throws IOException {
-    this.containerId = RecordFactoryProvider.getRecordFactory(null).newRecordInstance(ContainerId.class);
-    this.containerId.setAppId(RecordFactoryProvider.getRecordFactory(null).newRecordInstance(ApplicationId.class));
-    this.containerId.setAppAttemptId(RecordFactoryProvider.getRecordFactory(null).newRecordInstance(ApplicationAttemptId.class));
-    this.containerId.getAppId().setId(in.readInt());
-    this.containerId.getAppAttemptId().setApplicationId(this.containerId.getAppId());
-    this.containerId.getAppAttemptId().setAttemptId(in.readInt());
+    this.containerId = 
+        RecordFactoryProvider.getRecordFactory(null).newRecordInstance(
+            ContainerId.class);
+    ApplicationAttemptId applicationAttemptId =
+        RecordFactoryProvider.getRecordFactory(null).newRecordInstance(
+            ApplicationAttemptId.class);
+    ApplicationId applicationId =
+        RecordFactoryProvider.getRecordFactory(null).newRecordInstance(
+            ApplicationId.class);
+    applicationId.setClusterTimestamp(in.readLong());
+    applicationId.setId(in.readInt());
+    applicationAttemptId.setApplicationId(applicationId);
+    applicationAttemptId.setAttemptId(in.readInt());
+    this.containerId.setApplicationAttemptId(applicationAttemptId);
     this.containerId.setId(in.readInt());
     this.nmHostName = in.readUTF();
-    this.resource = RecordFactoryProvider.getRecordFactory(null).newRecordInstance(Resource.class);
-    this.resource.setMemory(in.readInt()); // TODO: more resources.
+    this.resource = 
+        RecordFactoryProvider.getRecordFactory(null).newRecordInstance(
+            Resource.class);
+    this.resource.setMemory(in.readInt());
   }
 
+  @SuppressWarnings("static-access")
   @Override
   public Text getKind() {
     return this.KIND;

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/BuilderUtils.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/BuilderUtils.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/BuilderUtils.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/BuilderUtils.java Tue Sep 13 00:05:51 2011
@@ -152,9 +152,8 @@ public class BuilderUtils {
   public static ContainerId newContainerId(ApplicationAttemptId appAttemptId,
       int containerId) {
     ContainerId id = recordFactory.newRecordInstance(ContainerId.class);
-    id.setAppId(appAttemptId.getApplicationId());
     id.setId(containerId);
-    id.setAppAttemptId(appAttemptId);
+    id.setApplicationAttemptId(appAttemptId);
     return id;
   }
 
@@ -171,9 +170,8 @@ public class BuilderUtils {
       ApplicationId appId, ApplicationAttemptId appAttemptId,
       int containerId) {
     ContainerId id = recordFactory.newRecordInstance(ContainerId.class);
-    id.setAppId(appId);
     id.setId(containerId);
-    id.setAppAttemptId(appAttemptId);
+    id.setApplicationAttemptId(appAttemptId);
     return id;
   }
 
@@ -181,8 +179,7 @@ public class BuilderUtils {
       ApplicationAttemptId appAttemptId,
       int containerId) {
     ContainerId id = recordFactory.newRecordInstance(ContainerId.class);
-    id.setAppAttemptId(appAttemptId);
-    id.setAppId(appAttemptId.getApplicationId());
+    id.setApplicationAttemptId(appAttemptId);
     id.setId(containerId);
     return id;
   }

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/ConverterUtils.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/ConverterUtils.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/ConverterUtils.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/util/ConverterUtils.java Tue Sep 13 00:05:51 2011
@@ -29,6 +29,7 @@ import java.util.Map;
 import java.util.Map.Entry;
 
 import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.ContainerId;
 import org.apache.hadoop.yarn.api.records.URL;
@@ -130,6 +131,20 @@ public class ConverterUtils {
     return appId;
   }
 
+  private static ApplicationAttemptId toApplicationAttemptId(
+      RecordFactory recordFactory,
+      Iterator<String> it) {
+    ApplicationId appId =
+        recordFactory.newRecordInstance(ApplicationId.class);
+    appId.setClusterTimestamp(Long.parseLong(it.next()));
+    appId.setId(Integer.parseInt(it.next()));
+    ApplicationAttemptId appAttemptId =
+        recordFactory.newRecordInstance(ApplicationAttemptId.class);
+    appAttemptId.setApplicationId(appId);
+    appAttemptId.setAttemptId(Integer.parseInt(it.next()));
+    return appAttemptId;
+  }
+
   public static String toString(ContainerId cId) {
     return cId.toString();
   }
@@ -138,10 +153,11 @@ public class ConverterUtils {
       String containerIdStr) {
     Iterator<String> it = _split(containerIdStr).iterator();
     it.next(); // prefix. TODO: Validate container prefix
-    ApplicationId appID = toApplicationId(recordFactory, it);
+    ApplicationAttemptId appAttemptID = 
+        toApplicationAttemptId(recordFactory, it);
     ContainerId containerId =
         recordFactory.newRecordInstance(ContainerId.class);
-    containerId.setAppId(appID);
+    containerId.setApplicationAttemptId(appAttemptID);
     containerId.setId(Integer.parseInt(it.next()));
     return containerId;
   }

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestRPC.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestRPC.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestRPC.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/TestRPC.java Tue Sep 13 00:05:51 2011
@@ -32,6 +32,7 @@ import org.apache.hadoop.yarn.api.protoc
 import org.apache.hadoop.yarn.api.protocolrecords.StartContainerResponse;
 import org.apache.hadoop.yarn.api.protocolrecords.StopContainerRequest;
 import org.apache.hadoop.yarn.api.protocolrecords.StopContainerResponse;
+import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.ContainerId;
 import org.apache.hadoop.yarn.api.records.ContainerLaunchContext;
@@ -81,21 +82,34 @@ public class TestRPC {
     ContainerManager proxy = (ContainerManager) 
         rpc.getProxy(ContainerManager.class, 
             NetUtils.createSocketAddr("localhost:" + server.getPort()), conf);
-    ContainerLaunchContext containerLaunchContext = recordFactory.newRecordInstance(ContainerLaunchContext.class);
+    ContainerLaunchContext containerLaunchContext = 
+        recordFactory.newRecordInstance(ContainerLaunchContext.class);
     containerLaunchContext.setUser("dummy-user");
-    containerLaunchContext.setContainerId(recordFactory.newRecordInstance(ContainerId.class));
-    containerLaunchContext.getContainerId().setAppId(recordFactory.newRecordInstance(ApplicationId.class));
-    containerLaunchContext.getContainerId().getAppId().setId(0);
-    containerLaunchContext.getContainerId().setId(100);
-    containerLaunchContext.setResource(recordFactory.newRecordInstance(Resource.class));
+    ContainerId containerId = 
+        recordFactory.newRecordInstance(ContainerId.class);
+    ApplicationId applicationId = 
+        recordFactory.newRecordInstance(ApplicationId.class);
+    ApplicationAttemptId applicationAttemptId =
+        recordFactory.newRecordInstance(ApplicationAttemptId.class);
+    applicationId.setClusterTimestamp(0);
+    applicationId.setId(0);
+    applicationAttemptId.setApplicationId(applicationId);
+    applicationAttemptId.setAttemptId(0);
+    containerId.setApplicationAttemptId(applicationAttemptId);
+    containerId.setId(100);
+    containerLaunchContext.setContainerId(containerId);
+    containerLaunchContext.setResource(
+        recordFactory.newRecordInstance(Resource.class));
 //    containerLaunchContext.env = new HashMap<CharSequence, CharSequence>();
 //    containerLaunchContext.command = new ArrayList<CharSequence>();
     
-    StartContainerRequest scRequest = recordFactory.newRecordInstance(StartContainerRequest.class);
+    StartContainerRequest scRequest = 
+        recordFactory.newRecordInstance(StartContainerRequest.class);
     scRequest.setContainerLaunchContext(containerLaunchContext);
     proxy.startContainer(scRequest);
     
-    GetContainerStatusRequest gcsRequest = recordFactory.newRecordInstance(GetContainerStatusRequest.class);
+    GetContainerStatusRequest gcsRequest = 
+        recordFactory.newRecordInstance(GetContainerStatusRequest.class);
     gcsRequest.setContainerId(containerLaunchContext.getContainerId());
     GetContainerStatusResponse response =  proxy.getContainerStatus(gcsRequest);
     ContainerStatus status = response.getStatus();
@@ -118,7 +132,7 @@ public class TestRPC {
     
     server.close();
     Assert.assertNotNull(status);
-    Assert.assertEquals(ContainerState.RUNNING, status.getState().RUNNING);
+    Assert.assertEquals(ContainerState.RUNNING, status.getState());
   }
 
   public class DummyContainerManager implements ContainerManager {
@@ -126,28 +140,35 @@ public class TestRPC {
     private ContainerStatus status = null;    
     
     @Override
-    public GetContainerStatusResponse getContainerStatus(GetContainerStatusRequest request) throws YarnRemoteException {
-      GetContainerStatusResponse response = recordFactory.newRecordInstance(GetContainerStatusResponse.class);
+    public GetContainerStatusResponse getContainerStatus(
+        GetContainerStatusRequest request)
+    throws YarnRemoteException {
+      GetContainerStatusResponse response = 
+          recordFactory.newRecordInstance(GetContainerStatusResponse.class);
       response.setStatus(status);
       return response;
     }
 
     @Override
-    public StartContainerResponse startContainer(StartContainerRequest request) throws YarnRemoteException {
+    public StartContainerResponse startContainer(StartContainerRequest request) 
+        throws YarnRemoteException {
       ContainerLaunchContext container = request.getContainerLaunchContext();
-      StartContainerResponse response = recordFactory.newRecordInstance(StartContainerResponse.class);
+      StartContainerResponse response = 
+          recordFactory.newRecordInstance(StartContainerResponse.class);
       status = recordFactory.newRecordInstance(ContainerStatus.class);
       status.setState(ContainerState.RUNNING);
       status.setContainerId(container.getContainerId());
-      status.setExitStatus(String.valueOf(0));
+      status.setExitStatus(0);
       return response;
     }
 
     @Override
-    public StopContainerResponse stopContainer(StopContainerRequest request) throws YarnRemoteException {
+    public StopContainerResponse stopContainer(StopContainerRequest request) 
+    throws YarnRemoteException {
       Exception e = new Exception(EXCEPTION_MSG, 
           new Exception(EXCEPTION_CAUSE));
-      throw YarnRemoteExceptionFactoryProvider.getYarnRemoteExceptionFactory(null).createYarnRemoteException(e);
+      throw YarnRemoteExceptionFactoryProvider
+          .getYarnRemoteExceptionFactory(null).createYarnRemoteException(e);
     }
   }
 }

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestContainerId.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestContainerId.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestContainerId.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/TestContainerId.java Tue Sep 13 00:05:51 2011
@@ -40,8 +40,7 @@ public class TestContainerId {
     ApplicationAttemptId appAttemptId =
         createAppAttemptId(appId, appAttemptIdInt);
     ContainerId containerId = Records.newRecord(ContainerId.class);
-    containerId.setAppAttemptId(appAttemptId);
-    containerId.setAppId(appId);
+    containerId.setApplicationAttemptId(appAttemptId);
     containerId.setId(containerIdInt);
     return containerId;
   }

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/DefaultContainerExecutor.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/DefaultContainerExecutor.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/DefaultContainerExecutor.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/DefaultContainerExecutor.java Tue Sep 13 00:05:51 2011
@@ -97,7 +97,9 @@ public class DefaultContainerExecutor ex
     // create container dirs on all disks
     String containerIdStr = ConverterUtils.toString(containerId);
     String appIdStr =
-        ConverterUtils.toString(container.getContainerID().getAppId());
+        ConverterUtils.toString(
+            container.getContainerID().getApplicationAttemptId().
+                getApplicationId());
     String[] sLocalDirs =
         getConf().getStrings(YarnConfiguration.NM_LOCAL_DIRS, YarnConfiguration.DEFAULT_NM_LOCAL_DIRS);
     for (String sLocalDir : sLocalDirs) {

Modified: hadoop/common/trunk/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/trunk/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=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/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/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/ContainerManagerImpl.java Tue Sep 13 00:05:51 2011
@@ -250,7 +250,8 @@ public class ContainerManagerImpl extend
     Container container =
         new ContainerImpl(this.dispatcher, launchContext, credentials, metrics);
     ContainerId containerID = launchContext.getContainerId();
-    ApplicationId applicationID = containerID.getAppId();
+    ApplicationId applicationID = 
+        containerID.getApplicationAttemptId().getApplicationId();
     if (context.getContainers().putIfAbsent(containerID, container) != null) {
       NMAuditLogger.logFailure(launchContext.getUser(), 
           AuditConstants.START_CONTAINER, "ContainerManagerImpl",
@@ -305,7 +306,8 @@ public class ContainerManagerImpl extend
       NMAuditLogger.logFailure(userName,
           AuditConstants.STOP_CONTAINER, "ContainerManagerImpl",
           "Trying to stop unknown container!",
-          containerID.getAppId(), containerID);
+          containerID.getApplicationAttemptId().getApplicationId(), 
+          containerID);
       return response; // Return immediately.
     }
     dispatcher.getEventHandler().handle(
@@ -317,7 +319,8 @@ public class ContainerManagerImpl extend
     // should be the same or should be rejected by auth before here. 
     NMAuditLogger.logSuccess(container.getUser(), 
         AuditConstants.STOP_CONTAINER, "ContainerManageImpl", 
-        containerID.getAppId(), containerID);
+        containerID.getApplicationAttemptId().getApplicationId(), 
+        containerID);
 
     // TODO: Move this code to appropriate place once kill_container is
     // implemented.

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/application/ApplicationContainerFinishedEvent.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/application/ApplicationContainerFinishedEvent.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/application/ApplicationContainerFinishedEvent.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/application/ApplicationContainerFinishedEvent.java Tue Sep 13 00:05:51 2011
@@ -25,7 +25,7 @@ public class ApplicationContainerFinishe
 
   public ApplicationContainerFinishedEvent(
       ContainerId containerID) {
-    super(containerID.getAppId(),
+    super(containerID.getApplicationAttemptId().getApplicationId(),
         ApplicationEventType.APPLICATION_CONTAINER_FINISHED);
     this.containerID = containerID;
   }

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/application/ApplicationInitEvent.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/application/ApplicationInitEvent.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/application/ApplicationInitEvent.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/application/ApplicationInitEvent.java Tue Sep 13 00:05:51 2011
@@ -25,7 +25,7 @@ public class ApplicationInitEvent extend
   private final Container container;
 
   public ApplicationInitEvent(Container container) {
-    super(container.getContainerID().getAppId(),
+    super(container.getContainerID().getApplicationAttemptId().getApplicationId(),
         ApplicationEventType.INIT_APPLICATION);
     this.container = container;
   }

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/container/ContainerImpl.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/container/ContainerImpl.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/container/ContainerImpl.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/container/ContainerImpl.java Tue Sep 13 00:05:51 2011
@@ -40,6 +40,7 @@ import org.apache.hadoop.yarn.api.record
 import org.apache.hadoop.yarn.api.records.ContainerStatus;
 import org.apache.hadoop.yarn.api.records.LocalResource;
 import org.apache.hadoop.yarn.api.records.LocalResourceVisibility;
+import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.event.Dispatcher;
 import org.apache.hadoop.yarn.event.EventHandler;
 import org.apache.hadoop.yarn.factories.RecordFactory;
@@ -53,9 +54,7 @@ import org.apache.hadoop.yarn.server.nod
 import org.apache.hadoop.yarn.server.nodemanager.containermanager.launcher.ContainersLauncherEventType;
 import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.LocalResourceRequest;
 import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.event.ContainerLocalizationCleanupEvent;
-import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.event.ContainerLocalizationEvent;
 import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.event.ContainerLocalizationRequestEvent;
-import org.apache.hadoop.yarn.server.nodemanager.containermanager.localizer.event.LocalizationEventType;
 import org.apache.hadoop.yarn.server.nodemanager.containermanager.logaggregation.event.LogAggregatorContainerFinishedEvent;
 import org.apache.hadoop.yarn.server.nodemanager.containermanager.monitor.ContainerStartMonitoringEvent;
 import org.apache.hadoop.yarn.server.nodemanager.containermanager.monitor.ContainerStopMonitoringEvent;
@@ -75,7 +74,7 @@ public class ContainerImpl implements Co
   private final Credentials credentials;
   private final NodeManagerMetrics metrics;
   private final ContainerLaunchContext launchContext;
-  private String exitCode = "NA";
+  private int exitCode = YarnConfiguration.INVALID_CONTAINER_EXIT_STATUS;
   private final StringBuilder diagnostics;
 
   private static final Log LOG = LogFactory.getLog(Container.class);
@@ -345,7 +344,7 @@ public class ContainerImpl implements Co
       containerStatus.setState(getCurrentState());
       containerStatus.setContainerId(this.launchContext.getContainerId());
       containerStatus.setDiagnostics(diagnostics.toString());
-  	  containerStatus.setExitStatus(String.valueOf(exitCode));
+  	  containerStatus.setExitStatus(exitCode);
       return containerStatus;
     } finally {
       this.readLock.unlock();
@@ -360,7 +359,8 @@ public class ContainerImpl implements Co
         metrics.completedContainer();
         NMAuditLogger.logSuccess(getUser(),
             AuditConstants.FINISH_SUCCESS_CONTAINER, "ContainerImpl",
-            getContainerID().getAppId(), getContainerID());
+            getContainerID().getApplicationAttemptId().getApplicationId(), 
+            getContainerID());
         break;
       case EXITED_WITH_FAILURE:
         metrics.endRunningContainer();
@@ -370,7 +370,8 @@ public class ContainerImpl implements Co
         NMAuditLogger.logFailure(getUser(),
             AuditConstants.FINISH_FAILED_CONTAINER, "ContainerImpl",
             "Container failed with state: " + getContainerState(),
-            getContainerID().getAppId(), getContainerID());
+            getContainerID().getApplicationAttemptId().getApplicationId(), 
+            getContainerID());
         break;
       case CONTAINER_CLEANEDUP_AFTER_KILL:
         metrics.endRunningContainer();
@@ -379,13 +380,15 @@ public class ContainerImpl implements Co
         metrics.killedContainer();
         NMAuditLogger.logSuccess(getUser(),
             AuditConstants.FINISH_KILLED_CONTAINER, "ContainerImpl",
-            getContainerID().getAppId(), getContainerID());
+            getContainerID().getApplicationAttemptId().getApplicationId(), 
+            getContainerID());
     }
 
     metrics.releaseContainer(getLaunchContext().getResource());
 
     // Inform the application
     ContainerId containerID = getContainerID();
+    @SuppressWarnings("rawtypes")
     EventHandler eventHandler = dispatcher.getEventHandler();
     eventHandler.handle(new ApplicationContainerFinishedEvent(containerID));
     // Remove the container from the resource-monitor
@@ -433,20 +436,21 @@ public class ContainerImpl implements Co
       container.metrics.initingContainer();
 
       // Inform the AuxServices about the opaque serviceData
-      Map<String,ByteBuffer> csd = ctxt.getAllServiceData();
+      Map<String,ByteBuffer> csd = ctxt.getServiceData();
       if (csd != null) {
         // This can happen more than once per Application as each container may
         // have distinct service data
         for (Map.Entry<String,ByteBuffer> service : csd.entrySet()) {
           container.dispatcher.getEventHandler().handle(
               new AuxServicesEvent(AuxServicesEventType.APPLICATION_INIT,
-                ctxt.getUser(), ctxt.getContainerId().getAppId(),
+                ctxt.getUser(), 
+                ctxt.getContainerId().getApplicationAttemptId().getApplicationId(),
                 service.getKey().toString(), service.getValue()));
         }
       }
 
       // Send requests for public, private resources
-      Map<String,LocalResource> cntrRsrc = ctxt.getAllLocalResources();
+      Map<String,LocalResource> cntrRsrc = ctxt.getLocalResources();
       if (!cntrRsrc.isEmpty()) {
         try {
           for (Map.Entry<String,LocalResource> rsrc : cntrRsrc.entrySet()) {
@@ -562,7 +566,7 @@ public class ContainerImpl implements Co
     @Override
     public void transition(ContainerImpl container, ContainerEvent event) {
       ContainerExitEvent exitEvent = (ContainerExitEvent) event;
-      container.exitCode = String.valueOf(exitEvent.getExitCode());
+      container.exitCode = exitEvent.getExitCode();
 
       // TODO: Add containerWorkDir to the deletion service.
       // TODO: Add containerOuputDir to the deletion service.
@@ -640,7 +644,7 @@ public class ContainerImpl implements Co
     @Override
     public void transition(ContainerImpl container, ContainerEvent event) {
       ContainerExitEvent exitEvent = (ContainerExitEvent) event;
-      container.exitCode = String.valueOf(exitEvent.getExitCode());
+      container.exitCode = exitEvent.getExitCode();
 
       // The process/process-grp is killed. Decrement reference counts and
       // cleanup resources

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/launcher/ContainerLaunch.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/launcher/ContainerLaunch.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/launcher/ContainerLaunch.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/launcher/ContainerLaunch.java Tue Sep 13 00:05:51 2011
@@ -89,8 +89,8 @@ public class ContainerLaunch implements 
     final Map<Path,String> localResources = container.getLocalizedResources();
     String containerIdStr = ConverterUtils.toString(container.getContainerID());
     final String user = launchContext.getUser();
-    final Map<String,String> env = launchContext.getAllEnv();
-    final List<String> command = launchContext.getCommandList();
+    final Map<String,String> env = launchContext.getEnv();
+    final List<String> command = launchContext.getCommands();
     int ret = -1;
 
     try {
@@ -107,10 +107,9 @@ public class ContainerLaunch implements 
         newCmds.add(str.replace(ApplicationConstants.LOG_DIR_EXPANSION_VAR,
             containerLogDir.toUri().getPath()));
       }
-      launchContext.clearCommands();
-      launchContext.addAllCommands(newCmds);
+      launchContext.setCommands(newCmds);
 
-      Map<String, String> envs = launchContext.getAllEnv();
+      Map<String, String> envs = launchContext.getEnv();
       Map<String, String> newEnvs = new HashMap<String, String>(envs.size());
       for (Entry<String, String> entry : envs.entrySet()) {
         newEnvs.put(
@@ -119,8 +118,7 @@ public class ContainerLaunch implements 
                 ApplicationConstants.LOG_DIR_EXPANSION_VAR,
                 containerLogDir.toUri().getPath()));
       }
-      launchContext.clearEnv();
-      launchContext.addAllEnv(newEnvs);
+      launchContext.setEnv(newEnvs);
       // /////////////////////////// End of variable expansion
 
       FileContext lfs = FileContext.getLocalFSFileContext();
@@ -170,7 +168,7 @@ public class ContainerLaunch implements 
             containerWorkDir, FINAL_CONTAINER_TOKENS_FILE).toUri().getPath());
 
         writeLaunchEnv(containerScriptOutStream, env, localResources,
-            launchContext.getCommandList(), appDirs);
+            launchContext.getCommands(), appDirs);
         // /////////// End of writing out container-script
 
         // /////////// Write out the container-tokens in the nmPrivate space.

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/launcher/ContainersLauncher.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/launcher/ContainersLauncher.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/launcher/ContainersLauncher.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/launcher/ContainersLauncher.java Tue Sep 13 00:05:51 2011
@@ -103,7 +103,8 @@ public class ContainersLauncher extends 
     switch (event.getType()) {
       case LAUNCH_CONTAINER:
         Application app =
-          context.getApplications().get(containerId.getAppId());
+          context.getApplications().get(
+              containerId.getApplicationAttemptId().getApplicationId());
       ContainerLaunch launch =
           new ContainerLaunch(getConfig(), dispatcher, exec, app,
               event.getContainer());

Modified: hadoop/common/trunk/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/trunk/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=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/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/trunk/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 Tue Sep 13 00:05:51 2011
@@ -292,7 +292,7 @@ public class ResourceLocalizationService
       for (Map.Entry<LocalResourceVisibility, Collection<LocalResourceRequest>> e :
            rsrcs.entrySet()) {
         tracker = getLocalResourcesTracker(e.getKey(), c.getUser(), 
-            c.getContainerID().getAppId());
+            c.getContainerID().getApplicationAttemptId().getApplicationId());
         for (LocalResourceRequest req : e.getValue()) {
           tracker.handle(new ResourceRequestEvent(req, e.getKey(), ctxt));
         }
@@ -316,7 +316,7 @@ public class ResourceLocalizationService
       for (Map.Entry<LocalResourceVisibility, Collection<LocalResourceRequest>> e :
            rsrcs.entrySet()) {
         tracker = getLocalResourcesTracker(e.getKey(), c.getUser(), 
-            c.getContainerID().getAppId());
+            c.getContainerID().getApplicationAttemptId().getApplicationId());
         for (LocalResourceRequest req : e.getValue()) {
           tracker.handle(new ResourceReleaseEvent(req, c.getContainerID()));
         }
@@ -326,7 +326,8 @@ public class ResourceLocalizationService
       userName = c.getUser();
       String containerIDStr = c.toString();
       appIDStr =
-        ConverterUtils.toString(c.getContainerID().getAppId());
+        ConverterUtils.toString(
+            c.getContainerID().getApplicationAttemptId().getApplicationId());
       for (Path localDir : localDirs) {
 
         // Delete the user-owned container-dir
@@ -789,7 +790,9 @@ public class ResourceLocalizationService
         // 2) exec initApplication and wait
         exec.startLocalizer(nmPrivateCTokensPath, localizationServerAddress,
             context.getUser(),
-            ConverterUtils.toString(context.getContainerId().getAppId()),
+            ConverterUtils.toString(
+                context.getContainerId().
+                    getApplicationAttemptId().getApplicationId()),
             localizerId, localDirs);
       // TODO handle ExitCodeException separately?
       } catch (Exception e) {

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/AggregatedLogFormat.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/AggregatedLogFormat.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/AggregatedLogFormat.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/AggregatedLogFormat.java Tue Sep 13 00:05:51 2011
@@ -90,8 +90,11 @@ public class AggregatedLogFormat {
     public void write(DataOutputStream out) throws IOException {
       for (String rootLogDir : this.rootLogDirs) {
         File appLogDir =
-            new File(rootLogDir, ConverterUtils.toString(this.containerId
-                .getAppId()));
+            new File(rootLogDir, 
+                ConverterUtils.toString(
+                    this.containerId.getApplicationAttemptId().
+                        getApplicationId())
+                );
         File containerLogDir =
             new File(appLogDir, ConverterUtils.toString(this.containerId));
 

Modified: hadoop/common/trunk/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/trunk/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=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/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/trunk/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 Tue Sep 13 00:05:51 2011
@@ -172,11 +172,13 @@ public class LogAggregationService exten
     // A container is complete. Put this containers' logs up for aggregation if
     // this containers' logs are needed.
 
-    if (!this.appLogAggregators.containsKey(containerId.getAppId())) {
+    if (!this.appLogAggregators.containsKey(
+        containerId.getApplicationAttemptId().getApplicationId())) {
       throw new YarnException("Application is not initialized yet for "
           + containerId);
     }
-    this.appLogAggregators.get(containerId.getAppId())
+    this.appLogAggregators.get(
+        containerId.getApplicationAttemptId().getApplicationId())
         .startContainerLogAggregation(containerId, exitCode.equals("0"));
   }
 

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/event/LogAggregatorContainerFinishedEvent.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/event/LogAggregatorContainerFinishedEvent.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/event/LogAggregatorContainerFinishedEvent.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/logaggregation/event/LogAggregatorContainerFinishedEvent.java Tue Sep 13 00:05:51 2011
@@ -23,10 +23,10 @@ import org.apache.hadoop.yarn.api.record
 public class LogAggregatorContainerFinishedEvent extends LogAggregatorEvent {
 
   private final ContainerId containerId;
-  private final String exitCode;
+  private final int exitCode;
 
   public LogAggregatorContainerFinishedEvent(ContainerId containerId,
-      String exitCode) {
+      int exitCode) {
     super(LogAggregatorEventType.CONTAINER_FINISHED);
     this.containerId = containerId;
     this.exitCode = exitCode;
@@ -36,7 +36,7 @@ public class LogAggregatorContainerFinis
     return this.containerId;
   }
 
-  public String getExitCode() {
+  public int getExitCode() {
     return this.exitCode;
   }
 

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/webapp/ContainerLogsPage.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/webapp/ContainerLogsPage.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/webapp/ContainerLogsPage.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/webapp/ContainerLogsPage.java Tue Sep 13 00:05:51 2011
@@ -95,7 +95,8 @@ public class ContainerLogsPage extends N
             logFile =
                 new File(this.logsSelector
                     .getLocalPathToRead(
-                        ConverterUtils.toString(containerId.getAppId())
+                        ConverterUtils.toString(
+                            containerId.getApplicationAttemptId().getApplicationId())
                             + Path.SEPARATOR + $(CONTAINER_ID)
                             + Path.SEPARATOR
                             + $(CONTAINER_LOG_TYPE), this.conf).toUri()
@@ -176,7 +177,9 @@ public class ContainerLogsPage extends N
           conf.getStrings(YarnConfiguration.NM_LOG_DIRS, YarnConfiguration.DEFAULT_NM_LOG_DIRS);
       List<File> containerLogDirs = new ArrayList<File>(logDirs.length);
       for (String logDir : logDirs) {
-        String appIdStr = ConverterUtils.toString(containerId.getAppId());
+        String appIdStr = 
+            ConverterUtils.toString(
+                containerId.getApplicationAttemptId().getApplicationId());
         File appLogDir = new File(logDir, appIdStr);
         String containerIdStr = ConverterUtils.toString(containerId);
         containerLogDirs.add(new File(appLogDir, containerIdStr));

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/webapp/ContainerPage.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/webapp/ContainerPage.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/webapp/ContainerPage.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/webapp/ContainerPage.java Tue Sep 13 00:05:51 2011
@@ -25,6 +25,7 @@ import static org.apache.hadoop.yarn.uti
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.yarn.api.records.ContainerId;
 import org.apache.hadoop.yarn.api.records.ContainerStatus;
+import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.factories.RecordFactory;
 import org.apache.hadoop.yarn.factory.providers.RecordFactoryProvider;
 import org.apache.hadoop.yarn.server.nodemanager.Context;
@@ -69,10 +70,14 @@ public class ContainerPage extends NMVie
         ConverterUtils.toContainerId(this.recordFactory, $(CONTAINER_ID));
       Container container = this.nmContext.getContainers().get(containerID);
       ContainerStatus containerData = container.cloneAndGetContainerStatus();
+      int exitCode = containerData.getExitStatus();
+      String exiStatus = 
+          (exitCode == YarnConfiguration.INVALID_CONTAINER_EXIT_STATUS) ? 
+              "N/A" : String.valueOf(exitCode);
       info("Container information")
         ._("ContainerID", $(CONTAINER_ID))
         ._("ContainerState", container.getContainerState())
-        ._("ExitStatus", containerData.getExitStatus())
+        ._("ExitStatus", exiStatus)
         ._("Diagnostics", containerData.getDiagnostics())
         ._("User", container.getUser())
         ._("TotalMemoryNeeded",

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestEventFlow.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestEventFlow.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestEventFlow.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestEventFlow.java Tue Sep 13 00:05:51 2011
@@ -21,8 +21,6 @@ package org.apache.hadoop.yarn.server.no
 import java.io.File;
 import java.io.IOException;
 
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.NodeHealthCheckerService;
 import org.apache.hadoop.fs.FileContext;
 import org.apache.hadoop.fs.Path;
@@ -37,7 +35,6 @@ import org.apache.hadoop.yarn.api.record
 import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.event.AsyncDispatcher;
 import org.apache.hadoop.yarn.event.Dispatcher;
-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;
@@ -49,8 +46,8 @@ import org.junit.Test;
 
 public class TestEventFlow {
 
-  private static final Log LOG = LogFactory.getLog(TestEventFlow.class);
-  private static final RecordFactory recordFactory = RecordFactoryProvider.getRecordFactory(null);
+  private static final RecordFactory recordFactory =
+      RecordFactoryProvider.getRecordFactory(null);
 
   private static File localDir = new File("target",
       TestEventFlow.class.getName() + "-localDir").getAbsoluteFile();
@@ -77,7 +74,8 @@ public class TestEventFlow {
     YarnConfiguration conf = new YarnConfiguration();
     conf.set(YarnConfiguration.NM_LOCAL_DIRS, localDir.getAbsolutePath());
     conf.set(YarnConfiguration.NM_LOG_DIRS, localLogDir.getAbsolutePath());
-    conf.set(YarnConfiguration.NM_REMOTE_APP_LOG_DIR, remoteLogDir.getAbsolutePath());
+    conf.set(YarnConfiguration.NM_REMOTE_APP_LOG_DIR, 
+        remoteLogDir.getAbsolutePath());
 
     ContainerExecutor exec = new DefaultContainerExecutor();
     exec.setConf(conf);
@@ -100,27 +98,36 @@ public class TestEventFlow {
     };
 
     DummyContainerManager containerManager =
-        new DummyContainerManager(context, exec, del, nodeStatusUpdater, metrics, containerTokenSecretManager);
+        new DummyContainerManager(context, exec, del, nodeStatusUpdater, 
+            metrics, containerTokenSecretManager);
     containerManager.init(conf);
     containerManager.start();
 
-    ContainerLaunchContext launchContext = recordFactory.newRecordInstance(ContainerLaunchContext.class);
+    ContainerLaunchContext launchContext = 
+        recordFactory.newRecordInstance(ContainerLaunchContext.class);
     ContainerId cID = recordFactory.newRecordInstance(ContainerId.class);
-    cID.setAppId(recordFactory.newRecordInstance(ApplicationId.class));
-    ApplicationAttemptId atId = recordFactory.newRecordInstance(ApplicationAttemptId.class);
-    atId.setApplicationId(cID.getAppId());
-    cID.setAppAttemptId(atId);
+    ApplicationId applicationId =
+        recordFactory.newRecordInstance(ApplicationId.class);
+    applicationId.setClusterTimestamp(0);
+    applicationId.setId(0);
+    ApplicationAttemptId applicationAttemptId = 
+        recordFactory.newRecordInstance(ApplicationAttemptId.class);
+    applicationAttemptId.setApplicationId(applicationId);
+    applicationAttemptId.setAttemptId(0);
+    cID.setApplicationAttemptId(applicationAttemptId);
     launchContext.setContainerId(cID);
     launchContext.setUser("testing");
     launchContext.setResource(recordFactory.newRecordInstance(Resource.class));
-    StartContainerRequest request = recordFactory.newRecordInstance(StartContainerRequest.class);
+    StartContainerRequest request = 
+        recordFactory.newRecordInstance(StartContainerRequest.class);
     request.setContainerLaunchContext(launchContext);
     containerManager.startContainer(request);
 
     BaseContainerManagerTest.waitForContainerState(containerManager, cID,
         ContainerState.RUNNING);
 
-    StopContainerRequest stopRequest = recordFactory.newRecordInstance(StopContainerRequest.class);
+    StopContainerRequest stopRequest = 
+        recordFactory.newRecordInstance(StopContainerRequest.class);
     stopRequest.setContainerId(cID);
     containerManager.stopContainer(stopRequest);
     BaseContainerManagerTest.waitForContainerState(containerManager, cID,

Modified: hadoop/common/trunk/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/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeStatusUpdater.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/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/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/TestNodeStatusUpdater.java Tue Sep 13 00:05:51 2011
@@ -134,7 +134,8 @@ public class TestNodeStatusUpdater {
       Map<ApplicationId, List<ContainerStatus>> map =
           new HashMap<ApplicationId, List<ContainerStatus>>();
       for (ContainerStatus cs : containers) {
-        ApplicationId applicationId = cs.getContainerId().getAppId();
+        ApplicationId applicationId = 
+            cs.getContainerId().getApplicationAttemptId().getApplicationId();
         List<ContainerStatus> appContainers = map.get(applicationId);
         if (appContainers == null) {
           appContainers = new ArrayList<ContainerStatus>();
@@ -159,8 +160,7 @@ public class TestNodeStatusUpdater {
         // Give a container to the NM.
         applicationID.setId(heartBeatID);
         appAttemptID.setApplicationId(applicationID);
-        firstContainerID.setAppId(applicationID);
-        firstContainerID.setAppAttemptId(appAttemptID);
+        firstContainerID.setApplicationAttemptId(appAttemptID);
         firstContainerID.setId(heartBeatID);
         ContainerLaunchContext launchContext = recordFactory
             .newRecordInstance(ContainerLaunchContext.class);
@@ -184,8 +184,7 @@ public class TestNodeStatusUpdater {
         // Give another container to the NM.
         applicationID.setId(heartBeatID);
         appAttemptID.setApplicationId(applicationID);
-        secondContainerID.setAppId(applicationID);
-        secondContainerID.setAppAttemptId(appAttemptID);
+        secondContainerID.setApplicationAttemptId(appAttemptID);
         secondContainerID.setId(heartBeatID);
         ContainerLaunchContext launchContext = recordFactory
             .newRecordInstance(ContainerLaunchContext.class);

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/TestContainerManager.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/TestContainerManager.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/TestContainerManager.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/TestContainerManager.java Tue Sep 13 00:05:51 2011
@@ -23,7 +23,11 @@ import java.io.File;
 import java.io.FileReader;
 import java.io.IOException;
 import java.io.PrintWriter;
+import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 import junit.framework.Assert;
 
@@ -67,6 +71,20 @@ public class TestContainerManager extend
     LOG = LogFactory.getLog(TestContainerManager.class);
   }
 
+  private ContainerId createContainerId() {
+    ApplicationId appId = recordFactory.newRecordInstance(ApplicationId.class);
+    appId.setClusterTimestamp(0);
+    appId.setId(0);
+    ApplicationAttemptId appAttemptId = 
+        recordFactory.newRecordInstance(ApplicationAttemptId.class);
+    appAttemptId.setApplicationId(appId);
+    appAttemptId.setAttemptId(1);
+    ContainerId containerId = 
+        recordFactory.newRecordInstance(ContainerId.class);
+    containerId.setApplicationAttemptId(appAttemptId);
+    return containerId;
+  }
+  
   @Test
   public void testContainerManagerInitialization() throws IOException {
 
@@ -75,14 +93,9 @@ public class TestContainerManager extend
     // Just do a query for a non-existing container.
     boolean throwsException = false;
     try {
-      GetContainerStatusRequest request = recordFactory.newRecordInstance(GetContainerStatusRequest.class);
-      ApplicationId appId = recordFactory.newRecordInstance(ApplicationId.class);
-      ApplicationAttemptId appAttemptId = recordFactory.newRecordInstance(ApplicationAttemptId.class);
-      appAttemptId.setApplicationId(appId);
-      appAttemptId.setAttemptId(1);
-      ContainerId cId = recordFactory.newRecordInstance(ContainerId.class);
-      cId.setAppId(appId);
-      cId.setAppAttemptId(appAttemptId);
+      GetContainerStatusRequest request = 
+          recordFactory.newRecordInstance(GetContainerStatusRequest.class);
+      ContainerId cId = createContainerId();
       request.setContainerId(cId);
       containerManager.getContainerStatus(request);
     } catch (YarnRemoteException e) {
@@ -107,20 +120,14 @@ public class TestContainerManager extend
     ContainerLaunchContext container = recordFactory.newRecordInstance(ContainerLaunchContext.class);
 
     // ////// Construct the Container-id
-    ApplicationId appId = recordFactory.newRecordInstance(ApplicationId.class);
-    ApplicationAttemptId appAttemptId = recordFactory.newRecordInstance(ApplicationAttemptId.class);
-    appAttemptId.setApplicationId(appId);
-    appAttemptId.setAttemptId(1);
-    ContainerId cId = recordFactory.newRecordInstance(ContainerId.class);
-    cId.setAppId(appId);
-    cId.setAppAttemptId(appAttemptId);
+    ContainerId cId = createContainerId();
     container.setContainerId(cId);
 
     container.setUser(user);
 
     // ////// Construct the container-spec.
-    ContainerLaunchContext containerLaunchContext = recordFactory.newRecordInstance(ContainerLaunchContext.class);
-//    containerLaunchContext.resources = new HashMap<CharSequence, LocalResource>();
+    ContainerLaunchContext containerLaunchContext = 
+        recordFactory.newRecordInstance(ContainerLaunchContext.class);
     URL resource_alpha =
         ConverterUtils.getYarnUrlFromPath(localFS
             .makeQualified(new Path(file.getAbsolutePath())));
@@ -131,14 +138,17 @@ public class TestContainerManager extend
     rsrc_alpha.setType(LocalResourceType.FILE);
     rsrc_alpha.setTimestamp(file.lastModified());
     String destinationFile = "dest_file";
-    containerLaunchContext.setLocalResource(destinationFile, rsrc_alpha);
+    Map<String, LocalResource> localResources = 
+        new HashMap<String, LocalResource>();
+    localResources.put(destinationFile, rsrc_alpha);
+    containerLaunchContext.setLocalResources(localResources);
     containerLaunchContext.setUser(container.getUser());
     containerLaunchContext.setContainerId(container.getContainerId());
     containerLaunchContext.setResource(recordFactory
         .newRecordInstance(Resource.class));
-//    containerLaunchContext.command = new ArrayList<CharSequence>();
 
-    StartContainerRequest startRequest = recordFactory.newRecordInstance(StartContainerRequest.class);
+    StartContainerRequest startRequest = 
+        recordFactory.newRecordInstance(StartContainerRequest.class);
     startRequest.setContainerLaunchContext(containerLaunchContext);
     
     containerManager.startContainer(startRequest);
@@ -147,7 +157,7 @@ public class TestContainerManager extend
         ContainerState.COMPLETE);
 
     // Now ascertain that the resources are localised correctly.
-    // TODO: Don't we need clusterStamp in localDir?
+    ApplicationId appId = cId.getApplicationAttemptId().getApplicationId();
     String appIDStr = ConverterUtils.toString(appId);
     String containerIDStr = ConverterUtils.toString(cId);
     File userCacheDir = new File(localDir, ContainerLocalizer.USERCACHE);
@@ -187,41 +197,41 @@ public class TestContainerManager extend
     PrintWriter fileWriter = new PrintWriter(scriptFile);
     File processStartFile =
         new File(tmpDir, "start_file.txt").getAbsoluteFile();
-    fileWriter.write("\numask 0"); // So that start file is readable by the test.
+    fileWriter.write("\numask 0"); // So that start file is readable by the test
     fileWriter.write("\necho Hello World! > " + processStartFile);
     fileWriter.write("\necho $$ >> " + processStartFile);
     fileWriter.write("\nexec sleep 100");
     fileWriter.close();
 
-    ContainerLaunchContext containerLaunchContext = recordFactory.newRecordInstance(ContainerLaunchContext.class);
+    ContainerLaunchContext containerLaunchContext = 
+        recordFactory.newRecordInstance(ContainerLaunchContext.class);
 
     // ////// Construct the Container-id
-    ApplicationId appId = recordFactory.newRecordInstance(ApplicationId.class);
-    ApplicationAttemptId appAttemptId = recordFactory.newRecordInstance(ApplicationAttemptId.class);
-    appAttemptId.setApplicationId(appId);
-    appAttemptId.setAttemptId(1);
-    ContainerId cId = recordFactory.newRecordInstance(ContainerId.class);
-    cId.setAppId(appId);
-    cId.setAppAttemptId(appAttemptId);
+    ContainerId cId = createContainerId();
     containerLaunchContext.setContainerId(cId);
 
     containerLaunchContext.setUser(user);
 
-//    containerLaunchContext.resources =new HashMap<CharSequence, LocalResource>();
     URL resource_alpha =
         ConverterUtils.getYarnUrlFromPath(localFS
             .makeQualified(new Path(scriptFile.getAbsolutePath())));
-    LocalResource rsrc_alpha = recordFactory.newRecordInstance(LocalResource.class);
+    LocalResource rsrc_alpha =
+        recordFactory.newRecordInstance(LocalResource.class);
     rsrc_alpha.setResource(resource_alpha);
     rsrc_alpha.setSize(-1);
     rsrc_alpha.setVisibility(LocalResourceVisibility.APPLICATION);
     rsrc_alpha.setType(LocalResourceType.FILE);
     rsrc_alpha.setTimestamp(scriptFile.lastModified());
     String destinationFile = "dest_file";
-    containerLaunchContext.setLocalResource(destinationFile, rsrc_alpha);
+    Map<String, LocalResource> localResources = 
+        new HashMap<String, LocalResource>();
+    localResources.put(destinationFile, rsrc_alpha);
+    containerLaunchContext.setLocalResources(localResources);
     containerLaunchContext.setUser(containerLaunchContext.getUser());
-    containerLaunchContext.addCommand("/bin/bash");
-    containerLaunchContext.addCommand(scriptFile.getAbsolutePath());
+    List<String> commands = new ArrayList<String>();
+    commands.add("/bin/bash");
+    commands.add(scriptFile.getAbsolutePath());
+    containerLaunchContext.setCommands(commands);
     containerLaunchContext.setResource(recordFactory
         .newRecordInstance(Resource.class));
     containerLaunchContext.getResource().setMemory(100 * 1024 * 1024);
@@ -264,10 +274,12 @@ public class TestContainerManager extend
     BaseContainerManagerTest.waitForContainerState(containerManager, cId,
         ContainerState.COMPLETE);
     
-    GetContainerStatusRequest gcsRequest = recordFactory.newRecordInstance(GetContainerStatusRequest.class);
+    GetContainerStatusRequest gcsRequest = 
+        recordFactory.newRecordInstance(GetContainerStatusRequest.class);
     gcsRequest.setContainerId(cId);
-    ContainerStatus containerStatus = containerManager.getContainerStatus(gcsRequest).getStatus();
-    Assert.assertEquals(String.valueOf(ExitCode.KILLED.getExitCode()),
+    ContainerStatus containerStatus = 
+        containerManager.getContainerStatus(gcsRequest).getStatus();
+    Assert.assertEquals(ExitCode.KILLED.getExitCode(),
         containerStatus.getExitStatus());
 
     // Assert that the process is not alive anymore
@@ -300,13 +312,8 @@ public class TestContainerManager extend
     ContainerLaunchContext container = recordFactory.newRecordInstance(ContainerLaunchContext.class);
 
     // ////// Construct the Container-id
-    ApplicationId appId = recordFactory.newRecordInstance(ApplicationId.class);
-    ApplicationAttemptId appAttemptId = recordFactory.newRecordInstance(ApplicationAttemptId.class);
-    appAttemptId.setApplicationId(appId);
-    appAttemptId.setAttemptId(1);
-    ContainerId cId = recordFactory.newRecordInstance(ContainerId.class);
-    cId.setAppId(appId);
-    cId.setAppAttemptId(appAttemptId);
+    ContainerId cId = createContainerId();
+    ApplicationId appId = cId.getApplicationAttemptId().getApplicationId();
     container.setContainerId(cId);
 
     container.setUser(user);
@@ -325,7 +332,10 @@ public class TestContainerManager extend
     rsrc_alpha.setType(LocalResourceType.FILE);
     rsrc_alpha.setTimestamp(file.lastModified());
     String destinationFile = "dest_file";
-    containerLaunchContext.setLocalResource(destinationFile, rsrc_alpha);
+    Map<String, LocalResource> localResources = 
+        new HashMap<String, LocalResource>();
+    localResources.put(destinationFile, rsrc_alpha);
+    containerLaunchContext.setLocalResources(localResources);
     containerLaunchContext.setUser(container.getUser());
     containerLaunchContext.setContainerId(container.getContainerId());
     containerLaunchContext.setResource(recordFactory
@@ -340,7 +350,8 @@ public class TestContainerManager extend
     BaseContainerManagerTest.waitForContainerState(containerManager, cId,
         ContainerState.COMPLETE);
 
-    BaseContainerManagerTest.waitForApplicationState(containerManager, cId.getAppId(),
+    BaseContainerManagerTest.waitForApplicationState(containerManager, 
+        cId.getApplicationAttemptId().getApplicationId(),
         ApplicationState.RUNNING);
 
     // Now ascertain that the resources are localised correctly.
@@ -372,7 +383,8 @@ public class TestContainerManager extend
     containerManager.handle(new CMgrCompletedAppsEvent(Arrays
         .asList(new ApplicationId[] { appId })));
 
-    BaseContainerManagerTest.waitForApplicationState(containerManager, cId.getAppId(),
+    BaseContainerManagerTest.waitForApplicationState(containerManager, 
+        cId.getApplicationAttemptId().getApplicationId(),
         ApplicationState.FINISHED);
 
     // Now ascertain that the resources are localised correctly.

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/container/TestContainer.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/container/TestContainer.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/container/TestContainer.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/container/TestContainer.java Tue Sep 13 00:05:51 2011
@@ -418,7 +418,7 @@ public class TestContainer {
       } else {
         localResources = Collections.<String, LocalResource> emptyMap();
       }
-      when(ctxt.getAllLocalResources()).thenReturn(localResources);
+      when(ctxt.getLocalResources()).thenReturn(localResources);
 
       if (withServiceData) {
         Random r = new Random();
@@ -429,7 +429,7 @@ public class TestContainer {
       } else {
         serviceData = Collections.<String, ByteBuffer> emptyMap();
       }
-      when(ctxt.getAllServiceData()).thenReturn(serviceData);
+      when(ctxt.getServiceData()).thenReturn(serviceData);
 
       c = newContainer(dispatcher, ctxt);
       dispatcher.start();

Modified: hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/TestLocalizedResource.java
URL: http://svn.apache.org/viewvc/hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/TestLocalizedResource.java?rev=1169980&r1=1169979&r2=1169980&view=diff
==============================================================================
--- hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/TestLocalizedResource.java (original)
+++ hadoop/common/trunk/hadoop-mapreduce-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/localizer/TestLocalizedResource.java Tue Sep 13 00:05:51 2011
@@ -19,6 +19,7 @@ package org.apache.hadoop.yarn.server.no
 
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.security.Credentials;
+import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.api.records.ContainerId;
 import org.apache.hadoop.yarn.api.records.LocalResource;
@@ -48,9 +49,12 @@ public class TestLocalizedResource {
     ApplicationId appId = mock(ApplicationId.class);
     when(appId.getClusterTimestamp()).thenReturn(314159265L);
     when(appId.getId()).thenReturn(3);
+    ApplicationAttemptId appAttemptId = mock(ApplicationAttemptId.class);
+    when(appAttemptId.getApplicationId()).thenReturn(appId);
+    when(appAttemptId.getAttemptId()).thenReturn(0);
     ContainerId container = mock(ContainerId.class);
     when(container.getId()).thenReturn(id);
-    when(container.getAppId()).thenReturn(appId);
+    when(container.getApplicationAttemptId()).thenReturn(appAttemptId);
     return container;
   }
 



Mime
View raw message