hadoop-yarn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vino...@apache.org
Subject svn commit: r1494033 - in /hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project: ./ hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/ hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protoco...
Date Tue, 18 Jun 2013 06:25:10 GMT
Author: vinodkv
Date: Tue Jun 18 06:25:09 2013
New Revision: 1494033

URL: http://svn.apache.org/r1494033
Log:
YARN-841. Move Auxiliary service to yarn-api, annotate and document it. Contributed by Vinod
Kumar Vavilapalli.
svn merge --ignore-ancestry -c 1494031 ../../trunk/

Added:
    hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/
      - copied from r1494031, hadoop/common/trunk/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/server/
Modified:
    hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/CHANGES.txt
    hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StartContainerResponse.java
    hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/StartContainerResponsePBImpl.java
    hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerLaunchContext.java
    hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto
    hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/NMClientImpl.java
    hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/AuxServices.java
    hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/AuxServicesEvent.java
    hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/ContainerManagerImpl.java
    hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/TestAuxServices.java

Modified: hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/CHANGES.txt?rev=1494033&r1=1494032&r2=1494033&view=diff
==============================================================================
--- hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/CHANGES.txt (original)
+++ hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/CHANGES.txt Tue Jun 18 06:25:09
2013
@@ -149,6 +149,9 @@ Release 2.1.0-beta - UNRELEASED
     YARN-840. Moved ProtoUtils to yarn.api.records.pb.impl. (Jian He via
     acmurthy) 
 
+    YARN-841. Move Auxiliary service to yarn-api, annotate and document it.
+    (vinodkv)
+
   NEW FEATURES
 
     YARN-482. FS: Extend SchedulingMode to intermediate queues. 

Modified: hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StartContainerResponse.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StartContainerResponse.java?rev=1494033&r1=1494032&r2=1494033&view=diff
==============================================================================
--- hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StartContainerResponse.java
(original)
+++ hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/StartContainerResponse.java
Tue Jun 18 06:25:09 2013
@@ -42,32 +42,45 @@ public abstract class StartContainerResp
   @Private
   @Unstable
   public static StartContainerResponse newInstance(
-      Map<String, ByteBuffer> serviceResponses) {
+      Map<String, ByteBuffer> servicesMetaData) {
     StartContainerResponse response =
         Records.newRecord(StartContainerResponse.class);
-    response.setAllServiceResponse(serviceResponses);
+    response.setAllServicesMetaData(servicesMetaData);
     return response;
   }
 
   /**
-   * <p>Get the responses from all auxiliary services running on the 
-   * <code>NodeManager</code>.</p>
-   * <p>The responses are returned as a Map between the auxiliary service names
-   * and their corresponding opaque blob <code>ByteBuffer</code>s</p> 
-   * @return a Map between the auxiliary service names and their outputs
+   * <p>
+   * Get the meta-data from all auxiliary services running on the
+   * <code>NodeManager</code>.
+   * </p>
+   * <p>
+   * The meta-data is returned as a Map between the auxiliary service names and
+   * their corresponding per service meta-data as an opaque blob
+   * <code>ByteBuffer</code>
+   * </p>
+   * 
+   * <p>
+   * To be able to interpret the per-service meta-data, you should consult the
+   * documentation for the Auxiliary-service configured on the NodeManager
+   * </p>
+   * 
+   * @return a Map between the names of auxiliary services and their
+   *         corresponding meta-data
    */
   @Public
   @Stable
-  public abstract Map<String, ByteBuffer> getAllServiceResponse();
+  public abstract Map<String, ByteBuffer> getAllServicesMetaData();
 
   /**
    * Set to the list of auxiliary services which have been started on the
    * <code>NodeManager</code>. This is done only once when the
    * <code>NodeManager</code> starts up
-   * @param serviceResponses A map from auxiliary service names to the opaque
-   * blob <code>ByteBuffer</code>s for that auxiliary service
+   * @param allServicesMetaData A map from auxiliary service names to the opaque
+   * blob <code>ByteBuffer</code> for that auxiliary service
    */
   @Private
   @Unstable
-  public abstract void setAllServiceResponse(Map<String, ByteBuffer> serviceResponses);
+  public abstract void setAllServicesMetaData(
+      Map<String, ByteBuffer> allServicesMetaData);
 }

