hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sun...@apache.org
Subject [17/50] [abbrv] hadoop git commit: YARN-6255. Refactor yarn-native-services framework. Contributed by Jian He
Date Tue, 30 May 2017 17:10:37 GMT
http://git-wip-us.apache.org/repos/asf/hadoop/blob/99c1074c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/SliderClientAPI.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/SliderClientAPI.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/SliderClientAPI.java
index c6cc2d0..2bb224b 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/SliderClientAPI.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/SliderClientAPI.java
@@ -23,6 +23,7 @@ import org.apache.hadoop.service.Service;
 import org.apache.hadoop.yarn.api.records.ApplicationReport;
 import org.apache.hadoop.yarn.api.records.YarnApplicationState;
 import org.apache.hadoop.yarn.exceptions.YarnException;
+import org.apache.slider.api.resource.Application;
 import org.apache.slider.api.types.NodeInformationList;
 import org.apache.slider.api.types.SliderInstanceDescription;
 import org.apache.slider.common.params.AbstractClusterBuildingActionArgs;
@@ -61,15 +62,8 @@ import java.util.Map;
  * Stability: evolving
  */
 public interface SliderClientAPI extends Service {
-  /**
-   * Destroy a cluster. There's two race conditions here
-   * #1 the cluster is started between verifying that there are no live
-   * clusters of that name.
-   */
-  int actionDestroy(String clustername, ActionDestroyArgs destroyArgs)
-      throws YarnException, IOException;
 
-  int actionDestroy(String clustername) throws YarnException,
+  void actionDestroy(String clustername) throws YarnException,
       IOException;
 
   /**
@@ -88,18 +82,6 @@ public interface SliderClientAPI extends Service {
     throws SliderException;
 
   /**
-   * Build up the cluster specification/directory
-   *
-   * @param clustername cluster name
-   * @param buildInfo the arguments needed to build the cluster
-   * @throws YarnException Yarn problems
-   * @throws IOException other problems
-   * @throws BadCommandArgumentsException bad arguments.
-   */
-  int actionBuild(String clustername,
-      AbstractClusterBuildingActionArgs buildInfo) throws YarnException, IOException;
-
-  /**
    * Upload keytab to a designated sub-directory of the user home directory
    *
    * @param installKeytabInfo the arguments needed to upload the keytab
@@ -188,24 +170,7 @@ public interface SliderClientAPI extends Service {
    */
   int actionUpgrade(String clustername,
       ActionUpgradeArgs buildInfo)
-      throws YarnException, IOException; 
-
-  /**
-   * Get the report of a this application
-   * @return the app report or null if it could not be found.
-   * @throws IOException
-   * @throws YarnException
-   */
-  ApplicationReport getApplicationReport()
-      throws IOException, YarnException;
-
-  /**
-   * Kill the submitted application via YARN
-   * @throws YarnException
-   * @throws IOException
-   */
-  boolean forceKillApplication(String reason)
-    throws YarnException, IOException;
+      throws YarnException, IOException;
 
   /**
    * Implement the list action: list all nodes
@@ -213,30 +178,8 @@ public interface SliderClientAPI extends Service {
    */
   int actionList(String clustername, ActionListArgs args) throws IOException, YarnException;
 
-  /**
-   * Enumerate slider instances for the current user, and the
-   * most recent app report, where available.
-   * @param listOnlyInState boolean to indicate that the instances should
-   * only include those in a YARN state
-   * <code> minAppState &lt;= currentState &lt;= maxAppState </code>
-   *
-   * @param minAppState minimum application state to include in enumeration.
-   * @param maxAppState maximum application state to include
-   * @return a map of application instance name to description
-   * @throws IOException Any IO problem
-   * @throws YarnException YARN problems
-   */
-  Map<String, SliderInstanceDescription> enumSliderInstances(
-      boolean listOnlyInState,
-      YarnApplicationState minAppState,
-      YarnApplicationState maxAppState)
-      throws IOException, YarnException;
 
-  /**
-   * Implement the islive action: probe for a cluster of the given name existing
-   * @return exit code
-   */
-  int actionFlex(String name, ActionFlexArgs args) throws YarnException, IOException;
+  void actionFlex(String name, ActionFlexArgs args) throws YarnException, IOException;
 
   /**
    * Test for a cluster existing probe for a cluster of the given name existing
@@ -288,7 +231,7 @@ public interface SliderClientAPI extends Service {
    * @throws YarnException
    * @throws IOException
    */
-  String actionStatus(String clustername) throws YarnException, IOException;
+  Application actionStatus(String clustername) throws YarnException, IOException;
 
   /**
    * Version Details
@@ -303,13 +246,13 @@ public interface SliderClientAPI extends Service {
    * @param freezeArgs arguments to the stop
    * @return EXIT_SUCCESS if the cluster was not running by the end of the operation
    */
-  int actionFreeze(String clustername, ActionFreezeArgs freezeArgs)
+  void actionStop(String clustername, ActionFreezeArgs freezeArgs)
       throws YarnException, IOException;
 
   /**
    * Restore a cluster
    */
-  int actionThaw(String clustername, ActionThawArgs thaw) throws YarnException, IOException;
+  int actionStart(String clustername, ActionThawArgs thaw) throws YarnException, IOException;
 
   /**
    * Registry operation

http://git-wip-us.apache.org/repos/asf/hadoop/blob/99c1074c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/SliderYarnClientImpl.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/SliderYarnClientImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/SliderYarnClientImpl.java
index 258ef31..4839395 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/SliderYarnClientImpl.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/SliderYarnClientImpl.java
@@ -60,6 +60,10 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 
+//TODO, Remove this class and YarnAppListClient
+// why do we need so many yarn client wrappers ?
+// - yarn client already provides most of functionality already
+
 /**
  * A class that extends visibility to some of the YarnClientImpl
  * members and data structures, and factors out pure-YARN operations
@@ -69,25 +73,6 @@ public class SliderYarnClientImpl extends YarnClientImpl {
   protected static final Logger log = LoggerFactory.getLogger(SliderYarnClientImpl.class);
 
   /**
-   * Keyword to use in the {@link #emergencyForceKill(String)}
-   * operation to force kill <i>all</i> application instances belonging
-   * to a specific user
-   */
-  public static final String KILL_ALL = "all";
-
-  @Override
-  protected void serviceInit(Configuration conf) throws Exception {
-    InetSocketAddress clientRpcAddress = SliderUtils.getRmAddress(conf);
-    if (!SliderUtils.isAddressDefined(clientRpcAddress)) {
-      // address isn't known; fail fast
-      throw new BindException("Invalid " + YarnConfiguration.RM_ADDRESS
-          + " value:" + conf.get(YarnConfiguration.RM_ADDRESS)
-          + " - see https://wiki.apache.org/hadoop/UnsetHostnameOrPort");
-    }
-    super.serviceInit(conf);
-  }
-
-  /**
    * Get the RM Client RPC interface
    * @return an RPC interface valid after initialization and authentication
    */
@@ -96,52 +81,6 @@ public class SliderYarnClientImpl extends YarnClientImpl {
   }
 
   /**
-   * List Slider <i>running</i>instances belonging to a specific user.
-   * @deprecated use {@link #listDeployedInstances(String)}
-   * @param user user: "" means all users
-   * @return a possibly empty list of Slider AMs
-   */
-  public List<ApplicationReport> listInstances(String user)
-    throws YarnException, IOException {
-    return listDeployedInstances(user);
-  }
-
-  /**
-   * List Slider <i>deployed</i>instances belonging to a specific user.
-   * <p>
-   *   Deployed means: known about in the YARN cluster; it will include
-   *   any that are in the failed/finished state, as well as those queued
-   *   for starting.
-   * @param user user: "" means all users
-   * @return a possibly empty list of Slider AMs
-   */
-  public List<ApplicationReport> listDeployedInstances(String user)
-    throws YarnException, IOException {
-    return listDeployedInstances(user, null);
-  }
-
-  /**
-   * List Slider <i>deployed</i>instances belonging to a specific user in a
-   * given set of states.
-   * <p>
-   * Deployed means: known about in the YARN cluster; it will include all apps
-   * in the specified set of states.
-   *
-   * @param user
-   *          user: "" means all users
-   * @param appStates
-   *          filter by a set of YarnApplicationState
-   * @return a possibly empty list of Slider AMs
-   * @throws YarnException
-   * @throws IOException
-   */
-  public List<ApplicationReport> listDeployedInstances(String user,
-      EnumSet<YarnApplicationState> appStates)
-      throws YarnException, IOException {
-    return listDeployedInstances(user, appStates, null);
-  }
-
-  /**
    * List Slider <i>deployed</i>instances belonging to a specific user in a
    * given set of states and filtered by an application name tag.
    * <p>
@@ -178,21 +117,6 @@ public class SliderYarnClientImpl extends YarnClientImpl {
     }
     return results;
   }
-
-  /**
-   * find all instances of a specific app -if there is more than one in the
-   * YARN cluster,
-   * this returns them all
-   * @param user user; use "" for all users
-   * @param appname application name
-   * @return the list of all matching application instances
-   */
-  public List<ApplicationReport> findAllInstances(String user, String appname)
-      throws IOException, YarnException {
-    Preconditions.checkArgument(appname != null, "Null application name");
-
-    return listDeployedInstances(user, null, appname);
-  }
   
   /**
    * Helper method to determine if a cluster application is running -or
@@ -206,122 +130,6 @@ public class SliderYarnClientImpl extends YarnClientImpl {
     return app.getYarnApplicationState().ordinal() <= YarnApplicationState.RUNNING.ordinal();
   }
 
-
-  /**
-   * Kill a running application
-   * @param applicationId app Id
-   * @param reason reason: reason for log
-   * @return the response
-   * @throws YarnException YARN problems
-   * @throws IOException IO problems
-   */
-  public  KillApplicationResponse killRunningApplication(ApplicationId applicationId,
-                                                         String reason)
-      throws YarnException, IOException {
-    Preconditions.checkArgument(applicationId != null, "Null application Id");
-    log.info("Killing application {} - {}", applicationId.getClusterTimestamp(),
-             reason);
-    KillApplicationRequest request =
-      Records.newRecord(KillApplicationRequest.class);
-    request.setApplicationId(applicationId);
-    return getRmClient().forceKillApplication(request);
-  }
-
-  private String getUsername() throws IOException {
-    return UserGroupInformation.getCurrentUser().getShortUserName();
-  }
-  
-  /**
-   * Force kill a yarn application by ID. No niceties here
-   * @param applicationId app Id. "all" means "kill all instances of the current user
-   * 
-   */
-  public void emergencyForceKill(String applicationId)
-      throws YarnException, IOException {
-
-    Preconditions.checkArgument(StringUtils.isNotEmpty(applicationId),
-        "Null/empty application Id");
-
-    if (KILL_ALL.equals(applicationId)) {
-      // user wants all instances killed
-      String user = getUsername();
-      log.info("Killing all applications belonging to {}", user);
-      Collection<ApplicationReport> instances = listDeployedInstances(user,
-          SliderUtils.getAllLiveAppStates());
-      for (ApplicationReport instance : instances) {
-        ApplicationId appId = instance.getApplicationId();
-        log.info("Killing Application {}", appId);
-        killRunningApplication(appId, "forced kill");
-      }
-    } else {
-      ApplicationId appId = ConverterUtils.toApplicationId(applicationId);
-
-      log.info("Killing Application {}", applicationId);
-
-      killRunningApplication(appId, "forced kill");
-    }
-  }
-
-  /**
-   * Monitor the submitted application for reaching the requested state.
-   * Will also report if the app reaches a later state (failed, killed, etc)
-   * Kill application if duration!= null & time expires. 
-   * @param appId Application Id of application to be monitored
-   * @param duration how long to wait -must be more than 0
-   * @param desiredState desired state.
-   * @return the application report -null on a timeout
-   * @throws YarnException
-   * @throws IOException
-   */
-  public ApplicationReport monitorAppToState(
-    ApplicationId appId, YarnApplicationState desiredState, Duration duration)
-    throws YarnException, IOException {
-
-    if (appId == null) {
-      throw new BadCommandArgumentsException("null application ID");
-    }
-    if (duration.limit <= 0) {
-      throw new BadCommandArgumentsException("Invalid monitoring duration");
-    }
-    log.debug("Waiting {} millis for app to reach state {} ",
-              duration.limit,
-              desiredState);
-    duration.start();
-    try {
-      while (true) {
-        // Get application report for the appId we are interested in
-
-        ApplicationReport r = getApplicationReport(appId);
-
-        log.debug("queried status is\n{}",
-          new SliderUtils.OnDemandReportStringifier(r));
-
-        YarnApplicationState state = r.getYarnApplicationState();
-        if (state.ordinal() >= desiredState.ordinal()) {
-          log.debug("App in desired state (or higher) :{}", state);
-          return r;
-        }
-        if (duration.getLimitExceeded()) {
-          log.debug(
-            "Wait limit of {} millis to get to state {}, exceeded; app status\n {}",
-            duration.limit,
-            desiredState,
-            new SliderUtils.OnDemandReportStringifier(r));
-          return null;
-        }
-
-        // sleep 1s.
-        try {
-          Thread.sleep(1000);
-        } catch (InterruptedException ignored) {
-          log.debug("Thread sleep in monitoring loop interrupted");
-        }
-      }
-    } finally {
-      duration.close();
-    }
-  }
-
   /**
    * find all live instances of a specific app -if there is >1 in the cluster,
    * this returns them all. State should be running or less

http://git-wip-us.apache.org/repos/asf/hadoop/blob/99c1074c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/ipc/SliderApplicationIpcClient.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/ipc/SliderApplicationIpcClient.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/ipc/SliderApplicationIpcClient.java
index a007326..3b5147f 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/ipc/SliderApplicationIpcClient.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/ipc/SliderApplicationIpcClient.java
@@ -112,17 +112,6 @@ public class SliderApplicationIpcClient implements SliderApplicationApi {
     }
   }
 
-
-  @Override
-  public void putDesiredResources(ConfTree updated) throws IOException {
-    try {
-      operations.flex(updated);
-    } catch (IOException e) {
-      throw convert(e);
-    }
-  }
-
-  
   @Override
   public AggregateConf getResolvedModel() throws IOException {
     try {

http://git-wip-us.apache.org/repos/asf/hadoop/blob/99c1074c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java
index 702233a..623b8b0 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java
@@ -25,6 +25,8 @@ import org.apache.slider.api.ClusterNode;
 import org.apache.slider.api.SliderClusterProtocol;
 import org.apache.slider.api.StateValues;
 import org.apache.slider.api.proto.Messages;
+import org.apache.slider.api.resource.Application;
+import org.apache.slider.api.resource.Component;
 import org.apache.slider.api.types.ApplicationLivenessInformation;
 import org.apache.slider.api.types.ComponentInformation;
 import org.apache.slider.api.types.ContainerInformation;
@@ -39,6 +41,7 @@ import org.apache.slider.core.exceptions.NoSuchNodeException;
 import org.apache.slider.core.exceptions.SliderException;
 import org.apache.slider.core.exceptions.WaitTimeoutException;
 import org.apache.slider.core.persist.ConfTreeSerDeser;
+import org.apache.slider.core.persist.JsonSerDeser;
 import org.codehaus.jackson.JsonParseException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -61,6 +64,8 @@ public class SliderClusterOperations {
     log = LoggerFactory.getLogger(SliderClusterOperations.class);
   
   private final SliderClusterProtocol appMaster;
+  private static final JsonSerDeser<Application> jsonSerDeser =
+      new JsonSerDeser<Application>(Application.class);
   private static final Messages.EmptyPayloadProto EMPTY;
   static {
     EMPTY = Messages.EmptyPayloadProto.newBuilder().build(); 
@@ -130,49 +135,21 @@ public class SliderClusterOperations {
    * Connect to a live cluster and get its current state
    * @return its description
    */
-  public ClusterDescription getClusterDescription()
-    throws YarnException, IOException {
-    
+  public Application getApplication() throws YarnException, IOException {
     Messages.GetJSONClusterStatusRequestProto req =
       Messages.GetJSONClusterStatusRequestProto.newBuilder().build();
     Messages.GetJSONClusterStatusResponseProto resp =
       appMaster.getJSONClusterStatus(req);
     String statusJson = resp.getClusterSpec();
     try {
-      return ClusterDescription.fromJson(statusJson);
+      return jsonSerDeser.fromJson(statusJson);
     } catch (JsonParseException e) {
-      log.error("Exception " + e + " parsing:\n" + statusJson, e);
+      log.error("Error when parsing app json file", e);
       throw e;
     }
   }
 
   /**
-   * Get the AM instance definition.
-   * <p>
-   *   See {@link SliderClusterProtocol#getInstanceDefinition(Messages.GetInstanceDefinitionRequestProto)}
-   * @return current slider AM aggregate definition
-   * @throws YarnException
-   * @throws IOException
-   */
-  public AggregateConf getInstanceDefinition()
-    throws YarnException, IOException {
-    Messages.GetInstanceDefinitionRequestProto.Builder builder =
-      Messages.GetInstanceDefinitionRequestProto.newBuilder();
-
-    Messages.GetInstanceDefinitionRequestProto request = builder.build();
-    Messages.GetInstanceDefinitionResponseProto response =
-      appMaster.getInstanceDefinition(request);
-
-    ConfTreeSerDeser confTreeSerDeser = new ConfTreeSerDeser();
-
-    ConfTree internal = confTreeSerDeser.fromJson(response.getInternal());
-    ConfTree resources = confTreeSerDeser.fromJson(response.getResources());
-    ConfTree app = confTreeSerDeser.fromJson(response.getApplication());
-    AggregateConf instanceDefinition =
-      new AggregateConf(resources, app, internal);
-    return instanceDefinition;
-  }
-  /**
    * Kill a container
    * @param id container ID
    * @return a success flag
@@ -315,22 +292,14 @@ public class SliderClusterOperations {
     return state;
   }
 
-  /**
-   * Flex operation
-   * @param resources new resources
-   * @return the response
-   * @throws IOException
-   */
-  public boolean flex(ConfTree resources) throws IOException {
-    Messages.FlexClusterRequestProto request =
-      Messages.FlexClusterRequestProto.newBuilder()
-              .setClusterSpec(resources.toJson())
-              .build();
-    Messages.FlexClusterResponseProto response = appMaster.flexCluster(request);
-    return response.getResponse();
+  public void flex(Component component) throws IOException{
+    Messages.FlexComponentRequestProto request =
+        Messages.FlexComponentRequestProto.newBuilder()
+            .setNumberOfContainers(component.getNumberOfContainers().intValue())
+            .setName(component.getName()).build();
+        appMaster.flexComponent(request);
   }
 
-
   /**
    * Commit (possibly delayed) AM suicide
    *

http://git-wip-us.apache.org/repos/asf/hadoop/blob/99c1074c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java
index 573ef64..4c376e0 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/rest/SliderApplicationApiRestClient.java
@@ -177,29 +177,6 @@ public class SliderApplicationApiRestClient extends BaseRestClient
   }
 
   @Override
-  public void putDesiredResources(ConfTree updated) throws IOException {
-    WebResource resource = applicationResource(MODEL_DESIRED_RESOURCES);
-    try {
-
-      // put operation. The result is discarded; it does help validate
-      // that the operation returned a JSON data structure as well as a 200
-      // response.
-
-      resource.accept(MediaType.APPLICATION_JSON_TYPE)
-              .type(MediaType.APPLICATION_JSON_TYPE)
-              .entity(updated)
-              .put(ConfTree.class);
-    } catch (ClientHandlerException ex) {
-        throw ExceptionConverter.convertJerseyException("PUT",
-            resource.getURI().toString(),
-            ex);
-      } catch (UniformInterfaceException ex) {
-      throw ExceptionConverter.convertJerseyException("PUT",
-          resource.getURI().toString(), ex);
-      }
-  }
-
-  @Override
   public AggregateConf getResolvedModel() throws IOException {
     return getApplicationResource(MODEL_RESOLVED, AggregateConf.class);
   }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/99c1074c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/SliderKeys.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/SliderKeys.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/SliderKeys.java
index 4bf1b5b..9a4fa6c 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/SliderKeys.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/SliderKeys.java
@@ -18,6 +18,8 @@
 
 package org.apache.slider.common;
 
+import org.apache.hadoop.yarn.api.ApplicationConstants;
+
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
@@ -50,7 +52,7 @@ public interface SliderKeys extends SliderXmlConfKeys {
   String SLIDER_DEPENDENCY_LOCALIZED_DIR_LINK = "slider_dep";
   String SLIDER_DEPENDENCY_HDP_PARENT_DIR = "/hdp";
   String SLIDER_DEPENDENCY_DIR = "/apps/%s/slider";
-  String SLIDER_DEPENDENCY_TAR_GZ_FILE_NAME = "slider";
+  String SLIDER_DEPENDENCY_TAR_GZ_FILE_NAME = "slider-dep";
   String SLIDER_DEPENDENCY_TAR_GZ_FILE_EXT = ".tar.gz";
   String SLIDER_DEPENDENCY_DIR_PERMISSIONS = "755";
 
@@ -181,7 +183,7 @@ public interface SliderKeys extends SliderXmlConfKeys {
   /**
    * name of generated dir for this conf: {@value}
    */
-  String SUBMITTED_CONF_DIR = "confdir";
+  String SUBMITTED_CONF_DIR = "conf";
 
   /**
    * Slider AM log4j file name : {@value}
@@ -227,7 +229,7 @@ public interface SliderKeys extends SliderXmlConfKeys {
    */
   String ADDONS_DIR = "addons";
 
-  String SLIDER_JAR = "slider.jar";
+  String SLIDER_JAR = "slider-core.jar";
   String JCOMMANDER_JAR = "jcommander.jar";
   String GSON_JAR = "gson.jar";
   String DEFAULT_APP_PKG = "appPkg.zip";
@@ -238,7 +240,7 @@ public interface SliderKeys extends SliderXmlConfKeys {
   String STDERR_AM = "slider-err.txt";
   String DEFAULT_GC_OPTS = "";
 
-  String HADOOP_USER_NAME = "HADOOP_USER_NAME";
+  String HADOOP_USER_NAME = ApplicationConstants.Environment.USER.toString();
   String HADOOP_PROXY_USER = "HADOOP_PROXY_USER";
   String SLIDER_PASSPHRASE = "SLIDER_PASSPHRASE";
 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/99c1074c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/SliderXmlConfKeys.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/SliderXmlConfKeys.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/SliderXmlConfKeys.java
index 72dd44f..b666834 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/SliderXmlConfKeys.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/SliderXmlConfKeys.java
@@ -73,6 +73,9 @@ public interface SliderXmlConfKeys {
   int DEFAULT_YARN_QUEUE_PRIORITY = 1;
 
 
+  String KEY_AM_RESOURCE_MEM = "slider.am.resource.memory";
+  long DEFAULT_KEY_AM_RESOURCE_MEM = 1024;
+
   /**
    * The slider base path: {@value}
    * Defaults to HomeDir/.slider

http://git-wip-us.apache.org/repos/asf/hadoop/blob/99c1074c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/AbstractActionArgs.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/AbstractActionArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/AbstractActionArgs.java
index 63ccff8..6dd61fa 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/AbstractActionArgs.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/AbstractActionArgs.java
@@ -69,7 +69,7 @@ public abstract class AbstractActionArgs extends ArgOps implements Arguments {
   /**
    -D name=value
 
-   Define an HBase configuration option which overrides any options in
+   Define an configuration option which overrides any options in
    the configuration XML files of the image or in the image configuration
    directory. The values will be persisted.
    Configuration options are only passed to the cluster when creating or reconfiguring a cluster.

http://git-wip-us.apache.org/repos/asf/hadoop/blob/99c1074c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/AbstractClusterBuildingActionArgs.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/AbstractClusterBuildingActionArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/AbstractClusterBuildingActionArgs.java
index 1d28c78..2d471ed 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/AbstractClusterBuildingActionArgs.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/AbstractClusterBuildingActionArgs.java
@@ -35,186 +35,13 @@ import java.util.Map;
  * Abstract Action to build things; shares args across build and
  * list
  */
-public abstract class AbstractClusterBuildingActionArgs extends
-    AbstractActionArgs {
-
-  /**
-   * Declare the image configuration directory to use when creating or
-   * reconfiguring a slider cluster. The path must be on a filesystem visible
-   * to all nodes in the YARN cluster. Only one configuration directory can
-   * be specified.
-   */
-  @Parameter(names = ARG_CONFDIR,
-      description = "Path to cluster configuration directory in HDFS",
-      converter = PathArgumentConverter.class)
-  public Path confdir;
-
-  @Parameter(names = ARG_ZKPATH,
-      description = "Zookeeper path for the application")
-  public String appZKPath;
-
-  @Parameter(names = ARG_ZKHOSTS,
-      description = "comma separated list of the Zookeeper hosts")
-  public String zkhosts;
-
-  /**
-   * --image path
-   * the full path to a .tar or .tar.gz path containing an HBase image.
-   */
-  @Parameter(names = ARG_IMAGE,
-      description = "The full path to a .tar or .tar.gz path containing the application",
-      converter = PathArgumentConverter.class)
-  public Path image;
-
-  @Parameter(names = ARG_APP_HOME,
-      description = "Home directory of a pre-installed application")
-  public String appHomeDir;
-
-  @Parameter(names = ARG_PROVIDER,
-      description = "Provider of the specific cluster application")
-  public String provider = SliderProviderFactory.DEFAULT_CLUSTER_TYPE;
-
-  @Parameter(names = {ARG_PACKAGE},
-      description = "URI to a slider package")
-  public String packageURI;
-
-  @Parameter(names = {ARG_RESOURCES},
-      description = "File defining the resources of this instance")
-  public File resources;
-
-  @Parameter(names = {ARG_TEMPLATE},
-      description = "Template application configuration")
-  public File template;
-
-  @Parameter(names = {ARG_METAINFO},
-      description = "Application meta info file")
-  public File appMetaInfo;
-
-  @Parameter(names = {ARG_METAINFO_JSON},
-      description = "Application meta info JSON blob")
-  public String appMetaInfoJson;
-
-  @Parameter(names = {ARG_APPDEF},
-      description = "Application def (folder or a zip package)")
-  public File appDef;
-
-  @Parameter(names = {ARG_QUEUE},
-             description = "Queue to submit the application")
+public abstract class AbstractClusterBuildingActionArgs
+    extends AbstractActionArgs {
+  @Parameter(names = {
+      ARG_QUEUE }, description = "Queue to submit the application")
   public String queue;
 
-  @Parameter(names = {ARG_LIFETIME},
-      description = "Lifetime of the application from the time of request")
+  @Parameter(names = {
+      ARG_LIFETIME }, description = "Lifetime of the application from the time of request")
   public long lifetime;
-
-  @ParametersDelegate
-  public ComponentArgsDelegate componentDelegate = new ComponentArgsDelegate();
-
-  @ParametersDelegate
-  public AddonArgsDelegate addonDelegate = new AddonArgsDelegate();
-
-
-  @ParametersDelegate
-  public AppAndResouceOptionArgsDelegate optionsDelegate =
-      new AppAndResouceOptionArgsDelegate();
-
-
-  public Map<String, String> getOptionsMap() throws
-      BadCommandArgumentsException {
-    return optionsDelegate.getOptionsMap();
-  }
-
-  /**
-   * Get the role heap mapping (may be empty, but never null)
-   * @return role heap mapping
-   * @throws BadCommandArgumentsException parse problem
-   */
-  public Map<String, Map<String, String>> getCompOptionMap() throws
-      BadCommandArgumentsException {
-    return optionsDelegate.getCompOptionMap();
-  }
-
-
-  public Map<String, String> getResourceOptionsMap() throws
-      BadCommandArgumentsException {
-    return optionsDelegate.getResourceOptionsMap();
-  }
-
-  /**
-   * Get the role heap mapping (may be empty, but never null)
-   * @return role heap mapping
-   * @throws BadCommandArgumentsException parse problem
-   */
-  public Map<String, Map<String, String>> getResourceCompOptionMap() throws
-      BadCommandArgumentsException {
-    return optionsDelegate.getResourceCompOptionMap();
-  }
-
-  @VisibleForTesting
-  public List<String> getComponentTuples() {
-    return componentDelegate.getComponentTuples();
-  }
-
-  /**
-   * Get the role mapping (may be empty, but never null)
-   * @return role mapping
-   * @throws BadCommandArgumentsException parse problem
-   */
-  public Map<String, String> getComponentMap() throws
-      BadCommandArgumentsException {
-    return componentDelegate.getComponentMap();
-  }
-
-  @VisibleForTesting
-  public List<String> getAddonTuples() {
-    return addonDelegate.getAddonTuples();
-  }
-
-  /**
-   * Get the list of addons (may be empty, but never null)
-   */
-  public Map<String, String> getAddonMap() throws
-      BadCommandArgumentsException {
-    return addonDelegate.getAddonMap();
-  }
-
-  public Path getConfdir() {
-    return confdir;
-  }
-
-  public String getAppZKPath() {
-    return appZKPath;
-  }
-
-  public String getZKhosts() {
-    return zkhosts;
-  }
-
-  public Path getImage() {
-    return image;
-  }
-
-  public String getAppHomeDir() {
-    return appHomeDir;
-  }
-
-  public String getProvider() {
-    return provider;
-  }
-
-  public ConfTree buildAppOptionsConfTree() throws
-      BadCommandArgumentsException {
-    return buildConfTree(getOptionsMap());
-  }
-
-  public ConfTree buildResourceOptionsConfTree() throws
-      BadCommandArgumentsException {
-    return buildConfTree(getResourceOptionsMap());
-  }
-
-  protected ConfTree buildConfTree(Map<String, String> optionsMap) throws
-      BadCommandArgumentsException {
-    ConfTree confTree = new ConfTree();
-    confTree.global.putAll(optionsMap);
-    return confTree;
-  }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/99c1074c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionBuildArgs.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionBuildArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionBuildArgs.java
deleted file mode 100644
index 1a182d1..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionBuildArgs.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameters;
-
-@Parameters(commandNames = {SliderActions.ACTION_BUILD},
-            commandDescription = SliderActions.DESCRIBE_ACTION_BUILD)
-
-public class ActionBuildArgs extends AbstractClusterBuildingActionArgs {
-
-  @Override
-  public String getActionName() {
-    return SliderActions.ACTION_BUILD;
-  }
-}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/99c1074c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionCreateArgs.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionCreateArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionCreateArgs.java
index e70f30a..c8cac65 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionCreateArgs.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionCreateArgs.java
@@ -18,6 +18,7 @@
 
 package org.apache.slider.common.params;
 
+import com.beust.jcommander.Parameter;
 import com.beust.jcommander.Parameters;
 import com.beust.jcommander.ParametersDelegate;
 
@@ -26,34 +27,19 @@ import java.io.File;
 @Parameters(commandNames = {SliderActions.ACTION_CREATE},
             commandDescription = SliderActions.DESCRIBE_ACTION_CREATE)
 
-public class ActionCreateArgs extends AbstractClusterBuildingActionArgs
-  implements WaitTimeAccessor, LaunchArgsAccessor {
-  
-  @Override
-  public String getActionName() {
-    return SliderActions.ACTION_CREATE;
-  }
-  
-  @ParametersDelegate
-  LaunchArgsDelegate launchArgs = new LaunchArgsDelegate();
+public class ActionCreateArgs extends AbstractClusterBuildingActionArgs {
 
-  @Override
-  public File getOutputFile() {
-    return launchArgs.getOutputFile();
-  }
+  @Parameter(names = {ARG_APPDEF},
+      description = "Template application definition file in JSON format.")
+  public File appDef;
 
-  @Override
-  public String getRmAddress() {
-    return launchArgs.getRmAddress();
+  public File getAppDef() {
+    return appDef;
   }
 
   @Override
-  public int getWaittime() {
-    return launchArgs.getWaittime();
-  }
-
-  @Override
-  public void setWaittime(int waittime) {
-    launchArgs.setWaittime(waittime);
+  public String getActionName() {
+    return SliderActions.ACTION_CREATE;
   }
 }
+

http://git-wip-us.apache.org/repos/asf/hadoop/blob/99c1074c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionFlexArgs.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionFlexArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionFlexArgs.java
index 725973e..c565484 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionFlexArgs.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionFlexArgs.java
@@ -18,37 +18,31 @@
 
 package org.apache.slider.common.params;
 
+import com.beust.jcommander.Parameter;
 import com.beust.jcommander.Parameters;
-import com.beust.jcommander.ParametersDelegate;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-
-import java.util.List;
-import java.util.Map;
 
 @Parameters(commandNames = {SliderActions.ACTION_FLEX},
             commandDescription = SliderActions.DESCRIBE_ACTION_FLEX)
 
 public class ActionFlexArgs extends AbstractActionArgs {
 
+  @Parameter(names = {ARG_COMPONENT},
+      description = "component name")
+  String componentName;
+
+  @Parameter(names = {ARG_COUNT},
+      description = "number of containers>")
+  long numberOfContainers;
+
   @Override
   public String getActionName() {
     return SliderActions.ACTION_FLEX;
   }
-  
-  @ParametersDelegate
-  public ComponentArgsDelegate componentDelegate = new ComponentArgsDelegate();
-
-  /**
-   * Get the component mapping (may be empty, but never null)
-   * @return mapping
-   * @throws BadCommandArgumentsException parse problem
-   */
-  public Map<String, String> getComponentMap() throws BadCommandArgumentsException {
-    return componentDelegate.getComponentMap();
-  }
 
-  public List<String> getComponentTuples() {
-    return componentDelegate.getComponentTuples();
+  public String getComponent() {
+    return componentName;
+  }
+  public long getNumberOfContainers() {
+    return numberOfContainers;
   }
-
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/99c1074c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionFreezeArgs.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionFreezeArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionFreezeArgs.java
index e3085d9..f3cc6ef 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionFreezeArgs.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionFreezeArgs.java
@@ -22,14 +22,14 @@ import com.beust.jcommander.Parameter;
 import com.beust.jcommander.Parameters;
 import com.beust.jcommander.ParametersDelegate;
 
-@Parameters(commandNames = {SliderActions.ACTION_FREEZE},
+@Parameters(commandNames = {SliderActions.ACTION_STOP },
             commandDescription = SliderActions.DESCRIBE_ACTION_FREEZE)
 
 public class ActionFreezeArgs extends AbstractActionArgs implements
                                                          WaitTimeAccessor {
   @Override
   public String getActionName() {
-    return SliderActions.ACTION_FREEZE;
+    return SliderActions.ACTION_STOP;
   }
   
   public static final String FREEZE_COMMAND_ISSUED = "stop command issued";

http://git-wip-us.apache.org/repos/asf/hadoop/blob/99c1074c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionThawArgs.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionThawArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionThawArgs.java
index 2bd856f..04988c9 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionThawArgs.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionThawArgs.java
@@ -24,7 +24,7 @@ import com.beust.jcommander.ParametersDelegate;
 
 import java.io.File;
 
-@Parameters(commandNames = {SliderActions.ACTION_THAW},
+@Parameters(commandNames = {SliderActions.ACTION_START },
             commandDescription = SliderActions.DESCRIBE_ACTION_THAW)
 public class ActionThawArgs extends AbstractActionArgs implements
                                                        WaitTimeAccessor,
@@ -33,7 +33,7 @@ public class ActionThawArgs extends AbstractActionArgs implements
 
   @Override
   public String getActionName() {
-    return SliderActions.ACTION_THAW;
+    return SliderActions.ACTION_START;
   }
 
   @Override

http://git-wip-us.apache.org/repos/asf/hadoop/blob/99c1074c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionUpgradeArgs.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionUpgradeArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionUpgradeArgs.java
index 6ef51b2..18aa1f5 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionUpgradeArgs.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionUpgradeArgs.java
@@ -18,56 +18,31 @@
 
 package org.apache.slider.common.params;
 
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
 import com.beust.jcommander.Parameter;
 import com.beust.jcommander.Parameters;
-import com.beust.jcommander.ParametersDelegate;
+
+import java.util.ArrayList;
+import java.util.List;
 
 @Parameters(commandNames = { SliderActions.ACTION_UPGRADE },
             commandDescription = SliderActions.DESCRIBE_ACTION_UPGRADE)
-public class ActionUpgradeArgs extends AbstractClusterBuildingActionArgs
-    implements WaitTimeAccessor, LaunchArgsAccessor {
+public class ActionUpgradeArgs extends AbstractActionArgs {
 
   @Override
   public String getActionName() {
     return SliderActions.ACTION_UPGRADE;
   }
-
-  @ParametersDelegate
-  LaunchArgsDelegate launchArgs = new LaunchArgsDelegate();
-
-  @Override
-  public File getOutputFile() {
-    return launchArgs.getOutputFile();
-  }
-
-  @Override
-  public String getRmAddress() {
-    return launchArgs.getRmAddress();
-  }
-
-  @Override
-  public int getWaittime() {
-    return launchArgs.getWaittime();
-  }
-
-  @Override
-  public void setWaittime(int waittime) {
-    launchArgs.setWaittime(waittime);
-  }
-
-  @Parameter(names={ARG_CONTAINERS}, variableArity = true,
-             description = "stop specific containers")
-  public List<String> containers = new ArrayList<>(0);
-
-  @Parameter(names={ARG_COMPONENTS}, variableArity = true,
-      description = "stop all containers of specific components")
-  public List<String> components = new ArrayList<>(0);
-
-  @Parameter(names = {ARG_FORCE},
-      description = "force spec upgrade operation")
-  public boolean force;
+  
+//  TODO upgrade container
+//  @Parameter(names={ARG_CONTAINERS}, variableArity = true,
+//             description = "stop specific containers")
+//  public List<String> containers = new ArrayList<>(0);
+//
+//  @Parameter(names={ARG_COMPONENTS}, variableArity = true,
+//      description = "stop all containers of specific components")
+//  public List<String> components = new ArrayList<>(0);
+//
+//  @Parameter(names = {ARG_FORCE},
+//      description = "force spec upgrade operation")
+//  public boolean force;
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/99c1074c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/Arguments.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/Arguments.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/Arguments.java
index cbf7e59..45c1fbd 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/Arguments.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/Arguments.java
@@ -36,6 +36,7 @@ public interface Arguments {
   String ARG_CLIENT = "--client";
   String ARG_CONFDIR = "--appconf";
   String ARG_COMPONENT = "--component";
+  String ARG_COUNT = "--count";
   String ARG_COMPONENT_SHORT = "--comp";
   String ARG_COMPONENTS = "--components";
   String ARG_COMP_OPT= "--compopt";

http://git-wip-us.apache.org/repos/asf/hadoop/blob/99c1074c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ClientArgs.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ClientArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ClientArgs.java
index 4016cc9..abd2ce7 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ClientArgs.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ClientArgs.java
@@ -53,7 +53,6 @@ public class ClientArgs extends CommonArgs {
   // =========================================================
 
   private final ActionAMSuicideArgs actionAMSuicideArgs = new ActionAMSuicideArgs();
-  private final ActionBuildArgs actionBuildArgs = new ActionBuildArgs();
   private final ActionClientArgs actionClientArgs = new ActionClientArgs();
   private final ActionCreateArgs actionCreateArgs = new ActionCreateArgs();
   private final ActionDependencyArgs actionDependencyArgs = new ActionDependencyArgs();
@@ -96,7 +95,6 @@ public class ClientArgs extends CommonArgs {
 
     addActions(
         actionAMSuicideArgs,
-        actionBuildArgs,
         actionClientArgs,
         actionCreateArgs,
         actionDependencyArgs,
@@ -155,10 +153,6 @@ public class ClientArgs extends CommonArgs {
     return actionAMSuicideArgs;
   }
 
-  public ActionBuildArgs getActionBuildArgs() {
-    return actionBuildArgs;
-  }
-
   public ActionInstallPackageArgs getActionInstallPackageArgs() { return actionInstallPackageArgs; }
 
   public ActionClientArgs getActionClientArgs() { return actionClientArgs; }
@@ -256,23 +250,17 @@ public class ClientArgs extends CommonArgs {
       action = ACTION_HELP;
     }
     switch (action) {
-      case ACTION_BUILD:
-        bindCoreAction(actionBuildArgs);
-        //its a builder, so set those actions too
-        buildingActionArgs = actionBuildArgs;
-        break;
-
       case ACTION_CREATE:
         bindCoreAction(actionCreateArgs);
         //its a builder, so set those actions too
         buildingActionArgs = actionCreateArgs;
         break;
 
-      case ACTION_FREEZE:
+      case ACTION_STOP:
         bindCoreAction(actionFreezeArgs);
         break;
 
-      case ACTION_THAW:
+      case ACTION_START:
         bindCoreAction(actionThawArgs);
         break;
 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/99c1074c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/SliderAMArgs.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/SliderAMArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/SliderAMArgs.java
index f9516d1..de65954 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/SliderAMArgs.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/SliderAMArgs.java
@@ -43,7 +43,7 @@ public class SliderAMArgs extends CommonArgs {
    * This is the URI in the FS to the Slider cluster; the conf file (and any
    * other cluster-specifics) can be picked up here
    */
-  public String getSliderClusterURI() {
+  public String getAppDefDir() {
     return createAction.sliderClusterURI;
   }
 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/99c1074c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/SliderActions.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/SliderActions.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/SliderActions.java
index 204ad9a..82e5903 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/SliderActions.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/SliderActions.java
@@ -36,7 +36,7 @@ public interface SliderActions {
   String ACTION_ECHO = "echo";
   String ACTION_EXISTS = "exists";
   String ACTION_FLEX = "flex";
-  String ACTION_FREEZE = "stop";
+  String ACTION_STOP = "stop";
   String ACTION_HELP = "help";
   String ACTION_INSTALL_KEYTAB = "install-keytab";
   String ACTION_INSTALL_PACKAGE = "install-package";
@@ -53,7 +53,7 @@ public interface SliderActions {
   String ACTION_RESOLVE = "resolve";
   String ACTION_RESOURCE = "resource";
   String ACTION_STATUS = "status";
-  String ACTION_THAW = "start";
+  String ACTION_START = "start";
   String ACTION_TOKENS = "tokens";
 
   String ACTION_VERSION = "version";
@@ -68,7 +68,7 @@ public interface SliderActions {
   String DESCRIBE_ACTION_UPDATE =
       "Update template for a Slider application";
   String DESCRIBE_ACTION_UPGRADE =
-      "Rolling upgrade/downgrade the application to a newer/previous version";
+      "Rolling upgrade/downgrade the component/containerto a newer/previous version";
   String DESCRIBE_ACTION_DESTROY =
         "Destroy a stopped Slider application";
   String DESCRIBE_ACTION_EXISTS =

http://git-wip-us.apache.org/repos/asf/hadoop/blob/99c1074c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/CoreFileSystem.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/CoreFileSystem.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/CoreFileSystem.java
index c3d6d98..5919312 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/CoreFileSystem.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/CoreFileSystem.java
@@ -511,6 +511,7 @@ public class CoreFileSystem {
    * @return the parent dir path of slider.tar.gz in HDFS
    */
   public Path getDependencyPath() {
+    // FIXME: 3/20/17 HDP ???????????
     String parentDir = (SliderUtils.isHdp()) ? SliderKeys.SLIDER_DEPENDENCY_HDP_PARENT_DIR
         + SliderKeys.SLIDER_DEPENDENCY_DIR
         : SliderKeys.SLIDER_DEPENDENCY_DIR;

http://git-wip-us.apache.org/repos/asf/hadoop/blob/99c1074c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/SliderFileSystem.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/SliderFileSystem.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/SliderFileSystem.java
index 294f37e..40b07bd 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/SliderFileSystem.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/SliderFileSystem.java
@@ -20,6 +20,7 @@ package org.apache.slider.common.tools;
 
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
 
 import java.io.IOException;
 
@@ -29,6 +30,8 @@ import java.io.IOException;
  */
 public class SliderFileSystem extends CoreFileSystem {
 
+  Path appDir = null;
+
   public SliderFileSystem(FileSystem fileSystem,
       Configuration configuration) {
     super(fileSystem, configuration);
@@ -38,5 +41,11 @@ public class SliderFileSystem extends CoreFileSystem {
     super(configuration);
   }
 
+  public void setAppDir(Path appDir) {
+    this.appDir = appDir;
+  }
 
+  public Path getAppDir() {
+    return this.appDir;
+  }
 }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/99c1074c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/SliderUtils.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/SliderUtils.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/SliderUtils.java
index 20c7831..c0ef2d4 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/SliderUtils.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/SliderUtils.java
@@ -499,9 +499,6 @@ public final class SliderUtils {
           "Source file not a file " + srcFile);
     }
     FileSystem destFS = FileSystem.get(destFile.toUri(), conf);
-    if (destFS.exists(destFile)) {
-      throw new IOException("Dest file already exists " + destFile);
-    }
     FileUtil.copy(srcFS, srcFile, destFS, destFile, false, true, conf);
   }
 
@@ -1221,6 +1218,29 @@ public final class SliderUtils {
     return buildEnvMap(roleOpts, null);
   }
 
+
+  // Build env map: key -> value;
+  // value will be replaced by the corresponding value in tokenMap, if any.
+  public static Map<String, String> buildEnvMap(
+      org.apache.slider.api.resource.Configuration conf,
+      Map<String,String> tokenMap) {
+    if (tokenMap == null) {
+      return conf.getEnv();
+    }
+    Map<String, String> env = new HashMap<>();
+    for (Map.Entry<String, String> entry : conf.getEnv().entrySet()) {
+      String key = entry.getKey();
+      String val = entry.getValue();
+      for (Map.Entry<String,String> token : tokenMap.entrySet()) {
+        val = val.replaceAll(Pattern.quote(token.getKey()),
+            token.getValue());
+      }
+      env.put(key,val);
+    }
+    return env;
+  }
+
+
   public static Map<String, String> buildEnvMap(Map<String, String> roleOpts,
       Map<String,String> tokenMap) {
     Map<String, String> env = new HashMap<>();
@@ -1273,8 +1293,8 @@ public final class SliderUtils {
    * @param clustername cluster name
    * @throws BadCommandArgumentsException if it is invalid
    */
-  public static void validateClusterName(String clustername) throws
-      BadCommandArgumentsException {
+  public static void validateClusterName(String clustername)
+      throws BadCommandArgumentsException {
     if (!isClusternameValid(clustername)) {
       throw new BadCommandArgumentsException(
           "Illegal cluster name: " + clustername);
@@ -1603,14 +1623,12 @@ public final class SliderUtils {
    * @param sliderConfDir relative path to the dir containing slider config
    *                      options to put on the classpath -or null
    * @param libdir directory containing the JAR files
-   * @param config the configuration
    * @param usingMiniMRCluster flag to indicate the MiniMR cluster is in use
    * (and hence the current classpath should be used, not anything built up)
    * @return a classpath
    */
   public static ClasspathConstructor buildClasspath(String sliderConfDir,
       String libdir,
-      Configuration config,
       SliderFileSystem sliderFileSystem,
       boolean usingMiniMRCluster) {
 

http://git-wip-us.apache.org/repos/asf/hadoop/blob/99c1074c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/AppMasterLauncher.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/AppMasterLauncher.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/AppMasterLauncher.java
deleted file mode 100644
index 7190c3a..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/AppMasterLauncher.java
+++ /dev/null
@@ -1,233 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.launch;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.security.Credentials;
-import org.apache.hadoop.yarn.api.records.ApplicationId;
-import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
-import org.apache.hadoop.yarn.api.records.Priority;
-import org.apache.hadoop.yarn.api.records.Resource;
-import org.apache.hadoop.yarn.client.api.YarnClientApplication;
-import org.apache.hadoop.yarn.conf.YarnConfiguration;
-import org.apache.hadoop.yarn.exceptions.YarnException;
-import org.apache.hadoop.yarn.util.Records;
-import org.apache.slider.client.SliderYarnClientImpl;
-import org.apache.slider.common.tools.CoreFileSystem;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.Map;
-import java.util.Set;
-
-public class AppMasterLauncher extends AbstractLauncher {
-
-
-  private static final Logger log =
-    LoggerFactory.getLogger(AppMasterLauncher.class);
-
-  public final YarnClientApplication application;
-  public final String name;
-  public final String type;
-  public final ApplicationSubmissionContext submissionContext;
-  public final ApplicationId appId;
-  public final boolean secureCluster;
-  private int maxAppAttempts = 0;
-  private boolean keepContainersOverRestarts = true;
-  private String queue = YarnConfiguration.DEFAULT_QUEUE_NAME;
-  private int priority = 1;
-  private final Resource resource = Records.newRecord(Resource.class);
-  private final SliderYarnClientImpl yarnClient;
-  private Long submitTime;
-
-  /**
-   * Build the AM Launcher
-   * @param name app name
-   * @param type application type
-   * @param conf hadoop config
-   * @param fs filesystem binding
-   * @param yarnClient yarn client
-   * @param secureCluster flag to indicate secure cluster
-   * @param options map of options. All values are extracted in this constructor only
-   * @param resourceGlobalOptions global options
-   * @param applicationTags any app tags
-   * @param credentials initial set of credentials
-   * @throws IOException
-   * @throws YarnException
-   */
-  public AppMasterLauncher(String name,
-      String type,
-      Configuration conf,
-      CoreFileSystem fs,
-      SliderYarnClientImpl yarnClient,
-      boolean secureCluster,
-      Map<String, String> options,
-      Map<String, String> resourceGlobalOptions,
-      Set<String> applicationTags,
-      Credentials credentials) throws IOException, YarnException {
-    super(conf, fs, credentials);
-    this.yarnClient = yarnClient;
-    this.application = yarnClient.createApplication();
-    this.name = name;
-    this.type = type;
-    this.secureCluster = secureCluster;
-
-    submissionContext = application.getApplicationSubmissionContext();
-    appId = submissionContext.getApplicationId();
-    // set the application name;
-    submissionContext.setApplicationName(name);
-    // app type used in service enum;
-    submissionContext.setApplicationType(type);
-    if (!applicationTags.isEmpty()) {
-      submissionContext.setApplicationTags(applicationTags);
-    }
-    submissionContext.setNodeLabelExpression(extractLabelExpression(options));
-
-    extractAmRetryCount(submissionContext, resourceGlobalOptions);
-    extractResourceRequirements(resource, options);
-    extractLogAggregationContext(resourceGlobalOptions);
-  }
-
-  public void setMaxAppAttempts(int maxAppAttempts) {
-    this.maxAppAttempts = maxAppAttempts;
-  }
-
-  public void setKeepContainersOverRestarts(boolean keepContainersOverRestarts) {
-    this.keepContainersOverRestarts = keepContainersOverRestarts;
-  }
-
-
-  public Resource getResource() {
-    return resource;
-  }
-
-  public void setMemory(int memory) {
-    resource.setMemory(memory);
-  }
-
-  public void setVirtualCores(int cores) {
-    resource.setVirtualCores(cores);
-  }
-
-  public ApplicationId getApplicationId() {
-    return appId;
-  }
-
-  public int getMaxAppAttempts() {
-    return maxAppAttempts;
-  }
-
-  public boolean isKeepContainersOverRestarts() {
-    return keepContainersOverRestarts;
-  }
-
-  public String getQueue() {
-    return queue;
-  }
-
-  public int getPriority() {
-    return priority;
-  }
-
-  public void setQueue(String queue) {
-    this.queue = queue;
-  }
-
-  public void setPriority(int priority) {
-    this.priority = priority;
-  }
-
-  /**
-   * Complete the launch context (copy in env vars, etc).
-   * @return the container to launch
-   */
-  public ApplicationSubmissionContext completeAppMasterLaunch()
-      throws IOException {
-
-    //queue priority
-    Priority pri = Records.newRecord(Priority.class);
-    pri.setPriority(priority);
-    submissionContext.setPriority(pri);
-
-    // Set the queue to which this application is to be submitted in the RM
-    // Queue for App master
-
-    submissionContext.setQueue(queue);
-
-
-    //container requirements
-    submissionContext.setResource(resource);
-    submissionContext.setLogAggregationContext(logAggregationContext);
-
-    if (keepContainersOverRestarts) {
-      log.debug("Requesting cluster stays running over AM failure");
-      submissionContext.setKeepContainersAcrossApplicationAttempts(true);
-    }
-
-    if (maxAppAttempts > 0) {
-      log.debug("Setting max AM attempts to {}", maxAppAttempts);
-      submissionContext.setMaxAppAttempts(maxAppAttempts);
-    }
-
-    if (secureCluster) {
-      //tokens
-      log.debug("Credentials: {}",
-          CredentialUtils.dumpTokens(getCredentials(), "\n"));
-
-    } else {
-      propagateUsernameInInsecureCluster();
-    }
-    completeContainerLaunch();
-    submissionContext.setAMContainerSpec(containerLaunchContext);
-    return submissionContext;
-  }
-
-  /**
-   * Submit the application. 
-   * @return a launched application representing the submitted application
-   * @throws IOException
-   * @throws YarnException
-   */
-  public LaunchedApplication submitApplication() throws IOException, YarnException {
-    completeAppMasterLaunch();
-    log.info("Submitting application to Resource Manager");
-    ApplicationId applicationId =
-      yarnClient.submitApplication(submissionContext);
-    // implicit success; record the time
-    submitTime = System.currentTimeMillis();
-    return new LaunchedApplication(applicationId, yarnClient);
-  }
-
-  /**
-   * Build a serializable application report. This is a very minimal
-   * report that contains the application Id, name and type —the information
-   * available
-   * @return a data structure which can be persisted
-   */
-  public SerializedApplicationReport createSerializedApplicationReport() {
-    SerializedApplicationReport sar = new SerializedApplicationReport();
-    sar.applicationId = appId.toString();
-    sar.name = name;
-    sar.applicationType = type;
-    sar.queue = queue;
-    sar.submitTime = submitTime;
-    return sar;
-  }
-}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/99c1074c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/LaunchedApplication.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/LaunchedApplication.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/LaunchedApplication.java
deleted file mode 100644
index 632e3fd..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/LaunchedApplication.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.launch;
-
-import org.apache.hadoop.yarn.api.protocolrecords.KillApplicationResponse;
-import org.apache.hadoop.yarn.api.records.ApplicationId;
-import org.apache.hadoop.yarn.api.records.ApplicationReport;
-import org.apache.hadoop.yarn.api.records.YarnApplicationState;
-import org.apache.hadoop.yarn.exceptions.YarnException;
-import org.apache.slider.client.SliderYarnClientImpl;
-import org.apache.slider.common.tools.Duration;
-
-import java.io.IOException;
-
-/**
- * Launched App with logic around it.
- */
-public class LaunchedApplication {
-
-  protected final ApplicationId applicationId;
-  protected final SliderYarnClientImpl yarnClient;
-
-  public LaunchedApplication(ApplicationId applicationId,
-                             SliderYarnClientImpl yarnClient) {
-    assert applicationId != null;
-    assert yarnClient != null;
-    this.applicationId = applicationId;
-    this.yarnClient = yarnClient;
-  }
-
-  public LaunchedApplication(SliderYarnClientImpl yarnClient,
-                             ApplicationReport report) {
-    this.yarnClient = yarnClient;
-    this.applicationId = report.getApplicationId();
-  }
-
-  public ApplicationId getApplicationId() {
-    return applicationId;
-  }
-
-  /**
-   * Monitor the submitted application for reaching the requested state.
-   * Will also report if the app reaches a later state (failed, killed, etc)
-   * Kill application if duration!= null & time expires. 
-   * @param duration how long to wait -must be more than 0
-   * @param desiredState desired state.
-   * @return the application report -null on a timeout
-   * @throws YarnException
-   * @throws IOException
-   */
-  public ApplicationReport monitorAppToState(YarnApplicationState desiredState, Duration duration)
-    throws YarnException, IOException {
-    return yarnClient.monitorAppToState(applicationId, desiredState, duration);
-  }
-
-  /**
-   * Kill the submitted application by sending a call to the ASM
-   * @throws YarnException
-   * @throws IOException
-   */
-  public boolean forceKill(String reason)
-    throws YarnException, IOException {
-    if (applicationId != null) {
-      yarnClient.killRunningApplication(applicationId, reason);
-      return true;
-    }
-    return false;
-  }
-
-  /**
-   * Kill the application
-   * @return the response
-   * @throws YarnException YARN problems
-   * @throws IOException IO problems
-   */
-  public KillApplicationResponse kill(String reason) throws
-                                                     YarnException,
-                                                     IOException {
-    return yarnClient.killRunningApplication(applicationId, reason);
-  }
-
-  /**
-   * Get the application report of this application
-   * @return an application report
-   * @throws YarnException
-   * @throws IOException
-   */
-  public ApplicationReport getApplicationReport()
-    throws YarnException, IOException {
-    return yarnClient.getApplicationReport(applicationId);
-  }
-}

http://git-wip-us.apache.org/repos/asf/hadoop/blob/99c1074c/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/RunningApplication.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/RunningApplication.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/RunningApplication.java
deleted file mode 100644
index 14c522c..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/RunningApplication.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.launch;
-
-import org.apache.hadoop.yarn.api.records.ApplicationReport;
-import org.apache.hadoop.yarn.exceptions.YarnException;
-import org.apache.slider.api.SliderClusterProtocol;
-import org.apache.slider.client.SliderYarnClientImpl;
-import org.apache.slider.common.SliderExitCodes;
-import org.apache.slider.core.exceptions.SliderException;
-import org.apache.slider.server.appmaster.rpc.RpcBinder;
-
-import java.io.IOException;
-
-import static org.apache.slider.common.Constants.CONNECT_TIMEOUT;
-import static org.apache.slider.common.Constants.RPC_TIMEOUT;
-
-/**
- * A running application built from an app report. This one
- * can be talked to
- */
-public class RunningApplication extends LaunchedApplication {
-
-  private final ApplicationReport applicationReport;
-  public RunningApplication(SliderYarnClientImpl yarnClient,
-                            ApplicationReport applicationReport) {
-    super(yarnClient, applicationReport);
-    this.applicationReport = applicationReport;
-  }
-
-  public ApplicationReport getApplicationReport() {
-    return applicationReport;
-  }
-
-
-  /**
-   * Connect to a Slider AM
-   * @param app application report providing the details on the application
-   * @return an instance
-   * @throws YarnException
-   * @throws IOException
-   */
-  public SliderClusterProtocol connect(ApplicationReport app) throws
-                                                             YarnException,
-                                                             IOException {
-
-    try {
-      return RpcBinder.getProxy(yarnClient.getConfig(),
-                                yarnClient.getRmClient(),
-                                app,
-                                CONNECT_TIMEOUT,
-                                RPC_TIMEOUT);
-    } catch (InterruptedException e) {
-      throw new SliderException(SliderExitCodes.EXIT_TIMED_OUT,
-          e,
-          "Interrupted waiting for communications with the Application Master");
-    }
-  }
-
-}


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message