diff --git a/NOTICE.txt b/NOTICE.txt index f3af2f7030..bc7a26f944 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -582,10 +582,6 @@ Ehcache 3.3.1, which has the following notices: * Ehcache V3 Copyright 2014-2016 Terracotta, Inc. -JCommander (https://github.com/cbeust/jcommander), -which has the following notices: - * Copyright 2010 Cedric Beust cedric@beust.com - The binary distribution of this product bundles binaries of snakeyaml (https://bitbucket.org/asomov/snakeyaml), which has the following notices: diff --git a/hadoop-project/pom.xml b/hadoop-project/pom.xml index d18c9a8527..f99e41386c 100644 --- a/hadoop-project/pom.xml +++ b/hadoop-project/pom.xml @@ -146,7 +146,6 @@ 1.5.4 1.16 - 1.48 @@ -1353,11 +1352,6 @@ snakeyaml ${snakeyaml.version} - - com.beust - jcommander - ${jcommander.version} - diff --git a/hadoop-yarn-project/hadoop-yarn/bin/yarn b/hadoop-yarn-project/hadoop-yarn/bin/yarn index cc269d8d33..00596c29a7 100755 --- a/hadoop-yarn-project/hadoop-yarn/bin/yarn +++ b/hadoop-yarn-project/hadoop-yarn/bin/yarn @@ -31,8 +31,7 @@ function hadoop_usage hadoop_add_option "--hosts filename" "list of hosts to use in worker mode" hadoop_add_option "--workers" "turn on worker mode" - hadoop_add_subcommand "apiserver" daemon "run the api-server for deploying/managing services on YARN" - hadoop_add_subcommand "application" client "prints application(s) report/kill application" + hadoop_add_subcommand "app|application" client "prints application(s) report/kill application/manage long running application" hadoop_add_subcommand "applicationattempt" client "prints applicationattempt(s) report" hadoop_add_subcommand "classpath" client "prints the class path needed to get the hadoop jar and the required libraries" hadoop_add_subcommand "cluster" client "prints cluster information" @@ -51,7 +50,6 @@ function hadoop_usage hadoop_add_subcommand "router" daemon "run the Router daemon" hadoop_add_subcommand "schedulerconf" client "Updates scheduler configuration" hadoop_add_subcommand "scmadmin" admin "SharedCacheManager admin tools" - hadoop_add_subcommand "service" client "deploy/manage a service on YARN" hadoop_add_subcommand "sharedcachemanager" daemon "run the SharedCacheManager daemon" hadoop_add_subcommand "timelinereader" client "run the timeline reader server" hadoop_add_subcommand "timelineserver" daemon "run the timeline server" @@ -71,9 +69,10 @@ function yarncmd_case shift case ${subcmd} in - apiserver) - HADOOP_SUBCMD_SUPPORTDAEMONIZATION="true" - HADOOP_CLASSNAME='org.apache.hadoop.yarn.service.webapp.ApiServerWebApp' + app|application|applicationattempt|container) + HADOOP_CLASSNAME=org.apache.hadoop.yarn.client.cli.ApplicationCLI + set -- "${subcmd}" "$@" + HADOOP_SUBCMD_ARGS=("$@") local sld="${HADOOP_YARN_HOME}/${YARN_DIR},\ ${HADOOP_YARN_HOME}/${YARN_LIB_JARS_DIR},\ ${HADOOP_HDFS_HOME}/${HDFS_DIR},\ @@ -83,11 +82,6 @@ ${HADOOP_COMMON_HOME}/${HADOOP_COMMON_LIB_JARS_DIR}" hadoop_translate_cygwin_path sld hadoop_add_param HADOOP_OPTS service.libdir "-Dservice.libdir=${sld}" ;; - application|applicationattempt|container) - HADOOP_CLASSNAME=org.apache.hadoop.yarn.client.cli.ApplicationCLI - set -- "${subcmd}" "$@" - HADOOP_SUBCMD_ARGS=("$@") - ;; classpath) hadoop_do_classpath_subcommand HADOOP_CLASSNAME "$@" ;; @@ -169,17 +163,6 @@ ${HADOOP_COMMON_HOME}/${HADOOP_COMMON_LIB_JARS_DIR}" scmadmin) HADOOP_CLASSNAME='org.apache.hadoop.yarn.client.SCMAdmin' ;; - service) - HADOOP_CLASSNAME='org.apache.hadoop.yarn.service.client.ServiceCLI' - local sld="${HADOOP_YARN_HOME}/${YARN_DIR},\ -${HADOOP_YARN_HOME}/${YARN_LIB_JARS_DIR},\ -${HADOOP_HDFS_HOME}/${HDFS_DIR},\ -${HADOOP_HDFS_HOME}/${HDFS_LIB_JARS_DIR},\ -${HADOOP_COMMON_HOME}/${HADOOP_COMMON_DIR},\ -${HADOOP_COMMON_HOME}/${HADOOP_COMMON_LIB_JARS_DIR}" - hadoop_translate_cygwin_path sld - hadoop_add_param HADOOP_OPTS service.libdir "-Dservice.libdir=${sld}" - ;; sharedcachemanager) HADOOP_SUBCMD_SUPPORTDAEMONIZATION="true" HADOOP_CLASSNAME='org.apache.hadoop.yarn.server.sharedcachemanager.SharedCacheManager' diff --git a/hadoop-yarn-project/hadoop-yarn/conf/yarn-env.sh b/hadoop-yarn-project/hadoop-yarn/conf/yarn-env.sh index 4bd1d3eeca..d8650236b7 100644 --- a/hadoop-yarn-project/hadoop-yarn/conf/yarn-env.sh +++ b/hadoop-yarn-project/hadoop-yarn/conf/yarn-env.sh @@ -149,18 +149,6 @@ # #export YARN_ROUTER_OPTS= -### -# Services API specific parameters -### -# Specify the JVM options to be used when starting the services API. -# -# These options will be appended to the options specified as HADOOP_OPTS -# and therefore may override any similar flags set in HADOOP_OPTS -# -# See ResourceManager for some examples -# -#export YARN_APISERVER_OPTS="-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCDateStamps -Xloggc:${HADOOP_LOG_DIR}/gc-apiserver.log-$(date +'%Y%m%d%H%M')" - ### # Registry DNS specific parameters ### @@ -172,3 +160,9 @@ # By default, Hadoop uses jsvc which needs to know to launch a # server jvm. # export YARN_REGISTRYDNS_SECURE_EXTRA_OPTS="-jvm server" + +### +# YARN Services parameters +### +# Directory containing service examples +# export YARN_SERVICE_EXAMPLES_DIR = $HADOOP_YARN_HOME/share/hadoop/yarn/yarn-service-examples diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/pom.xml index 851f73bd1e..6c9a8752f5 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/pom.xml +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/pom.xml @@ -101,11 +101,6 @@ - - com.beust - jcommander - - org.slf4j slf4j-api diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/ServiceMaster.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/ServiceMaster.java index 2abdae1dff..d58e32b329 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/ServiceMaster.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/ServiceMaster.java @@ -18,6 +18,8 @@ package org.apache.hadoop.yarn.service; +import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.Options; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.metrics2.lib.DefaultMetricsSystem; @@ -34,7 +36,6 @@ import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.security.client.ClientToAMTokenSecretManager; -import org.apache.hadoop.yarn.service.client.params.ServiceAMArgs; import org.apache.hadoop.yarn.service.monitor.ServiceMonitor; import org.apache.hadoop.yarn.service.utils.ServiceApiUtil; import org.apache.hadoop.yarn.service.utils.SliderFileSystem; @@ -51,7 +52,9 @@ public class ServiceMaster extends CompositeService { private static final Logger LOG = LoggerFactory.getLogger(ServiceMaster.class); - private static ServiceAMArgs amArgs; + public static final String YARNFILE_OPTION = "yarnfile"; + + private static String serviceDefPath; protected ServiceContext context; public ServiceMaster(String name) { @@ -108,7 +111,7 @@ protected ContainerId getAMContainerId() throws BadClusterStateException { } protected Path getAppDir() { - return new Path(amArgs.getServiceDefPath()).getParent(); + return new Path(serviceDefPath).getParent(); } protected ServiceScheduler createServiceScheduler(ServiceContext context) @@ -119,7 +122,7 @@ protected ServiceScheduler createServiceScheduler(ServiceContext context) protected void loadApplicationJson(ServiceContext context, SliderFileSystem fs) throws IOException { context.service = ServiceApiUtil - .loadServiceFrom(fs, new Path(amArgs.getServiceDefPath())); + .loadServiceFrom(fs, new Path(serviceDefPath)); LOG.info(context.service.toString()); } @@ -138,14 +141,18 @@ private void printSystemEnv() { public static void main(String[] args) throws Exception { Thread.setDefaultUncaughtExceptionHandler(new YarnUncaughtExceptionHandler()); StringUtils.startupShutdownMessage(ServiceMaster.class, args, LOG); - amArgs = new ServiceAMArgs(args); - amArgs.parse(); try { ServiceMaster serviceMaster = new ServiceMaster("Service Master"); ShutdownHookManager.get() .addShutdownHook(new CompositeServiceShutdownHook(serviceMaster), 30); YarnConfiguration conf = new YarnConfiguration(); - new GenericOptionsParser(conf, args); + Options opts = new Options(); + opts.addOption(YARNFILE_OPTION, true, "HDFS path to JSON service " + + "specification"); + opts.getOption(YARNFILE_OPTION).setRequired(true); + GenericOptionsParser parser = new GenericOptionsParser(conf, opts, args); + CommandLine cmdLine = parser.getCommandLine(); + serviceMaster.serviceDefPath = cmdLine.getOptionValue(YARNFILE_OPTION); serviceMaster.init(conf); serviceMaster.start(); } catch (Throwable t) { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/ServiceCLI.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/ServiceCLI.java deleted file mode 100644 index 928c06f818..0000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/ServiceCLI.java +++ /dev/null @@ -1,113 +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.hadoop.yarn.service.client; - -import com.beust.jcommander.ParameterException; -import org.apache.commons.lang.StringUtils; -import org.apache.hadoop.yarn.conf.YarnConfiguration; -import org.apache.hadoop.yarn.service.api.records.Service; -import org.apache.hadoop.yarn.service.client.params.ClientArgs; -import org.apache.hadoop.yarn.service.exceptions.SliderException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.FileNotFoundException; - -import static org.apache.hadoop.yarn.service.client.params.SliderActions.*; - -public class ServiceCLI { - private static final Logger LOG = - LoggerFactory.getLogger(ServiceClient.class); - protected ServiceClient client; - - int exec(ClientArgs args) throws Throwable { - if (StringUtils.isEmpty(args.getAction())) { - System.out.println(args.usage()); - return -1; - } - switch (args.getAction()) { - case ACTION_BUILD: // Upload app json onto hdfs - client.actionBuild(args.getActionBuildArgs()); - break; - case ACTION_START: // start the app with the pre-uploaded app json on hdfs - client.actionStart(args.getClusterName()); - break; - case ACTION_CREATE: // create == build + start - client.actionCreate(args.getActionCreateArgs()); - break; - case ACTION_STATUS: - Service app = client.getStatus(args.getClusterName()); - System.out.println(app); - break; - case ACTION_FLEX: - try { - client.actionFlexByCLI(args); - } catch (FileNotFoundException e) { - System.err.println( - args.getClusterName() + " doesn't exist: " + e.getMessage()); - return -1; - } - break; - case ACTION_STOP: - client.actionStop(args.getClusterName(), false); - break; - case ACTION_DESTROY: // Destroy can happen only if app is already stopped - client.actionDestroy(args.getClusterName()); - break; - case ACTION_DEPENDENCY: // upload dependency jars - client.actionDependency(args.getActionDependencyArgs()); - break; - case ACTION_UPDATE: - client.updateLifetime(args.getClusterName(), - args.getActionUpdateArgs().lifetime); - break; - case ACTION_HELP: - LOG.info(args.usage()); - break; - default: - LOG.info("NOT IMPLEMENTED: " + args.getAction()); - LOG.info(args.usage()); - return -1; - } - return 0; - } - - public ServiceCLI() { - createServiceClient(); - } - - protected void createServiceClient() { - client = new ServiceClient(); - client.init(new YarnConfiguration()); - client.start(); - } - - public static void main(String[] args) throws Throwable { - ClientArgs clientArgs = new ClientArgs(args); - try { - clientArgs.parse(); - } catch (ParameterException | SliderException e) { - System.err.println(e.getMessage()); - System.exit(-1); - } - ServiceCLI cli = new ServiceCLI(); - int res = cli.exec(clientArgs); - System.exit(res); - } -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/ServiceClient.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/ServiceClient.java index f6d35e48b5..636b127b93 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/ServiceClient.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/ServiceClient.java @@ -34,7 +34,6 @@ import org.apache.hadoop.registry.client.api.RegistryOperationsFactory; import org.apache.hadoop.registry.client.binding.RegistryUtils; import org.apache.hadoop.security.UserGroupInformation; -import org.apache.hadoop.service.CompositeService; import org.apache.hadoop.util.VersionInfo; import org.apache.hadoop.yarn.api.ApplicationConstants; import org.apache.hadoop.yarn.api.protocolrecords.GetApplicationsRequest; @@ -50,6 +49,7 @@ import org.apache.hadoop.yarn.api.records.LocalResourceType; import org.apache.hadoop.yarn.api.records.Resource; import org.apache.hadoop.yarn.api.records.YarnApplicationState; +import org.apache.hadoop.yarn.client.api.AppAdminClient; import org.apache.hadoop.yarn.client.api.YarnClient; import org.apache.hadoop.yarn.client.api.YarnClientApplication; import org.apache.hadoop.yarn.conf.YarnConfiguration; @@ -65,13 +65,6 @@ import org.apache.hadoop.yarn.service.api.records.Component; import org.apache.hadoop.yarn.service.api.records.Service; import org.apache.hadoop.yarn.service.api.records.ServiceState; -import org.apache.hadoop.yarn.service.client.params.AbstractClusterBuildingActionArgs; -import org.apache.hadoop.yarn.service.client.params.ActionCreateArgs; -import org.apache.hadoop.yarn.service.client.params.ActionDependencyArgs; -import org.apache.hadoop.yarn.service.client.params.ActionFlexArgs; -import org.apache.hadoop.yarn.service.client.params.Arguments; -import org.apache.hadoop.yarn.service.client.params.ClientArgs; -import org.apache.hadoop.yarn.service.client.params.CommonArgs; import org.apache.hadoop.yarn.service.conf.SliderExitCodes; import org.apache.hadoop.yarn.service.conf.YarnServiceConf; import org.apache.hadoop.yarn.service.conf.YarnServiceConstants; @@ -80,7 +73,6 @@ import org.apache.hadoop.yarn.service.exceptions.BadClusterStateException; import org.apache.hadoop.yarn.service.exceptions.BadConfigException; import org.apache.hadoop.yarn.service.exceptions.SliderException; -import org.apache.hadoop.yarn.service.exceptions.UsageException; import org.apache.hadoop.yarn.service.provider.AbstractClientProvider; import org.apache.hadoop.yarn.service.provider.ProviderUtils; import org.apache.hadoop.yarn.service.utils.ServiceApiUtil; @@ -107,16 +99,14 @@ import java.util.concurrent.ConcurrentHashMap; import static org.apache.hadoop.yarn.api.records.YarnApplicationState.*; -import static org.apache.hadoop.yarn.service.client.params.SliderActions.ACTION_CREATE; -import static org.apache.hadoop.yarn.service.client.params.SliderActions.ACTION_FLEX; import static org.apache.hadoop.yarn.service.conf.YarnServiceConf.YARN_QUEUE; import static org.apache.hadoop.yarn.service.utils.ServiceApiUtil.jsonSerDeser; import static org.apache.hadoop.yarn.service.utils.SliderUtils.*; @InterfaceAudience.Public @InterfaceStability.Unstable -public class ServiceClient extends CompositeService - implements SliderExitCodes, YarnServiceConstants { +public class ServiceClient extends AppAdminClient implements SliderExitCodes, + YarnServiceConstants { private static final Logger LOG = LoggerFactory.getLogger(ServiceClient.class); private SliderFileSystem fs; @@ -136,10 +126,6 @@ public class ServiceClient extends CompositeService private static EnumSet preRunningStates = EnumSet.of(NEW, NEW_SAVING, SUBMITTED, ACCEPTED); - public ServiceClient() { - super(ServiceClient.class.getName()); - } - @Override protected void serviceInit(Configuration configuration) throws Exception { fs = new SliderFileSystem(configuration); @@ -157,28 +143,60 @@ protected void serviceStop() throws Exception { super.serviceStop(); } - private Service loadAppJsonFromLocalFS( - AbstractClusterBuildingActionArgs args) throws IOException { - File file = args.getFile(); + public Service loadAppJsonFromLocalFS(String fileName, String serviceName, + Long lifetime, String queue) throws IOException, YarnException { + File file = new File(fileName); + if (!file.exists() && fileName.equals(file.getName())) { + String examplesDirStr = System.getenv("YARN_SERVICE_EXAMPLES_DIR"); + String[] examplesDirs; + if (examplesDirStr == null) { + String yarnHome = System + .getenv(ApplicationConstants.Environment.HADOOP_YARN_HOME.key()); + examplesDirs = new String[]{ + yarnHome + "/share/hadoop/yarn/yarn-service-examples", + yarnHome + "/yarn-service-examples" + }; + } else { + examplesDirs = StringUtils.split(examplesDirStr, ":"); + } + for (String dir : examplesDirs) { + file = new File(MessageFormat.format("{0}/{1}/{2}.json", + dir, fileName, fileName)); + if (file.exists()) { + break; + } + // Then look for secondary location. + file = new File(MessageFormat.format("{0}/{1}.json", + dir, fileName)); + if (file.exists()) { + break; + } + } + } + if (!file.exists()) { + throw new YarnException("File or example could not be found: " + + fileName); + } Path filePath = new Path(file.getAbsolutePath()); LOG.info("Loading service definition from: " + filePath); Service service = jsonSerDeser .load(FileSystem.getLocal(getConfig()), filePath); - if (args.lifetime > 0) { - service.setLifetime(args.lifetime); + if (!StringUtils.isEmpty(serviceName)) { + service.setName(serviceName); } - if (!StringUtils.isEmpty(args.getServiceName())) { - service.setName(args.getServiceName()); + if (lifetime != null && lifetime > 0) { + service.setLifetime(lifetime); } - if (!StringUtils.isEmpty(args.queue)) { - service.setQueue(args.queue); + if (!StringUtils.isEmpty(queue)) { + service.setQueue(queue); } return service; } - public int actionBuild(AbstractClusterBuildingActionArgs args) - throws IOException, YarnException { - return actionBuild(loadAppJsonFromLocalFS(args)); + public int actionSave(String fileName, String serviceName, Long lifetime, + String queue) throws IOException, YarnException { + return actionBuild(loadAppJsonFromLocalFS(fileName, serviceName, + lifetime, queue)); } public int actionBuild(Service service) @@ -189,43 +207,13 @@ public int actionBuild(Service service) return EXIT_SUCCESS; } - public int actionCreate(ActionCreateArgs args) - throws IOException, YarnException { - Service serviceDef; - if (args.file != null) { - serviceDef = loadAppJsonFromLocalFS(args); - } else if (!StringUtils.isEmpty(args.example)) { - // create an example service - args.file = findExampleService(args); - serviceDef = loadAppJsonFromLocalFS(args); - } else { - throw new YarnException("No service definition provided!"); - } - actionCreate(serviceDef); + public int actionLaunch(String fileName, String serviceName, Long lifetime, + String queue) throws IOException, YarnException { + actionCreate(loadAppJsonFromLocalFS(fileName, serviceName, lifetime, + queue)); return EXIT_SUCCESS; } - private File findExampleService(ActionCreateArgs args) throws YarnException { - String yarnHome = System - .getenv(ApplicationConstants.Environment.HADOOP_YARN_HOME.key()); - // First look for the standard location. - File file = new File(MessageFormat - .format("{0}/share/hadoop/yarn/yarn-service-examples/{1}/{2}.json", - yarnHome, args.example, args.example)); - if (file.exists()) { - return file; - } - // Then look for secondary location. - file = new File(MessageFormat - .format("{0}/yarn-service-examples/{1}/{2}.json", yarnHome, - args.example, args.example)); - if (file.exists()) { - return file; - } - throw new YarnException( - "Example service " + args.example + " does not exist!"); - } - public ApplicationId actionCreate(Service service) throws IOException, YarnException { String serviceName = service.getName(); @@ -244,14 +232,12 @@ public ApplicationId actionCreate(Service service) return appId; } - // Called by ServiceCLI - protected int actionFlexByCLI(ClientArgs args) - throws YarnException, IOException { - ActionFlexArgs flexArgs = args.getActionFlexArgs(); + public int actionFlex(String serviceName, Map + componentCountStrings) throws YarnException, IOException { Map componentCounts = - new HashMap<>(flexArgs.getComponentMap().size()); + new HashMap<>(componentCountStrings.size()); Service persistedService = - ServiceApiUtil.loadService(fs, flexArgs.getServiceName()); + ServiceApiUtil.loadService(fs, serviceName); if (!StringUtils.isEmpty(persistedService.getId())) { cachedAppIds.put(persistedService.getName(), ApplicationId.fromString(persistedService.getId())); @@ -260,8 +246,7 @@ protected int actionFlexByCLI(ClientArgs args) + " appId is null, may be not submitted to YARN yet"); } - for (Map.Entry entry : flexArgs.getComponentMap() - .entrySet()) { + for (Map.Entry entry : componentCountStrings.entrySet()) { String compName = entry.getKey(); ServiceApiUtil.validateNameFormat(compName, getConfig()); Component component = persistedService.getComponent(compName); @@ -272,11 +257,7 @@ protected int actionFlexByCLI(ClientArgs args) parseNumberOfContainers(component, entry.getValue()); componentCounts.put(compName, numberOfContainers); } - // throw usage exception if no changes proposed - if (componentCounts.size() == 0) { - actionHelp(ACTION_FLEX, args); - } - flexComponents(args.getClusterName(), componentCounts, persistedService); + flexComponents(serviceName, componentCounts, persistedService); return EXIT_SUCCESS; } @@ -372,6 +353,11 @@ private Map flexComponents(String serviceName, return original; } + public int actionStop(String serviceName) + throws YarnException, IOException { + return actionStop(serviceName, true); + } + public int actionStop(String serviceName, boolean waitForAppStopped) throws YarnException, IOException { ServiceApiUtil.validateNameFormat(serviceName, getConfig()); @@ -442,7 +428,8 @@ public int actionStop(String serviceName, boolean waitForAppStopped) return EXIT_SUCCESS; } - public int actionDestroy(String serviceName) throws Exception { + public int actionDestroy(String serviceName) throws YarnException, + IOException { ServiceApiUtil.validateNameFormat(serviceName, getConfig()); verifyNoLiveAppInRM(serviceName, "destroy"); @@ -461,7 +448,11 @@ public int actionDestroy(String serviceName) throws Exception { throw new YarnException(message); } } - deleteZKNode(serviceName); + try { + deleteZKNode(serviceName); + } catch (Exception e) { + throw new IOException("Could not delete zk node for " + serviceName, e); + } String registryPath = ServiceRegistryUtils.registryPathForInstance(serviceName); try { getRegistryClient().delete(registryPath, true); @@ -517,11 +508,6 @@ private synchronized CuratorFramework getCuratorClient() return curatorClient; } - private int actionHelp(String actionName, CommonArgs args) - throws YarnException, IOException { - throw new UsageException(CommonArgs.usage(args, actionName)); - } - private void verifyNoLiveAppInRM(String serviceName, String action) throws IOException, YarnException { Set types = new HashSet<>(1); @@ -634,9 +620,9 @@ private String buildCommandLine(String serviceName, Configuration conf, CLI.sysprop(SYSPROP_LOG_DIR, ApplicationConstants.LOG_DIR_EXPANSION_VAR); } CLI.add(ServiceMaster.class.getCanonicalName()); - CLI.add(ACTION_CREATE, serviceName); //TODO debugAM CLI.add(Arguments.ARG_DEBUG) - CLI.add(Arguments.ARG_SERVICE_DEF_PATH, new Path(appRootDir, serviceName + ".json")); + CLI.add("-" + ServiceMaster.YARNFILE_OPTION, new Path(appRootDir, + serviceName + ".json")); // pass the registry binding CLI.addConfOptionToCLI(conf, RegistryConstants.KEY_REGISTRY_ZK_ROOT, RegistryConstants.DEFAULT_ZK_REGISTRY_ROOT); @@ -841,6 +827,24 @@ public ServiceState convertState(FinalApplicationStatus status) { return ServiceState.ACCEPTED; } + public String getStatusString(String appId) + throws IOException, YarnException { + ApplicationReport appReport = + yarnClient.getApplicationReport(ApplicationId.fromString(appId)); + + if (appReport.getYarnApplicationState() != RUNNING) { + return ""; + } + if (StringUtils.isEmpty(appReport.getHost())) { + return ""; + } + ClientAMProtocol amProxy = + createAMProxy(appReport.getHost(), appReport.getRpcPort()); + GetStatusResponseProto response = + amProxy.getStatus(GetStatusRequestProto.newBuilder().build()); + return response.getStatus(); + } + public Service getStatus(String serviceName) throws IOException, YarnException { ServiceApiUtil.validateNameFormat(serviceName, getConfig()); @@ -877,7 +881,11 @@ public YarnClient getYarnClient() { return this.yarnClient; } - public int actionDependency(ActionDependencyArgs args) + public int enableFastLaunch() throws IOException, YarnException { + return actionDependency(true); + } + + public int actionDependency(boolean overwrite) throws IOException, YarnException { String currentUser = RegistryUtils.currentUser(); LOG.info("Running command as user {}", currentUser); @@ -886,11 +894,10 @@ public int actionDependency(ActionDependencyArgs args) // Check if dependency has already been uploaded, in which case log // appropriately and exit success (unless overwrite has been requested) - if (fs.isFile(dependencyLibTarGzip) && !args.overwrite) { + if (fs.isFile(dependencyLibTarGzip) && !overwrite) { System.out.println(String.format( - "Dependency libs are already uploaded to %s. Use %s " - + "if you want to re-upload", dependencyLibTarGzip.toUri(), - Arguments.ARG_OVERWRITE)); + "Dependency libs are already uploaded to %s.", dependencyLibTarGzip + .toUri())); return EXIT_SUCCESS; } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/AbstractActionArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/AbstractActionArgs.java deleted file mode 100644 index 9b7e2a4576..0000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/AbstractActionArgs.java +++ /dev/null @@ -1,139 +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.hadoop.yarn.service.client.params; - -import com.beust.jcommander.Parameter; -import org.apache.hadoop.fs.Path; -import org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException; -import org.apache.hadoop.yarn.service.exceptions.ErrorStrings; -import org.apache.hadoop.yarn.service.exceptions.UsageException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.ArrayList; -import java.util.List; - -/** - * Base args for all actions - */ -public abstract class AbstractActionArgs extends ArgOps implements Arguments { - protected static final Logger log = - LoggerFactory.getLogger(AbstractActionArgs.class); - - - protected AbstractActionArgs() { - } - - /** - * This is the default parameter - */ - @Parameter - public List parameters = new ArrayList<>(); - - /** - * get the name: relies on arg 1 being the cluster name in all operations - * @return the name argument, null if there is none - */ - public String getServiceName() { - return (parameters.isEmpty()) ? null : parameters.get(0); - } - - /** - -D name=value - - 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. - - */ - - @Parameter(names = ARG_DEFINE, arity = 1, description = "Definitions", hidden = true) - public List definitions = new ArrayList<>(); - - /** - * System properties - */ - @Parameter(names = {ARG_SYSPROP}, arity = 1, - description = "system properties in the form name value" + - " These are set after the JVM is started.", - hidden = true) - public List sysprops = new ArrayList<>(0); - - - @Parameter(names = ARG_DEBUG, description = "Debug mode", hidden = true) - public boolean debug = false; - - /** - * Get the min #of params expected - * @return the min number of params in the {@link #parameters} field - */ - public int getMinParams() { - return 1; - } - - /** - * Get the name of the action - * @return the action name - */ - public abstract String getActionName() ; - - /** - * Get the max #of params expected - * @return the number of params in the {@link #parameters} field; - */ - public int getMaxParams() { - return getMinParams(); - } - - public void validate() throws BadCommandArgumentsException, UsageException { - - int minArgs = getMinParams(); - int actionArgSize = parameters.size(); - if (minArgs > actionArgSize) { - throw new BadCommandArgumentsException( - ErrorStrings.ERROR_NOT_ENOUGH_ARGUMENTS + getActionName() + - ", Expected minimum " + minArgs + " but got " + actionArgSize); - } - int maxArgs = getMaxParams(); - if (maxArgs == -1) { - maxArgs = minArgs; - } - if (actionArgSize > maxArgs) { - String message = String.format("%s for action %s: limit is %d but saw %d: ", - ErrorStrings.ERROR_TOO_MANY_ARGUMENTS, - getActionName(), maxArgs, - actionArgSize); - - log.error(message); - int index = 1; - StringBuilder buf = new StringBuilder(message); - for (String actionArg : parameters) { - log.error("[{}] \"{}\"", index++, actionArg); - buf.append(" \"").append(actionArg).append("\" "); - } - throw new BadCommandArgumentsException(buf.toString()); - } - } - - @Override - public String toString() { - return super.toString() + ": " + getActionName(); - } -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/AbstractArgsDelegate.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/AbstractArgsDelegate.java deleted file mode 100644 index 457e3570f9..0000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/AbstractArgsDelegate.java +++ /dev/null @@ -1,28 +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.hadoop.yarn.service.client.params; - -import org.apache.hadoop.yarn.service.client.params.ArgOps; -import org.apache.hadoop.yarn.service.client.params.Arguments; - -/** - * Base class for all the delegates - */ -public class AbstractArgsDelegate extends ArgOps implements Arguments { -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/AbstractClusterBuildingActionArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/AbstractClusterBuildingActionArgs.java deleted file mode 100644 index 4ecbe9c642..0000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/AbstractClusterBuildingActionArgs.java +++ /dev/null @@ -1,46 +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.hadoop.yarn.service.client.params; - -import com.beust.jcommander.Parameter; - -import java.io.File; - -/** - * Abstract Action to build things; shares args across build and - * list - */ -public abstract class AbstractClusterBuildingActionArgs - extends AbstractActionArgs { - @Parameter(names = { ARG_FILE, ARG_FILE_SHORT }, - description = "The path to the service definition file in JSON format.") - public File file; - - public File getFile() { - return file; - } - - @Parameter(names = { - ARG_QUEUE, ARG_SHORT_QUEUE}, description = "Queue to submit the service") - public String queue; - - @Parameter(names = { - ARG_LIFETIME }, description = "Lifetime of the service from the time of request") - public long lifetime; -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionBuildArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionBuildArgs.java deleted file mode 100644 index 0228125935..0000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionBuildArgs.java +++ /dev/null @@ -1,39 +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.hadoop.yarn.service.client.params; - -import com.beust.jcommander.Parameters; -import org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException; - -@Parameters(commandNames = { SliderActions.ACTION_BUILD}, - commandDescription = SliderActions.DESCRIBE_ACTION_BUILD) - -public class ActionBuildArgs extends AbstractClusterBuildingActionArgs { - - @Override - public String getActionName() { - return SliderActions.ACTION_BUILD; - } - - @Override - public void validate() throws BadCommandArgumentsException { - if (file == null) { - throw new BadCommandArgumentsException("No service definition provided."); - } - } -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionClientArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionClientArgs.java deleted file mode 100644 index c43d61a85a..0000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionClientArgs.java +++ /dev/null @@ -1,71 +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.hadoop.yarn.service.client.params; - -import com.beust.jcommander.Parameter; -import com.beust.jcommander.Parameters; -import org.apache.hadoop.yarn.service.client.params.AbstractActionArgs; -import org.apache.hadoop.yarn.service.client.params.SliderActions; - -import java.io.File; - -@Parameters(commandNames = { SliderActions.ACTION_CLIENT}, - commandDescription = SliderActions.DESCRIBE_ACTION_CLIENT) - -public class ActionClientArgs extends AbstractActionArgs { - - @Override - public String getActionName() { - return SliderActions.ACTION_CLIENT; - } - - @Parameter(names = {ARG_INSTALL}, - description = "Install client") - public boolean install; - - @Parameter(names = {ARG_NAME}, - description = "The name of the service") - public String name; - - @Parameter(names = {ARG_PACKAGE}, - description = "Path to app package") - public String packageURI; - - @Parameter(names = {ARG_DEST}, - description = "The location where to install the client") - public File installLocation; - - @Parameter(names = {ARG_CONFIG}, - description = "Client configuration") - public File clientConfig; - - /** - * Get the min #of params expected - * - * @return the min number of params in the {@link #parameters} field - */ - public int getMinParams() { - return 0; - } - - @Override - public int getMaxParams() { - return 1; - } -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionCreateArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionCreateArgs.java deleted file mode 100644 index 039f5282e7..0000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionCreateArgs.java +++ /dev/null @@ -1,46 +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.hadoop.yarn.service.client.params; - -import com.beust.jcommander.Parameter; -import com.beust.jcommander.Parameters; -import org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException; - -@Parameters(commandNames = { SliderActions.ACTION_CREATE}, - commandDescription = SliderActions.DESCRIBE_ACTION_CREATE) - -public class ActionCreateArgs extends AbstractClusterBuildingActionArgs { - - @Parameter(names = { ARG_EXAMPLE, ARG_EXAMPLE_SHORT }, - description = "The name of the example service such as sleeper") - public String example; - - @Override - public String getActionName() { - return SliderActions.ACTION_CREATE; - } - - @Override - public void validate() throws BadCommandArgumentsException { - if (file == null && example == null) { - throw new BadCommandArgumentsException("No service definition provided."); - } - } -} - diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionDependencyArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionDependencyArgs.java deleted file mode 100644 index 699e6ab469..0000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionDependencyArgs.java +++ /dev/null @@ -1,65 +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.hadoop.yarn.service.client.params; - -import org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException; -import org.apache.hadoop.yarn.service.exceptions.UsageException; - -import com.beust.jcommander.Parameter; -import com.beust.jcommander.Parameters; - -@Parameters(commandNames = { SliderActions.ACTION_DEPENDENCY }, - commandDescription = SliderActions.DESCRIBE_ACTION_DEPENDENCY) -public class ActionDependencyArgs extends AbstractActionArgs { - - @Override - public String getActionName() { - return SliderActions.ACTION_DEPENDENCY; - } - - @Parameter(names = { ARG_UPLOAD }, required = true, - description = "Upload AM libraries to HDFS for this client version") - public boolean upload; - - @Parameter(names = { ARG_OVERWRITE }, - description = "Overwrite current uploaded dependency libs") - public boolean overwrite = false; - - /** - * Get the min #of params expected - * - * @return the min number of params in the {@link #parameters} field - */ - public int getMinParams() { - return 0; - } - - @Override - public int getMaxParams() { - return 1; - } - - @Override - public void validate() throws BadCommandArgumentsException, UsageException { - super.validate(); - - if (!upload) { - throw new UsageException("Option " + ARG_UPLOAD + " is mandatory"); - } - } -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionDestroyArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionDestroyArgs.java deleted file mode 100644 index 8c41c0449c..0000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionDestroyArgs.java +++ /dev/null @@ -1,37 +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.hadoop.yarn.service.client.params; - -import com.beust.jcommander.Parameter; -import com.beust.jcommander.Parameters; - -@Parameters(commandNames = { SliderActions.ACTION_DESTROY}, - commandDescription = SliderActions.DESCRIBE_ACTION_DESTROY) - -public class ActionDestroyArgs extends AbstractActionArgs { - - @Override - public String getActionName() { - return SliderActions.ACTION_DESTROY; - } - - @Parameter(names = {ARG_FORCE}, - description = "force the operation") - public boolean force; -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionExistsArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionExistsArgs.java deleted file mode 100644 index 088ad47e30..0000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionExistsArgs.java +++ /dev/null @@ -1,49 +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.hadoop.yarn.service.client.params; - -import com.beust.jcommander.Parameter; -import com.beust.jcommander.Parameters; -import org.apache.hadoop.yarn.service.client.params.AbstractActionArgs; -import org.apache.hadoop.yarn.service.client.params.SliderActions; - -import java.io.File; - -@Parameters(commandNames = { SliderActions.ACTION_EXISTS}, - commandDescription = SliderActions.DESCRIBE_ACTION_EXISTS) - -public class ActionExistsArgs extends AbstractActionArgs { - - @Override - public String getActionName() { - return SliderActions.ACTION_EXISTS; - } - - @Parameter(names = {ARG_LIVE}, - description = "verify that the service is running") - public boolean live; - - @Parameter(names = {ARG_STATE}, - description = "verify that the service is in the specific YARN state") - public String state = ""; - - @Parameter(names = {ARG_OUTPUT, ARG_OUTPUT_SHORT}, - description = "output file for any service report") - public File out; -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionFlexArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionFlexArgs.java deleted file mode 100644 index b7acf58dc6..0000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionFlexArgs.java +++ /dev/null @@ -1,50 +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.hadoop.yarn.service.client.params; - -import com.beust.jcommander.Parameters; -import com.beust.jcommander.ParametersDelegate; -import org.apache.hadoop.yarn.service.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 { - - @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 getComponentMap() throws - BadCommandArgumentsException { - return componentDelegate.getComponentMap(); - } -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionFreezeArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionFreezeArgs.java deleted file mode 100644 index aecf0ebb2c..0000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionFreezeArgs.java +++ /dev/null @@ -1,56 +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.hadoop.yarn.service.client.params; - -import com.beust.jcommander.Parameter; -import com.beust.jcommander.Parameters; -import com.beust.jcommander.ParametersDelegate; - -@Parameters(commandNames = { SliderActions.ACTION_STOP }, - commandDescription = SliderActions.DESCRIBE_ACTION_FREEZE) - -public class ActionFreezeArgs extends AbstractActionArgs implements - WaitTimeAccessor { - @Override - public String getActionName() { - return SliderActions.ACTION_STOP; - } - - public static final String FREEZE_COMMAND_ISSUED = "stop command issued"; - @ParametersDelegate - public WaitArgsDelegate waitDelegate = new WaitArgsDelegate(); - - @Override - public int getWaittime() { - return waitDelegate.getWaittime(); - } - - @Override - public void setWaittime(int waittime) { - waitDelegate.setWaittime(waittime); - } - - @Parameter(names={ARG_MESSAGE}, - description = "reason for the operation") - public String message = FREEZE_COMMAND_ISSUED; - - @Parameter(names = {ARG_FORCE}, - description = "force the operation") - public boolean force; -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionHelpArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionHelpArgs.java deleted file mode 100644 index 51aa88a835..0000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionHelpArgs.java +++ /dev/null @@ -1,44 +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.hadoop.yarn.service.client.params; - -import com.beust.jcommander.Parameters; -import org.apache.hadoop.yarn.service.client.params.AbstractActionArgs; -import org.apache.hadoop.yarn.service.client.params.SliderActions; - -/** - * The Help command - */ -@Parameters(commandNames = { SliderActions.ACTION_HELP}, - commandDescription = SliderActions.DESCRIBE_ACTION_HELP) -public class ActionHelpArgs extends AbstractActionArgs { - @Override - public String getActionName() { - return SliderActions.ACTION_HELP; - } - - /** - * Get the min #of params expected - * @return the min number of params in the {@link #parameters} field - */ - @Override - public int getMinParams() { - return 0; - } -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionKeytabArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionKeytabArgs.java deleted file mode 100644 index 7e5145790c..0000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionKeytabArgs.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.hadoop.yarn.service.client.params; - -import com.beust.jcommander.Parameter; -import com.beust.jcommander.Parameters; -import org.apache.hadoop.yarn.service.client.params.AbstractActionArgs; -import org.apache.hadoop.yarn.service.client.params.SliderActions; - -@Parameters(commandNames = { SliderActions.ACTION_KEYTAB}, - commandDescription = SliderActions.DESCRIBE_ACTION_KEYTAB) - -public class ActionKeytabArgs extends AbstractActionArgs { - - public ActionKeytabArgs() { - super(); - } - - @Override - public String getActionName() { - return SliderActions.ACTION_INSTALL_KEYTAB; - } - - @Parameter(names = {ARG_KEYTABINSTALL}, - description = "Install the keytab") - public boolean install; - - @Parameter(names = {ARG_KEYTABDELETE}, - description = "Delete the keytab") - public boolean delete; - - @Parameter(names = {ARG_KEYTABLIST}, - description = "List of installed keytabs") - public boolean list; - - @Parameter(names = {ARG_KEYTAB}, - description = "Path or name of the keytab") - public String keytab; - - @Parameter(names = {ARG_FOLDER}, - description = "The name of the folder in which to store the keytab") - public String folder; - - @Parameter(names = {ARG_OVERWRITE}, description = "Overwrite existing keytab") - public boolean overwrite = false; - - /** - * Get the min #of params expected - * @return the min number of params in the {@link #parameters} field - */ - public int getMinParams() { - return 0; - } - - @Override - public int getMaxParams() { - return 3; - } - -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionListArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionListArgs.java deleted file mode 100644 index c05e602398..0000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionListArgs.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.hadoop.yarn.service.client.params; - -import java.util.HashSet; -import java.util.Set; - -import com.beust.jcommander.Parameter; -import com.beust.jcommander.Parameters; -import org.apache.hadoop.yarn.service.client.params.AbstractActionArgs; -import org.apache.hadoop.yarn.service.client.params.SliderActions; - -@Parameters(commandNames = { SliderActions.ACTION_LIST}, - commandDescription = SliderActions.DESCRIBE_ACTION_LIST) - -public class ActionListArgs extends AbstractActionArgs { - @Override - public String getActionName() { - return SliderActions.ACTION_LIST; - } - - @Parameter(names = {ARG_LIVE}, - description = "List only live service instances") - public boolean live; - - @Parameter(names = {ARG_STATE}, - description = "list only applications in the specific YARN state") - public String state = ""; - - @Parameter(names = {ARG_VERBOSE}, - description = "print out information in details") - public boolean verbose = false; - - @Parameter(names = {ARG_CONTAINERS}, - description = "List containers of a service instance") - public boolean containers; - - @Parameter(names = {ARG_VERSION}, - description = "Filter containers by app version (used with " + - ARG_CONTAINERS + ")") - public String version; - - @Parameter(names = {ARG_COMPONENTS}, variableArity = true, - description = "Filter containers by component names (used with " + - ARG_CONTAINERS + ")") - public Set components = new HashSet<>(0); - - /** - * Get the min #of params expected - * @return the min number of params in the {@link #parameters} field - */ - public int getMinParams() { - return 0; - } - - @Override - public int getMaxParams() { - return 1; - } -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionRegistryArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionRegistryArgs.java deleted file mode 100644 index 3e53418093..0000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionRegistryArgs.java +++ /dev/null @@ -1,218 +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.hadoop.yarn.service.client.params; - -import com.beust.jcommander.Parameter; -import com.beust.jcommander.Parameters; -import org.apache.hadoop.yarn.service.conf.YarnServiceConstants; -import org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException; -import org.apache.hadoop.yarn.service.exceptions.UsageException; -import org.apache.hadoop.yarn.service.api.records.ConfigFormat; - -import static org.apache.hadoop.yarn.service.client.params.SliderActions.ACTION_REGISTRY; -import static org.apache.hadoop.yarn.service.client.params.SliderActions.DESCRIBE_ACTION_REGISTRY; -import java.io.File; - -/** - * Registry actions - * - * --instance {app name}, if a / is in it, refers underneath? - * --dest {destfile} - * --list : list instances of slider service - * --listfiles - */ -@Parameters(commandNames = {ACTION_REGISTRY}, - commandDescription = DESCRIBE_ACTION_REGISTRY) - -public class ActionRegistryArgs extends AbstractActionArgs { - - public static final String USAGE = - "Usage: " + SliderActions.ACTION_REGISTRY - + " (" - + Arguments.ARG_LIST + "|" - + Arguments.ARG_LISTCONF + "|" - + Arguments.ARG_LISTEXP + "|" - + Arguments.ARG_LISTFILES + "|" - + Arguments.ARG_GETCONF + "|" - + Arguments.ARG_GETEXP + "> " - + Arguments.ARG_NAME + " " - + " )" - + "[" + Arguments.ARG_VERBOSE + "] " - + "[" + Arguments.ARG_USER + "] " - + "[" + Arguments.ARG_OUTPUT + " ] " - + "[" + Arguments.ARG_SERVICETYPE + " ] " - + "[" + Arguments.ARG_FORMAT + " ] " - + System.getProperty("line.separator") - + "Arguments.ARG_GETEXP only supports " + Arguments.ARG_FORMAT + " json" - ; - public ActionRegistryArgs() { - } - - public ActionRegistryArgs(String name) { - this.name = name; - } - - @Override - public String getActionName() { - return ACTION_REGISTRY; - } - - /** - * Get the min #of params expected - * @return the min number of params in the {@link #parameters} field - */ - @Override - public int getMinParams() { - return 0; - } - - @Parameter(names = {ARG_LIST}, - description = "list services") - public boolean list; - - @Parameter(names = {ARG_LISTCONF}, - description = "list configurations") - public boolean listConf; - - @Parameter(names = {ARG_GETCONF}, - description = "get configuration") - public String getConf; - - @Parameter(names = {ARG_LISTEXP}, - description = "list exports") - public boolean listExports; - - @Parameter(names = {ARG_GETEXP}, - description = "get export") - public String getExport; - - @Parameter(names = {ARG_LISTFILES}, - description = "list files") - public String listFiles; - - @Parameter(names = {ARG_GETFILES}, - description = "get files") - public String getFiles; - - //--format - @Parameter(names = ARG_FORMAT, - description = "Format for a response: ") - public String format = ConfigFormat.XML.toString() ; - - @Parameter(names = {ARG_OUTPUT, ARG_OUTPUT_SHORT, ARG_DEST}, - description = "Output destination") - public File out; - - @Parameter(names = {ARG_NAME}, - description = "name of an instance") - public String name; - - @Parameter(names = {ARG_SERVICETYPE}, - description = "optional service type") - public String serviceType = YarnServiceConstants.APP_TYPE; - - @Parameter(names = {ARG_VERBOSE}, - description = "verbose output") - public boolean verbose; - - @Parameter(names = {ARG_INTERNAL}, - description = "fetch internal registry entries") - public boolean internal; - - @Parameter(names = {ARG_USER}, - description = "the name of the user whose service is being resolved") - public String user; - - /** - * validate health of all the different operations - * @throws BadCommandArgumentsException - */ - @Override - public void validate() throws BadCommandArgumentsException, UsageException { - super.validate(); - - //verify that at most one of the operations is set - int gets = s(getConf) + s(getFiles) + s(getExport); - int lists = s(list) + s(listConf) + s(listFiles) + s(listExports); - int set = lists + gets; - if (set > 1) { - throw new UsageException(USAGE); - } - - if (out != null && ( set == 0)) { - throw new UsageException("output path" - + " is only supported on 'get' operations: "); - } - if (!list && !is(name)) { - throw new UsageException("Argument " + ARG_NAME - +" missing: "); - - } - } - - private int s(String arg) { - return is(arg) ? 1 : 0; - } - - private boolean is(String arg) { - return arg != null; - } - - private int s(boolean arg) { - return arg ? 1 : 0; - } - - private String ifdef(String arg, boolean val) { - return val ? (arg + " "): ""; - } - - private String ifdef(String arg, String val) { - if (is(val)) { - return arg + " " + val + " "; - } else { - return ""; - } - } - - @Override - public String toString() { - final StringBuilder sb = - new StringBuilder(ACTION_REGISTRY); - sb.append(' '); - sb.append(ifdef(ARG_LIST, list)); - sb.append(ifdef(ARG_LISTCONF, listConf)); - sb.append(ifdef(ARG_LISTFILES, listFiles)); - sb.append(ifdef(ARG_GETCONF, getConf)); - sb.append(ifdef(ARG_GETFILES, getFiles)); - - sb.append(ifdef(ARG_NAME, name)); - sb.append(ifdef(ARG_SERVICETYPE, serviceType)); - - - sb.append(ifdef(ARG_VERBOSE, verbose)); - sb.append(ifdef(ARG_INTERNAL, internal)); - - if (out != null) { - sb.append(ifdef(ARG_OUTPUT, out.toString())); - } - sb.append(ifdef(ARG_FORMAT, format)); - - return sb.toString(); - } -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionResolveArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionResolveArgs.java deleted file mode 100644 index 65f04726c6..0000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionResolveArgs.java +++ /dev/null @@ -1,153 +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.hadoop.yarn.service.client.params; - -import com.beust.jcommander.Parameter; -import com.beust.jcommander.Parameters; -import org.apache.commons.lang.StringUtils; -import org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException; -import org.apache.hadoop.yarn.service.exceptions.UsageException; - -import java.io.File; - -import static org.apache.hadoop.yarn.service.client.params.SliderActions.ACTION_RESOLVE; -import static org.apache.hadoop.yarn.service.client.params.SliderActions.DESCRIBE_ACTION_REGISTRY; - -/** - * Resolve registry entries - * - * --path {path} - * --out {destfile} - * --verbose - * --list - */ -@Parameters(commandNames = {ACTION_RESOLVE}, - commandDescription = DESCRIBE_ACTION_REGISTRY) -public class ActionResolveArgs extends AbstractActionArgs { - - public static final String USAGE = - "Usage: " + SliderActions.ACTION_RESOLVE - + " " - + ARG_PATH + " " - + "[" + ARG_LIST + "] " - + "[" + ARG_OUTPUT + " ] " - + "[" + ARG_DESTDIR + " ] " - ; - public ActionResolveArgs() { - } - - @Override - public String getActionName() { - return ACTION_RESOLVE; - } - - /** - * Get the min #of params expected - * @return the min number of params in the {@link #parameters} field - */ - @Override - public int getMinParams() { - return 0; - } - - @Parameter(names = {ARG_LIST}, - description = "list services") - public boolean list; - - @Parameter(names = {ARG_PATH}, - description = "resolve a path") - public String path; - - @Parameter(names = {ARG_DESTDIR}, - description = "destination directory for operations") - public File destdir; - - @Parameter(names = {ARG_OUTPUT, ARG_OUTPUT_SHORT}, - description = "dest file") - public File out; - - @Override - public String toString() { - final StringBuilder sb = - new StringBuilder(ACTION_RESOLVE).append(" "); - sb.append(ARG_PATH).append(" ").append(path).append(" "); - if (list) { - sb.append(ARG_LIST).append(" "); - } - if (destdir != null) { - sb.append(ARG_DESTDIR).append(" ").append(destdir).append(" "); - } - if (out != null) { - sb.append(ARG_OUTPUT).append(" ").append(out).append(" "); - } - return sb.toString(); - } - - @Override - public void validate() throws BadCommandArgumentsException, UsageException { - super.validate(); - if (StringUtils.isEmpty(path)) { - throw new BadCommandArgumentsException("Missing mandatory argument " - + ARG_PATH); - } - if (list && out != null) { - throw new BadCommandArgumentsException("Argument " - + ARG_OUTPUT + - " not supported for " + ARG_LIST); - } - if (out != null && destdir != null) { - throw new BadCommandArgumentsException( - ARG_OUTPUT + " and " + ARG_DESTDIR + " cannot be used together" - ); - } - } - - public String getPath() { - return path; - } - - public void setPath(String path) { - this.path = path; - } - - public boolean isList() { - return list; - } - - public void setList(boolean list) { - this.list = list; - } - - public File getDestdir() { - return destdir; - } - - public void setDestdir(File destdir) { - this.destdir = destdir; - } - - public File getOut() { - return out; - } - - public void setOut(File out) { - this.out = out; - } - -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionResourceArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionResourceArgs.java deleted file mode 100644 index b03dc92fa7..0000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionResourceArgs.java +++ /dev/null @@ -1,70 +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.hadoop.yarn.service.client.params; - -import com.beust.jcommander.Parameter; -import com.beust.jcommander.Parameters; -import org.apache.hadoop.yarn.service.client.params.AbstractActionArgs; -import org.apache.hadoop.yarn.service.client.params.SliderActions; - -@Parameters(commandNames = { SliderActions.ACTION_RESOURCE}, - commandDescription = SliderActions.DESCRIBE_ACTION_RESOURCE) - -public class ActionResourceArgs extends AbstractActionArgs { - - @Override - public String getActionName() { - return SliderActions.ACTION_RESOURCE; - } - - @Parameter(names = {ARG_INSTALL}, - description = "Install the resource(s)") - public boolean install; - - @Parameter(names = {ARG_DELETE}, - description = "Delete the file") - public boolean delete; - - @Parameter(names = {ARG_LIST}, - description = "List of installed files") - public boolean list; - - @Parameter(names = {ARG_RESOURCE}, - description = "Name of the file or directory") - public String resource; - - @Parameter(names = {ARG_DESTDIR}, - description = "The name of the folder in which to store the resources") - public String folder; - - @Parameter(names = {ARG_OVERWRITE}, description = "Overwrite existing resource(s)") - public boolean overwrite = false; - - /** - * Get the min #of params expected - * @return the min number of params in the {@link #parameters} field - */ - public int getMinParams() { - return 0; - } - - @Override - public int getMaxParams() { - return 3; - } -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionStatusArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionStatusArgs.java deleted file mode 100644 index 31f25efcb8..0000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionStatusArgs.java +++ /dev/null @@ -1,51 +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.hadoop.yarn.service.client.params; - -import com.beust.jcommander.Parameter; -import com.beust.jcommander.Parameters; -import org.apache.hadoop.yarn.service.client.params.AbstractActionArgs; -import org.apache.hadoop.yarn.service.client.params.SliderActions; - -@Parameters(commandNames = { SliderActions.ACTION_STATUS}, - commandDescription = SliderActions.DESCRIBE_ACTION_STATUS) - -public class ActionStatusArgs extends AbstractActionArgs { - - @Override - public String getActionName() { - return SliderActions.ACTION_STATUS; - } - - @Parameter(names = {ARG_OUTPUT, ARG_OUTPUT_SHORT}, - description = "Output file for the status information") - public String output; - - @Parameter(names = {ARG_LIFETIME}, - description = "Lifetime of the service from the time of request") - public boolean lifetime; - - public String getOutput() { - return output; - } - - public void setOutput(String output) { - this.output = output; - } -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionThawArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionThawArgs.java deleted file mode 100644 index 175e367d2e..0000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionThawArgs.java +++ /dev/null @@ -1,67 +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.hadoop.yarn.service.client.params; - -import com.beust.jcommander.Parameter; -import com.beust.jcommander.Parameters; -import com.beust.jcommander.ParametersDelegate; - -import java.io.File; - -@Parameters(commandNames = { SliderActions.ACTION_START }, - commandDescription = SliderActions.DESCRIBE_ACTION_THAW) -public class ActionThawArgs extends AbstractActionArgs implements - WaitTimeAccessor, - LaunchArgsAccessor { - - - @Override - public String getActionName() { - return SliderActions.ACTION_START; - } - - @Override - public int getWaittime() { - return launchArgs.getWaittime(); - } - - @ParametersDelegate - LaunchArgsDelegate launchArgs = new LaunchArgsDelegate(); - - @Parameter(names = {ARG_LIFETIME}, - description = "Life time of the service since service started at" - + " running state") - public long lifetime; - - @Override - public String getRmAddress() { - return launchArgs.getRmAddress(); - } - - @Override - public void setWaittime(int waittime) { - launchArgs.setWaittime(waittime); - } - - - @Override - public File getOutputFile() { - return launchArgs.getOutputFile(); - } -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionTokensArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionTokensArgs.java deleted file mode 100644 index cf48513183..0000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionTokensArgs.java +++ /dev/null @@ -1,78 +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.hadoop.yarn.service.client.params; - -import com.beust.jcommander.Parameter; -import com.beust.jcommander.Parameters; -import org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException; -import org.apache.hadoop.yarn.service.exceptions.UsageException; - -import java.io.File; - -@Parameters(commandNames = { SliderActions.ACTION_TOKENS}, - commandDescription = "save tokens to a file or list tokens in a file") -public class ActionTokensArgs extends AbstractActionArgs { - - public static final String DUPLICATE_ARGS = "Only one of " + - ARG_SOURCE + " and " + ARG_OUTPUT + " allowed"; - - public static final String MISSING_KT_PROVIDER = - "Both " + ARG_KEYTAB + " and " + ARG_PRINCIPAL - + " must be provided"; - - @Override - public String getActionName() { - return SliderActions.ACTION_TOKENS; - } - - @Parameter(names = {ARG_OUTPUT}, - description = "File to write") - public File output; - - @Parameter(names = {ARG_SOURCE}, - description = "source file") - public File source; - - @Parameter(names = {ARG_KEYTAB}, description = "keytab to use") - public File keytab; - - @Parameter(names = {ARG_PRINCIPAL}, description = "principal to log in from a keytab") - public String principal=""; - - /** - * Get the min #of params expected - * @return the min number of params in the {@link #parameters} field - */ - public int getMinParams() { - return 0; - } - - @Override - public void validate() throws BadCommandArgumentsException, UsageException { - super.validate(); - if (output != null && source != null) { - throw new BadCommandArgumentsException(DUPLICATE_ARGS); - } - - // this is actually a !xor - if (keytab != null ^ !principal.isEmpty()) { - throw new BadCommandArgumentsException(MISSING_KT_PROVIDER); - } - } -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionUpdateArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionUpdateArgs.java deleted file mode 100644 index 00af69af14..0000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionUpdateArgs.java +++ /dev/null @@ -1,37 +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.hadoop.yarn.service.client.params; - -import com.beust.jcommander.Parameter; -import com.beust.jcommander.Parameters; - -@Parameters(commandNames = { SliderActions.ACTION_UPDATE}, - commandDescription = SliderActions.DESCRIBE_ACTION_UPDATE) - -public class ActionUpdateArgs extends AbstractActionArgs { - - @Parameter(names = { - ARG_LIFETIME }, description = "Lifetime of the service from the time of request") - public long lifetime; - - @Override - public String getActionName() { - return SliderActions.ACTION_UPDATE; - } -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ArgOps.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ArgOps.java deleted file mode 100644 index 00151f4c60..0000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ArgOps.java +++ /dev/null @@ -1,156 +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.hadoop.yarn.service.client.params; - -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.fs.FileSystem; -import org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException; -import org.apache.hadoop.yarn.service.exceptions.ErrorStrings; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Static argument manipulation operations - */ -public class ArgOps { - - private static final Logger - log = LoggerFactory.getLogger(ArgOps.class); - - /** - * create a 3-tuple - */ - public static List triple(String msg, int min, int max) { - List l = new ArrayList<>(3); - l.add(msg); - l.add(min); - l.add(max); - return l; - } - - public static void applyFileSystemBinding(String filesystemBinding, - Configuration conf) { - if (filesystemBinding != null) { - //filesystem argument was set -this overwrites any defaults in the - //configuration - FileSystem.setDefaultUri(conf, filesystemBinding); - } - } - - public static void splitPairs(Collection pairs, - Map dest) { - for (String prop : pairs) { - String[] keyval = prop.split("=", 2); - if (keyval.length == 2) { - dest.put(keyval[0], keyval[1]); - } - } - } - - - public static void applyDefinitions(Map definitionMap, - Configuration conf) { - for (Map.Entry entry : definitionMap.entrySet()) { - String key = entry.getKey(); - String val = entry.getValue(); - log.debug("configuration[{}]<=\"{}\"", key, val); - conf.set(key, val, "command line"); - } - } - - /** - * Create a map from a tuple list like ['worker','2','master','1] into a map - * ['worker':'2',"master":'1']; - * Duplicate entries also trigger errors - * @param description description for errors - * @param list list to conver to tuples - * @return the map of key value pairs -unordered. - * @throws BadCommandArgumentsException odd #of arguments received - */ - public static Map convertTupleListToMap(String description, - List list) throws - BadCommandArgumentsException { - Map results = new HashMap<>(); - if (list != null && !list.isEmpty()) { - int size = list.size(); - if (size % 2 != 0) { - //odd number of elements, not permitted - throw new BadCommandArgumentsException( - ErrorStrings.ERROR_PARSE_FAILURE + description); - } - for (int count = 0; count < size; count += 2) { - String key = list.get(count); - String val = list.get(count + 1); - if (results.get(key) != null) { - throw new BadCommandArgumentsException( - ErrorStrings.ERROR_DUPLICATE_ENTRY + description - + ": " + key); - } - results.put(key, val); - } - } - return results; - } - - /** - * Create a map from a tuple list like - * ['worker','heapsize','5G','master','heapsize','2M'] into a map - * ['worker':'2',"master":'1']; - * Duplicate entries also trigger errors - - * @throws BadCommandArgumentsException odd #of arguments received - */ - public static Map> convertTripleListToMaps(String description, - List list) throws BadCommandArgumentsException { - - Map> results = new HashMap<>(); - if (list != null && !list.isEmpty()) { - int size = list.size(); - if (size % 3 != 0) { - //wrong number of elements, not permitted - throw new BadCommandArgumentsException( - ErrorStrings.ERROR_PARSE_FAILURE + description); - } - for (int count = 0; count < size; count += 3) { - String role = list.get(count); - String key = list.get(count + 1); - String val = list.get(count + 2); - Map roleMap = results.get(role); - if (roleMap == null) { - //demand create new role map - roleMap = new HashMap<>(); - results.put(role, roleMap); - } - if (roleMap.get(key) != null) { - throw new BadCommandArgumentsException( - ErrorStrings.ERROR_DUPLICATE_ENTRY + description - + ": for key " + key + " under " + role); - } - roleMap.put(key, val); - } - } - return results; - } -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/Arguments.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/Arguments.java deleted file mode 100644 index 67571e2b45..0000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/Arguments.java +++ /dev/null @@ -1,103 +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.hadoop.yarn.service.client.params; - -/** - * Here are all the arguments that may be parsed by the client or server - * command lines. - * - * Important: Please keep the main list in alphabetical order - * so it is easier to see what arguments are there - */ -public interface Arguments { - - String ARG_FILE = "--file"; - String ARG_FILE_SHORT = "-f"; - String ARG_BASE_PATH = "--basepath"; - String ARG_COMPONENT = "--component"; - String ARG_COMPONENT_SHORT = "--comp"; - String ARG_COMPONENTS = "--components"; - String ARG_COMP_OPT= "--compopt"; - String ARG_COMP_OPT_SHORT = "--co"; - String ARG_CONFIG = "--config"; - String ARG_CONTAINERS = "--containers"; - String ARG_DEBUG = "--debug"; - String ARG_DEFINE = "-D"; - String ARG_DELETE = "--delete"; - String ARG_DEST = "--dest"; - String ARG_DESTDIR = "--destdir"; - String ARG_EXAMPLE = "--example"; - String ARG_EXAMPLE_SHORT = "-e"; - String ARG_FOLDER = "--folder"; - String ARG_FORCE = "--force"; - String ARG_FORMAT = "--format"; - String ARG_GETCONF = "--getconf"; - String ARG_GETEXP = "--getexp"; - String ARG_GETFILES = "--getfiles"; - String ARG_HELP = "--help"; - String ARG_IMAGE = "--image"; - String ARG_INSTALL = "--install"; - String ARG_INTERNAL = "--internal"; - String ARG_KEYLEN = "--keylen"; - String ARG_KEYTAB = "--keytab"; - String ARG_KEYTABINSTALL = ARG_INSTALL; - String ARG_KEYTABDELETE = ARG_DELETE; - String ARG_KEYTABLIST = "--list"; - String ARG_LIST = "--list"; - String ARG_LISTCONF = "--listconf"; - String ARG_LISTEXP = "--listexp"; - String ARG_LISTFILES = "--listfiles"; - String ARG_LIVE = "--live"; - String ARG_MANAGER = "--manager"; - String ARG_MANAGER_SHORT = "--m"; - String ARG_MESSAGE = "--message"; - String ARG_NAME = "--name"; - String ARG_OPTION = "--option"; - String ARG_OPTION_SHORT = "-O"; - String ARG_OUTPUT = "--out"; - String ARG_OUTPUT_SHORT = "-o"; - String ARG_OVERWRITE = "--overwrite"; - String ARG_PACKAGE = "--package"; - String ARG_PATH = "--path"; - String ARG_PRINCIPAL = "--principal"; - String ARG_QUEUE = "--queue"; - String ARG_SHORT_QUEUE = "-q"; - String ARG_LIFETIME = "--lifetime"; - String ARG_RESOURCE = "--resource"; - String ARG_RESOURCE_MANAGER = "--rm"; - String ARG_SECURE = "--secure"; - String ARG_SERVICETYPE = "--servicetype"; - String ARG_SERVICES = "--services"; - String ARG_SOURCE = "--source"; - String ARG_STATE = "--state"; - String ARG_SYSPROP = "-S"; - String ARG_USER = "--user"; - String ARG_UPLOAD = "--upload"; - String ARG_VERBOSE = "--verbose"; - String ARG_VERSION = "--version"; - String ARG_WAIT = "--wait"; -/* - STOP: DO NOT ADD YOUR ARGUMENTS HERE. GO BACK AND INSERT THEM IN THE - RIGHT PLACE IN THE LIST - */ - - // Tha path in hdfs to be read by Service AM - String ARG_SERVICE_DEF_PATH = "-cluster-uri"; - -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ClientArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ClientArgs.java deleted file mode 100644 index 84d3bbd74c..0000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ClientArgs.java +++ /dev/null @@ -1,193 +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.hadoop.yarn.service.client.params; - -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.yarn.service.utils.SliderUtils; -import org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException; -import org.apache.hadoop.yarn.service.exceptions.ErrorStrings; -import org.apache.hadoop.yarn.service.exceptions.SliderException; - -import java.util.Collection; - -/** - * Client CLI Args - */ - -public class ClientArgs extends CommonArgs { - - // ========================================================= - // Keep all of these in alphabetical order. Thanks. - // ========================================================= - - private final ActionBuildArgs actionBuildArgs = new ActionBuildArgs(); - private final ActionClientArgs actionClientArgs = new ActionClientArgs(); - private final ActionCreateArgs actionCreateArgs = new ActionCreateArgs(); - private final ActionDependencyArgs actionDependencyArgs = new ActionDependencyArgs(); - private final ActionDestroyArgs actionDestroyArgs = new ActionDestroyArgs(); - private final ActionExistsArgs actionExistsArgs = new ActionExistsArgs(); - private final ActionFlexArgs actionFlexArgs = new ActionFlexArgs(); - private final ActionFreezeArgs actionFreezeArgs = new ActionFreezeArgs(); - private final ActionHelpArgs actionHelpArgs = new ActionHelpArgs(); - private final ActionKeytabArgs actionKeytabArgs = new ActionKeytabArgs(); - private final ActionListArgs actionListArgs = new ActionListArgs(); - private final ActionRegistryArgs actionRegistryArgs = new ActionRegistryArgs(); - private final ActionResolveArgs actionResolveArgs = new ActionResolveArgs(); - private final ActionResourceArgs actionResourceArgs = new ActionResourceArgs(); - private final ActionStatusArgs actionStatusArgs = new ActionStatusArgs(); - private final ActionThawArgs actionThawArgs = new ActionThawArgs(); - private final ActionTokensArgs actionTokenArgs = new ActionTokensArgs(); - private final ActionUpdateArgs actionUpdateArgs = new ActionUpdateArgs(); - - public ClientArgs(String[] args) { - super(args); - } - - public ClientArgs(Collection args) { - super(args); - } - - @Override - protected void addActionArguments() { - - addActions( - actionBuildArgs, - actionCreateArgs, - actionDependencyArgs, - actionDestroyArgs, - actionFlexArgs, - actionFreezeArgs, - actionHelpArgs, - actionStatusArgs, - actionThawArgs - ); - } - - @Override - public void applyDefinitions(Configuration conf) throws - BadCommandArgumentsException { - super.applyDefinitions(conf); - } - - - public ActionBuildArgs getActionBuildArgs() { - return actionBuildArgs; - } - - public ActionUpdateArgs getActionUpdateArgs() { - return actionUpdateArgs; - } - - public ActionCreateArgs getActionCreateArgs() { - return actionCreateArgs; - } - - public ActionDependencyArgs getActionDependencyArgs() { - return actionDependencyArgs; - } - - public ActionFlexArgs getActionFlexArgs() { - return actionFlexArgs; - } - - /** - * Look at the chosen action and bind it as the core action for the operation. - * @throws SliderException bad argument or similar - */ - @Override - public void applyAction() throws SliderException { - String action = getAction(); - if (SliderUtils.isUnset(action)) { - action = ACTION_HELP; - } - switch (action) { - case ACTION_BUILD: - bindCoreAction(actionBuildArgs); - break; - - case ACTION_CREATE: - bindCoreAction(actionCreateArgs); - break; - - case ACTION_STOP: - bindCoreAction(actionFreezeArgs); - break; - - case ACTION_START: - bindCoreAction(actionThawArgs); - break; - - case ACTION_DEPENDENCY: - bindCoreAction(actionDependencyArgs); - break; - - case ACTION_DESTROY: - bindCoreAction(actionDestroyArgs); - break; - - case ACTION_EXISTS: - bindCoreAction(actionExistsArgs); - break; - - case ACTION_FLEX: - bindCoreAction(actionFlexArgs); - break; - - case ACTION_HELP: - bindCoreAction(actionHelpArgs); - break; - - case ACTION_KEYTAB: - bindCoreAction(actionKeytabArgs); - break; - - case ACTION_LIST: - bindCoreAction(actionListArgs); - break; - - case ACTION_REGISTRY: - bindCoreAction(actionRegistryArgs); - break; - - case ACTION_RESOLVE: - bindCoreAction(actionResolveArgs); - break; - - case ACTION_RESOURCE: - bindCoreAction(actionResourceArgs); - break; - - case ACTION_STATUS: - bindCoreAction(actionStatusArgs); - break; - - case ACTION_TOKENS: - bindCoreAction(actionTokenArgs); - break; - - case ACTION_UPDATE: - bindCoreAction(actionUpdateArgs); - break; - default: - throw new BadCommandArgumentsException(ErrorStrings.ERROR_UNKNOWN_ACTION - + " " + action); - } - } - -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/CommonArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/CommonArgs.java deleted file mode 100644 index 145b44a8e7..0000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/CommonArgs.java +++ /dev/null @@ -1,245 +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.hadoop.yarn.service.client.params; - -import com.beust.jcommander.JCommander; -import com.beust.jcommander.Parameter; -import com.beust.jcommander.ParameterDescription; -import com.beust.jcommander.ParameterException; - -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.yarn.service.utils.SliderUtils; -import org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException; -import org.apache.hadoop.yarn.service.exceptions.ErrorStrings; -import org.apache.hadoop.yarn.service.exceptions.SliderException; -import org.apache.hadoop.yarn.service.exceptions.UsageException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * This class contains the common argument set for all tne entry points, - * and the core parsing logic to verify that the action is on the list - * of allowed actions -and that the remaining number of arguments is - * in the range allowed - */ - -public abstract class CommonArgs extends ArgOps implements SliderActions, - Arguments { - - protected static final Logger log = LoggerFactory.getLogger(CommonArgs.class); - - - private static final int DIFF_BETWEEN_DESCIPTION_AND_COMMAND_NAME = 30; - - - @Parameter(names = ARG_HELP, help = true) - public boolean help; - - - /** - -D name=value - - Define an HBase 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. - - */ - - public Map definitionMap = new HashMap(); - /** - * System properties - */ - public Map syspropsMap = new HashMap(); - - - /** - * fields - */ - public final JCommander commander; - private final String[] args; - - private AbstractActionArgs coreAction; - - /** - * get the name: relies on arg 1 being the cluster name in all operations - * @return the name argument, null if there is none - */ - public String getClusterName() { - return coreAction.getServiceName(); - } - - protected CommonArgs(String[] args) { - this.args = args; - commander = new JCommander(this); - } - - protected CommonArgs(Collection args) { - List argsAsStrings = SliderUtils.collectionToStringList(args); - this.args = argsAsStrings.toArray(new String[argsAsStrings.size()]); - commander = new JCommander(this); - } - - public String usage() { - return usage(this, null); - } - - public static String usage(CommonArgs serviceArgs, String commandOfInterest) { - String result = null; - StringBuilder helperMessage = new StringBuilder(); - if (commandOfInterest == null) { - // JCommander.usage is too verbose for a command with many options like - // slider no short version of that is found Instead, we compose our msg by - helperMessage.append("\nUsage: service COMMAND [options]\n"); - helperMessage.append("where COMMAND is one of\n"); - for (String jcommand : serviceArgs.commander.getCommands().keySet()) { - helperMessage.append(String.format("\t%-" - + DIFF_BETWEEN_DESCIPTION_AND_COMMAND_NAME + "s%s", jcommand, - serviceArgs.commander.getCommandDescription(jcommand) + "\n")); - } - helperMessage - .append("Most commands print help when invoked without parameters or with --help"); - result = helperMessage.toString(); - } else { - helperMessage.append("\nUsage: service ").append(commandOfInterest); - helperMessage.append(serviceArgs.coreAction.getMinParams() > 0 ? " " : ""); - helperMessage.append("\n"); - for (ParameterDescription paramDesc : serviceArgs.commander.getCommands() - .get(commandOfInterest).getParameters()) { - String optional = paramDesc.getParameter().required() ? " (required)" - : " (optional)"; - String paramName = paramDesc.getParameterized().getType() == Boolean.TYPE ? paramDesc - .getLongestName() : paramDesc.getLongestName() + " <" - + paramDesc.getParameterized().getName() + ">"; - helperMessage.append(String.format("\t%-" - + DIFF_BETWEEN_DESCIPTION_AND_COMMAND_NAME + "s%s", paramName, - paramDesc.getDescription() + optional + "\n")); - result = helperMessage.toString(); - } - } - return result; - } - - /** - * Parse routine -includes registering the action-specific argument classes - * and postprocess it - * @throws SliderException on any problem - */ - public void parse() throws SliderException { - addActionArguments(); - try { - commander.parse(args); - } catch (ParameterException e) { - commander.usage(args[0]); - throw e; - } - //now copy back to this class some of the attributes that are common to all - //actions - postProcess(); - } - - - protected void addActions(Object... actions) { - for (Object action : actions) { - commander.addCommand(action); - } - } - - /** - * Override point to add a set of actions - */ - protected void addActionArguments() { - - } - - /** - * validate args via {@link #validate()} - * then postprocess the arguments - */ - public void postProcess() throws SliderException { - applyAction(); - validate(); - - //apply entry set - for (Map.Entry entry : syspropsMap.entrySet()) { - System.setProperty(entry.getKey(), entry.getValue()); - } - } - - - /** - * Implementors must implement their action apply routine here - */ - public abstract void applyAction() throws SliderException; - - - /** - * Bind the core action; this extracts any attributes that are used - * across routines - * @param action action to bind - */ - protected void bindCoreAction(AbstractActionArgs action) { - coreAction = action; - - splitPairs(coreAction.definitions, definitionMap); - splitPairs(coreAction.sysprops, syspropsMap); - } - - /** - * Validate the arguments against the action requested - */ - public void validate() throws BadCommandArgumentsException, UsageException { - if (coreAction == null) { - throw new UsageException(ErrorStrings.ERROR_NO_ACTION + usage()); - } - log.debug("action={}", getAction()); - // let the action validate itself - try { - coreAction.validate(); - } catch (BadCommandArgumentsException e) { - String badArgMsgBuilder = - e.getMessage() + System.lineSeparator() + usage(this, - coreAction.getActionName()); - throw new BadCommandArgumentsException(badArgMsgBuilder); - } - } - - /** - * Apply all the definitions on the command line to the configuration - * @param conf config - */ - public void applyDefinitions(Configuration conf) throws - BadCommandArgumentsException { - applyDefinitions(definitionMap, conf); - } - - public boolean isDebug() { - return coreAction.debug; - } - - - public String getAction() { - return commander.getParsedCommand(); - } -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ComponentArgsDelegate.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ComponentArgsDelegate.java deleted file mode 100644 index b6cd0a132c..0000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ComponentArgsDelegate.java +++ /dev/null @@ -1,52 +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.hadoop.yarn.service.client.params; - -import com.beust.jcommander.Parameter; -import org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -public class ComponentArgsDelegate extends AbstractArgsDelegate { - - /** - * This is a listing of the roles to create - */ - @Parameter(names = {ARG_COMPONENT, ARG_COMPONENT_SHORT}, - arity = 2, - description = "--component e.g. +1 incr by 1, -2 decr by 2, and 3 makes final count 3", - splitter = DontSplitArguments.class) - public List componentTuples = new ArrayList<>(0); - - - /** - * Get the role mapping (may be empty, but never null) - * @return role mapping - * @throws BadCommandArgumentsException parse problem - */ - public Map getComponentMap() throws BadCommandArgumentsException { - return convertTupleListToMap("component", componentTuples); - } - - public List getComponentTuples() { - return componentTuples; - } -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/DontSplitArguments.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/DontSplitArguments.java deleted file mode 100644 index 85de615e58..0000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/DontSplitArguments.java +++ /dev/null @@ -1,34 +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.hadoop.yarn.service.client.params; - -import com.beust.jcommander.converters.IParameterSplitter; - -import java.util.ArrayList; -import java.util.List; - -public class DontSplitArguments implements IParameterSplitter { - - @Override - public List split(String value) { - List list = new ArrayList<>(1); - list.add(value); - return list; - } -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/LaunchArgsAccessor.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/LaunchArgsAccessor.java deleted file mode 100644 index bf194b6fbb..0000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/LaunchArgsAccessor.java +++ /dev/null @@ -1,30 +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.hadoop.yarn.service.client.params; - -import java.io.File; - -/** - * Launch args for create and start and anything else that can start something - */ -public interface LaunchArgsAccessor extends WaitTimeAccessor { - String getRmAddress(); - - File getOutputFile(); -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/LaunchArgsDelegate.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/LaunchArgsDelegate.java deleted file mode 100644 index d42510caee..0000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/LaunchArgsDelegate.java +++ /dev/null @@ -1,51 +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.hadoop.yarn.service.client.params; - -import com.beust.jcommander.Parameter; - -import java.io.File; - -/** - * Any launch-time args - */ -public class LaunchArgsDelegate extends WaitArgsDelegate implements - LaunchArgsAccessor { - - - //TODO: do we need this? - @Parameter(names = ARG_RESOURCE_MANAGER, - description = "Resource manager hostname:port ", - required = false) - private String rmAddress; - - @Override - public String getRmAddress() { - return rmAddress; - } - - @Parameter(names = {ARG_OUTPUT, ARG_OUTPUT_SHORT}, - description = "output file for any service report") - public File outputFile; - - @Override - public File getOutputFile() { - return outputFile; - } -} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/OptionArgsDelegate.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/OptionArgsDelegate.java deleted file mode 100644 index 797271617d..0000000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/params/OptionArgsDelegate.java +++ /dev/null @@ -1,66 +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.hadoop.yarn.service.client.params; - -import com.beust.jcommander.Parameter; -import org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -/** - * Delegate for application and resource options. - */ -public class OptionArgsDelegate extends AbstractArgsDelegate { - - /** - * Options key value. - */ - @Parameter(names = {ARG_OPTION, ARG_OPTION_SHORT}, arity = 2, - description = ARG_OPTION + " ", - splitter = DontSplitArguments.class) - public List optionTuples = new ArrayList<>(0); - - - /** - * All the app component option triples. - */ - @Parameter(names = {ARG_COMP_OPT, ARG_COMP_OPT_SHORT}, arity = 3, - description = "Component option " + ARG_COMP_OPT + - "