Modified: hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/StartContainerResponsePBImpl.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/StartContainerResponsePBImpl.java?rev=1494033&r1=1494032&r2=1494033&view=diff
==============================================================================
--- hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/StartContainerResponsePBImpl.java
(original)
+++ hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/protocolrecords/impl/pb/StartContainerResponsePBImpl.java
Tue Jun 18 06:25:09 2013
@@ -42,7 +42,7 @@ public class StartContainerResponsePBImp
   StartContainerResponseProto.Builder builder = null;
   boolean viaProto = false;
  
-  private Map<String, ByteBuffer> serviceResponse = null;
+  private Map<String, ByteBuffer> servicesMetaData = null;
 
   public StartContainerResponsePBImpl() {
     builder = StartContainerResponseProto.newBuilder();
@@ -81,8 +81,8 @@ public class StartContainerResponsePBImp
   }
 
   private synchronized void mergeLocalToBuilder() {
-    if (this.serviceResponse != null) {
-      addServiceResponseToProto();
+    if (this.servicesMetaData != null) {
+      addServicesMetaDataToProto();
     }
   }
   
@@ -112,38 +112,38 @@ public class StartContainerResponsePBImp
    
 
   @Override
-  public synchronized Map<String, ByteBuffer> getAllServiceResponse() {
-    initServiceResponse();
-    return this.serviceResponse;
+  public synchronized Map<String, ByteBuffer> getAllServicesMetaData() {
+    initServicesMetaData();
+    return this.servicesMetaData;
   }
   @Override
-  public synchronized void setAllServiceResponse(
-      Map<String, ByteBuffer> serviceResponses) {
-    if(serviceResponses == null) {
+  public synchronized void setAllServicesMetaData(
+      Map<String, ByteBuffer> servicesMetaData) {
+    if(servicesMetaData == null) {
       return;
     }
-    initServiceResponse();
-    this.serviceResponse.clear();
-    this.serviceResponse.putAll(serviceResponses);
+    initServicesMetaData();
+    this.servicesMetaData.clear();
+    this.servicesMetaData.putAll(servicesMetaData);
   }
   
-  private synchronized void initServiceResponse() {
-    if (this.serviceResponse != null) {
+  private synchronized void initServicesMetaData() {
+    if (this.servicesMetaData != null) {
       return;
     }
     StartContainerResponseProtoOrBuilder p = viaProto ? proto : builder;
-    List<StringBytesMapProto> list = p.getServiceResponseList();
-    this.serviceResponse = new HashMap<String, ByteBuffer>();
+    List<StringBytesMapProto> list = p.getServicesMetaDataList();
+    this.servicesMetaData = new HashMap<String, ByteBuffer>();
 
     for (StringBytesMapProto c : list) {
-      this.serviceResponse.put(c.getKey(), convertFromProtoFormat(c.getValue()));
+      this.servicesMetaData.put(c.getKey(), convertFromProtoFormat(c.getValue()));
     }
   }
   
-  private synchronized void addServiceResponseToProto() {
+  private synchronized void addServicesMetaDataToProto() {
     maybeInitBuilder();
-    builder.clearServiceResponse();
-    if (serviceResponse == null)
+    builder.clearServicesMetaData();
+    if (servicesMetaData == null)
       return;
     Iterable<StringBytesMapProto> iterable = new Iterable<StringBytesMapProto>()
{
       
@@ -151,7 +151,7 @@ public class StartContainerResponsePBImp
       public synchronized Iterator<StringBytesMapProto> iterator() {
         return new Iterator<StringBytesMapProto>() {
           
-          Iterator<String> keyIter = serviceResponse.keySet().iterator();
+          Iterator<String> keyIter = servicesMetaData.keySet().iterator();
           
           @Override
           public synchronized void remove() {
@@ -161,7 +161,7 @@ public class StartContainerResponsePBImp
           @Override
           public synchronized StringBytesMapProto next() {
             String key = keyIter.next();
-            return StringBytesMapProto.newBuilder().setKey(key).setValue(convertToProtoFormat(serviceResponse.get(key))).build();
+            return StringBytesMapProto.newBuilder().setKey(key).setValue(convertToProtoFormat(servicesMetaData.get(key))).build();
           }
           
           @Override
@@ -171,6 +171,6 @@ public class StartContainerResponsePBImp
         };
       }
     };
-    builder.addAllServiceResponse(iterable);
+    builder.addAllServicesMetaData(iterable);
   }
 }  

Modified: hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerLaunchContext.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerLaunchContext.java?rev=1494033&r1=1494032&r2=1494033&view=diff
==============================================================================
--- hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerLaunchContext.java
(original)
+++ hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/ContainerLaunchContext.java
Tue Jun 18 06:25:09 2013
@@ -25,6 +25,8 @@ import java.util.Map;
 import org.apache.hadoop.classification.InterfaceAudience.Public;
 import org.apache.hadoop.classification.InterfaceStability.Stable;
 import org.apache.hadoop.yarn.api.ContainerManagementProtocol;
+import org.apache.hadoop.yarn.server.api.ApplicationInitializationContext;
+import org.apache.hadoop.yarn.server.api.AuxiliaryService;
 import org.apache.hadoop.yarn.util.Records;
 
 /**
@@ -109,7 +111,19 @@ public abstract class ContainerLaunchCon
   public abstract void setLocalResources(Map<String, LocalResource> localResources);
 
   /**
-   * Get application-specific binary <em>service data</em>.
+   * <p>
+   * Get application-specific binary <em>service data</em>. This is a map keyed
+   * by the name of each {@link AuxiliaryService} that is configured on a
+   * NodeManager and value correspond to the application specific data targeted
+   * for the keyed {@link AuxiliaryService}.
+   * </p>
+   * 
+   * <p>
+   * This will be used to initialize this application on the specific
+   * {@link AuxiliaryService} running on the NodeManager by calling
+   * {@link AuxiliaryService#initializeApplication(ApplicationInitializationContext)}
+   * </p>
+   * 
    * @return application-specific binary <em>service data</em>
    */
   @Public
@@ -117,9 +131,16 @@ public abstract class ContainerLaunchCon
   public abstract Map<String, ByteBuffer> getServiceData();
   
   /**
-   * Set application-specific binary <em>service data</em>. All pre-existing
Map
-   * entries are preserved.
-   * @param serviceData application-specific binary <em>service data</em>
+   * <p>
+   * Get application-specific binary <em>service data</em>. This is a map keyed
+   * by the name of each {@link AuxiliaryService} that is configured on a
+   * NodeManager and value correspond to the application specific data targeted
+   * for the keyed {@link AuxiliaryService}. All pre-existing Map entries are
+   * preserved.
+   * </p>
+   * 
+   * @param serviceData
+   *          application-specific binary <em>service data</em>
    */
   @Public
   @Stable

Modified: hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto?rev=1494033&r1=1494032&r2=1494033&view=diff
==============================================================================
--- hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto
(original)
+++ hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/proto/yarn_service_protos.proto
Tue Jun 18 06:25:09 2013
@@ -160,7 +160,7 @@ message StartContainerRequestProto {
 }
 
 message StartContainerResponseProto {
-  repeated StringBytesMapProto service_response = 1;
+  repeated StringBytesMapProto services_meta_data = 1;
 }
 
 message StopContainerRequestProto {

Modified: hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/NMClientImpl.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/NMClientImpl.java?rev=1494033&r1=1494032&r2=1494033&view=diff
==============================================================================
--- hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/NMClientImpl.java
(original)
+++ hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/NMClientImpl.java
Tue Jun 18 06:25:09 2013
@@ -242,7 +242,7 @@ public class NMClientImpl extends NMClie
         LOG.warn("Container " + containerId + " failed to start", e);
         throw e;
       }
-      return startResponse.getAllServiceResponse();
+      return startResponse.getAllServicesMetaData();
     }
 
     public synchronized void stopContainer() throws YarnException,

Modified: hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/AuxServices.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/AuxServices.java?rev=1494033&r1=1494032&r2=1494033&view=diff
==============================================================================
--- hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/AuxServices.java
(original)
+++ hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/AuxServices.java
Tue Jun 18 06:25:09 2013
@@ -32,9 +32,11 @@ import org.apache.hadoop.service.Abstrac
 import org.apache.hadoop.service.Service;
 import org.apache.hadoop.service.ServiceStateChangeListener;
 import org.apache.hadoop.util.ReflectionUtils;
-import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.conf.YarnConfiguration;
 import org.apache.hadoop.yarn.event.EventHandler;
+import org.apache.hadoop.yarn.server.api.ApplicationTerminationContext;
+import org.apache.hadoop.yarn.server.api.AuxiliaryService;
+import org.apache.hadoop.yarn.server.api.ApplicationInitializationContext;
 
 public class AuxServices extends AbstractService
     implements ServiceStateChangeListener, EventHandler<AuxServicesEvent> {
@@ -42,13 +44,13 @@ public class AuxServices extends Abstrac
   private static final Log LOG = LogFactory.getLog(AuxServices.class);
 
   protected final Map<String,AuxiliaryService> serviceMap;
-  protected final Map<String,ByteBuffer> serviceMeta;
+  protected final Map<String,ByteBuffer> serviceMetaData;
 
   public AuxServices() {
     super(AuxServices.class.getName());
     serviceMap =
       Collections.synchronizedMap(new HashMap<String,AuxiliaryService>());
-    serviceMeta =
+    serviceMetaData =
       Collections.synchronizedMap(new HashMap<String,ByteBuffer>());
     // Obtain services from configuration in init()
   }
@@ -69,11 +71,11 @@ public class AuxServices extends Abstrac
    * If a service has not been started no metadata will be available. The key
    * is the name of the service as defined in the configuration.
    */
-  public Map<String, ByteBuffer> getMeta() {
+  public Map<String, ByteBuffer> getMetaData() {
     Map<String, ByteBuffer> metaClone = new HashMap<String, ByteBuffer>(
-        serviceMeta.size());
-    synchronized (serviceMeta) {
-      for (Entry<String, ByteBuffer> entry : serviceMeta.entrySet()) {
+        serviceMetaData.size());
+    synchronized (serviceMetaData) {
+      for (Entry<String, ByteBuffer> entry : serviceMetaData.entrySet()) {
         metaClone.put(entry.getKey(), entry.getValue().duplicate());
       }
     }
@@ -121,9 +123,9 @@ public class AuxServices extends Abstrac
       String name = entry.getKey();
       service.start();
       service.registerServiceListener(this);
-      ByteBuffer meta = service.getMeta();
+      ByteBuffer meta = service.getMetaData();
       if(meta != null) {
-        serviceMeta.put(name, meta);
+        serviceMetaData.put(name, meta);
       }
     }
     super.serviceStart();
@@ -140,7 +142,7 @@ public class AuxServices extends Abstrac
           }
         }
         serviceMap.clear();
-        serviceMeta.clear();
+        serviceMetaData.clear();
       }
     } finally {
       super.serviceStop();
@@ -167,12 +169,13 @@ public class AuxServices extends Abstrac
         // TODO kill all containers waiting on Application
         return;
       }
-      service.initApp(event.getUser(), event.getApplicationID(),
-          event.getServiceData());
+      service.initializeApplication(new ApplicationInitializationContext(event
+        .getUser(), event.getApplicationID(), event.getServiceData()));
       break;
     case APPLICATION_STOP:
       for (AuxiliaryService serv : serviceMap.values()) {
-        serv.stopApp(event.getApplicationID());
+        serv.stopApplication(new ApplicationTerminationContext(event
+          .getApplicationID()));
       }
       break;
     default:
@@ -180,18 +183,4 @@ public class AuxServices extends Abstrac
     }
   }
 
-  public interface AuxiliaryService extends Service {
-    void initApp(String user, ApplicationId appId, ByteBuffer data);
-    void stopApp(ApplicationId appId);
-    /**
-     * Retreive metadata for this service.  This is likely going to be contact
-     * information so that applications can access the service remotely.  Ideally
-     * each service should provide a method to parse out the information to a usable
-     * class.  This will only be called after the services start method has finished.
-     * the result may be cached.
-     * @return metadata for this service that should be made avaiable to applications.
-     */
-    ByteBuffer getMeta();
-  }
-
 }

Modified: hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/AuxServicesEvent.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/AuxServicesEvent.java?rev=1494033&r1=1494032&r2=1494033&view=diff
==============================================================================
--- hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/AuxServicesEvent.java
(original)
+++ hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/AuxServicesEvent.java
Tue Jun 18 06:25:09 2013
@@ -22,7 +22,6 @@ import java.nio.ByteBuffer;
 
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.event.AbstractEvent;
-import org.apache.hadoop.yarn.event.Event;
 
 public class AuxServicesEvent extends AbstractEvent<AuxServicesEventType> {
 

Modified: hadoop/common/branches/branch-2.1-beta/hadoop-yarn-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/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/ContainerManagerImpl.java?rev=1494033&r1=1494032&r2=1494033&view=diff
==============================================================================
--- hadoop/common/branches/branch-2.1-beta/hadoop-yarn-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/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/ContainerManagerImpl.java
Tue Jun 18 06:25:09 2013
@@ -491,8 +491,7 @@ public class ContainerManagerImpl extend
         applicationID, containerID);
 
     StartContainerResponse response =
-        recordFactory.newRecordInstance(StartContainerResponse.class);
-    response.setAllServiceResponse(auxiliaryServices.getMeta());
+        StartContainerResponse.newInstance(auxiliaryServices.getMetaData());
     // TODO launchedContainer misplaced -> doesn't necessarily mean a container
     // launch. A finished Application will not launch containers.
     metrics.launchedContainer();

Modified: hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/TestAuxServices.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/TestAuxServices.java?rev=1494033&r1=1494032&r2=1494033&view=diff
==============================================================================
--- hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/TestAuxServices.java
(original)
+++ hadoop/common/branches/branch-2.1-beta/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/test/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/TestAuxServices.java
Tue Jun 18 06:25:09 2013
@@ -33,17 +33,19 @@ import java.util.Map;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.service.AbstractService;
 import org.apache.hadoop.service.Service;
 import org.apache.hadoop.yarn.api.records.ApplicationId;
 import org.apache.hadoop.yarn.conf.YarnConfiguration;
+import org.apache.hadoop.yarn.server.api.ApplicationInitializationContext;
+import org.apache.hadoop.yarn.server.api.ApplicationTerminationContext;
+import org.apache.hadoop.yarn.server.api.AuxiliaryService;
 import org.junit.Test;
 
 public class TestAuxServices {
   private static final Log LOG = LogFactory.getLog(TestAuxServices.class);
 
-  static class LightService extends AbstractService
-      implements AuxServices.AuxiliaryService {
+  static class LightService extends AuxiliaryService implements Service
+       {
     private final char idef;
     private final int expected_appId;
     private int remaining_init;
@@ -79,17 +81,18 @@ public class TestAuxServices {
       super.serviceStop();
     }
     @Override
-    public void initApp(String user, ApplicationId appId, ByteBuffer data) {
+    public void initializeApplication(ApplicationInitializationContext context) {
+      ByteBuffer data = context.getApplicationDataForService();
       assertEquals(idef, data.getChar());
       assertEquals(expected_appId, data.getInt());
-      assertEquals(expected_appId, appId.getId());
+      assertEquals(expected_appId, context.getApplicationId().getId());
     }
     @Override
-    public void stopApp(ApplicationId appId) {
-      stoppedApps.add(appId.getId());
+    public void stopApplication(ApplicationTerminationContext context) {
+      stoppedApps.add(context.getApplicationId().getId());
     }
     @Override
-    public ByteBuffer getMeta() {
+    public ByteBuffer getMetaData() {
       return meta;
     }
   }
@@ -133,8 +136,8 @@ public class TestAuxServices {
         AuxServicesEventType.APPLICATION_STOP, "user0", appId2, "Bsrv", null);
     // verify all services got the stop event 
     aux.handle(event);
-    Collection<AuxServices.AuxiliaryService> servs = aux.getServices();
-    for (AuxServices.AuxiliaryService serv: servs) {
+    Collection<AuxiliaryService> servs = aux.getServices();
+    for (AuxiliaryService serv: servs) {
       ArrayList<Integer> appIds = ((LightService)serv).getAppIdsStopped();
       assertEquals("app not properly stopped", 1, appIds.size());
       assertTrue("wrong app stopped", appIds.contains((Integer)66));
@@ -196,7 +199,7 @@ public class TestAuxServices {
       assertEquals(STARTED, s.getServiceState());
     }
 
-    Map<String, ByteBuffer> meta = aux.getMeta();
+    Map<String, ByteBuffer> meta = aux.getMetaData();
     assertEquals(2, meta.size());
     assertEquals("A", new String(meta.get("Asrv").array()));
     assertEquals("B", new String(meta.get("Bsrv").array()));



Mime
View raw message