Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 2865F200BDA for ; Tue, 13 Dec 2016 23:53:15 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 26FA9160B35; Tue, 13 Dec 2016 22:53:15 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id AA13F160B07 for ; Tue, 13 Dec 2016 23:53:12 +0100 (CET) Received: (qmail 87210 invoked by uid 500); 13 Dec 2016 22:52:55 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 84594 invoked by uid 99); 13 Dec 2016 22:52:54 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Dec 2016 22:52:54 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id DC625F2DD2; Tue, 13 Dec 2016 22:52:53 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: jianhe@apache.org To: common-commits@hadoop.apache.org Date: Tue, 13 Dec 2016 22:53:22 -0000 Message-Id: <1d6421a95828428faecd5ab243cb6452@git.apache.org> In-Reply-To: <71077c7e0e0c4f0fbe045a40e7cb538b@git.apache.org> References: <71077c7e0e0c4f0fbe045a40e7cb538b@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [30/74] [abbrv] hadoop git commit: YARN-5461. Initial code ported from slider-core module. (jianhe) archived-at: Tue, 13 Dec 2016 22:53:15 -0000 http://git-wip-us.apache.org/repos/asf/hadoop/blob/31c4a419/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/SliderExitCodes.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/SliderExitCodes.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/SliderExitCodes.java new file mode 100644 index 0000000..5758f79 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/SliderExitCodes.java @@ -0,0 +1,88 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.slider.common; + +import org.apache.slider.core.main.LauncherExitCodes; + +public interface SliderExitCodes extends LauncherExitCodes { + + /** + * starting point for exit codes; not an exception itself + */ + int _EXIT_CODE_BASE = 64; + + /** + * service entered the failed state: {@value} + */ + int EXIT_YARN_SERVICE_FAILED = 65; + + /** + * service was killed: {@value} + */ + int EXIT_YARN_SERVICE_KILLED = 66; + + /** + * timeout on monitoring client: {@value} + */ + int EXIT_TIMED_OUT = 67; + + /** + * service finished with an error: {@value} + */ + int EXIT_YARN_SERVICE_FINISHED_WITH_ERROR = 68; + + /** + * the application instance is unknown: {@value} + */ + int EXIT_UNKNOWN_INSTANCE = 69; + + /** + * the application instance is in the wrong state for that operation: {@value} + */ + int EXIT_BAD_STATE = 70; + + /** + * A spawned master process failed + */ + int EXIT_PROCESS_FAILED = 71; + + /** + * The instance failed -too many containers were + * failing or some other threshold was reached + */ + int EXIT_DEPLOYMENT_FAILED = 72; + + /** + * The application is live -and the requested operation + * does not work if the cluster is running + */ + int EXIT_APPLICATION_IN_USE = 73; + + /** + * There already is an application instance of that name + * when an attempt is made to create a new instance + */ + int EXIT_INSTANCE_EXISTS = 75; + + /** + * Exit code when the configurations in valid/incomplete: {@value} + */ + int EXIT_BAD_CONFIGURATION = 77; + +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/31c4a419/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/SliderKeys.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/SliderKeys.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/SliderKeys.java new file mode 100644 index 0000000..ba3effc --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/SliderKeys.java @@ -0,0 +1,278 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.slider.common; + + +/** + * Keys and various constants for Slider + */ +public interface SliderKeys extends SliderXmlConfKeys { + + /** + * This is the name of the slider appmaster in configurations :{@value} + */ + String COMPONENT_AM = "slider-appmaster"; + + /** + * Slider role is "special":{@value} + */ + int ROLE_AM_PRIORITY_INDEX = 0; + + + /** + * The path under which cluster and temp data are stored + * {@value} + */ + String SLIDER_BASE_DIRECTORY = ".slider"; + + /** + * The paths under which Slider AM dependency libraries are stored + */ + String SLIDER_DEPENDENCY_LOCALIZED_DIR_LINK = "slider_dep"; + String SLIDER_DEPENDENCY_HDP_PARENT_DIR = "/hdp"; + String SLIDER_DEPENDENCY_DIR = "/apps/%s/slider"; + String SLIDER_DEPENDENCY_TAR_GZ_FILE_NAME = "slider"; + String SLIDER_DEPENDENCY_TAR_GZ_FILE_EXT = ".tar.gz"; + String SLIDER_DEPENDENCY_DIR_PERMISSIONS = "755"; + + /** + * + */ + String HDP_VERSION_PROP_NAME = "HDP_VERSION"; + + /** + * name of the relative path to expaned an image into: {@value}. + * The title of this path is to help people understand it when + * they see it in their error messages + */ + String LOCAL_TARBALL_INSTALL_SUBDIR = "expandedarchive"; + + + /** + * Application type for YARN {@value} + */ + String APP_TYPE = "org-apache-slider"; + + /** + * Key for application version. This must be set in app_config/global {@value} + */ + String APP_VERSION = "site.global.app_version"; + String APP_VERSION_UNKNOWN = "awaiting heartbeat..."; + + /** + * Keys for application container specific properties, like release timeout + */ + String APP_CONTAINER_RELEASE_TIMEOUT = "site.global.app_container.release_timeout_secs"; + int APP_CONTAINER_HEARTBEAT_INTERVAL_SEC = 10; // look for HEARTBEAT_IDDLE_INTERVAL_SEC + + /** + * JVM arg to force IPv4 {@value} + */ + String JVM_ENABLE_ASSERTIONS = "-ea"; + + /** + * JVM arg enable JVM system/runtime {@value} + */ + String JVM_ENABLE_SYSTEM_ASSERTIONS = "-esa"; + + /** + * JVM arg to force IPv4 {@value} + */ + String JVM_FORCE_IPV4 = "-Djava.net.preferIPv4Stack=true"; + + /** + * JVM arg to go headless {@value} + */ + + String JVM_JAVA_HEADLESS = "-Djava.awt.headless=true"; + + /** + * This is the name of the dir/subdir containing + * the hbase conf that is propagated via YARN + * {@value} + */ + String PROPAGATED_CONF_DIR_NAME = "propagatedconf"; + String INFRA_DIR_NAME = "infra"; + String GENERATED_CONF_DIR_NAME = "generated"; + String SNAPSHOT_CONF_DIR_NAME = "snapshot"; + String DATA_DIR_NAME = "database"; + String HISTORY_DIR_NAME = "history"; + String HISTORY_FILENAME_SUFFIX = "json"; + String HISTORY_FILENAME_PREFIX = "rolehistory-"; + String KEYTAB_DIR = "keytabs"; + String RESOURCE_DIR = "resources"; + + /** + * Filename pattern is required to save in strict temporal order. + * Important: older files must sort less-than newer files when using + * case-sensitive name sort. + */ + String HISTORY_FILENAME_CREATION_PATTERN = HISTORY_FILENAME_PREFIX +"%016x."+ + HISTORY_FILENAME_SUFFIX; + /** + * The posix regexp used to locate this + */ + String HISTORY_FILENAME_MATCH_PATTERN = HISTORY_FILENAME_PREFIX +"[0-9a-f]+\\."+ + HISTORY_FILENAME_SUFFIX; + /** + * The posix regexp used to locate this + */ + String HISTORY_FILENAME_GLOB_PATTERN = HISTORY_FILENAME_PREFIX +"*."+ + HISTORY_FILENAME_SUFFIX; + /** + * XML resource listing the standard Slider providers + * {@value} + */ + String SLIDER_XML = "org/apache/slider/slider.xml"; + + String CLUSTER_DIRECTORY = "cluster"; + + String PACKAGE_DIRECTORY = "package"; + + /** + * JVM property to define the slider configuration directory; + * this is set by the slider script: {@value} + */ + String PROPERTY_CONF_DIR = "slider.confdir"; + + /** + * JVM property to define the slider lib directory; + * this is set by the slider script: {@value} + */ + String PROPERTY_LIB_DIR = "slider.libdir"; + + /** + * name of generated dir for this conf: {@value} + */ + String SUBMITTED_CONF_DIR = "confdir"; + + /** + * Slider AM log4j file name : {@value} + */ + String LOG4J_SERVER_PROP_FILENAME = "log4j-server.properties"; + + /** + * Standard log4j file name : {@value} + */ + String LOG4J_PROP_FILENAME = "log4j.properties"; + + /** + * Log4j sysprop to name the resource :{@value} + */ + String SYSPROP_LOG4J_CONFIGURATION = "log4j.configuration"; + + /** + * sysprop for Slider AM log4j directory :{@value} + */ + String SYSPROP_LOG_DIR = "LOG_DIR"; + + /** + * name of the Slider client resource + * loaded when the service is loaded. + */ + String SLIDER_CLIENT_XML = "slider-client.xml"; + + /** + * The name of the resource to put on the classpath + */ + String SLIDER_SERVER_XML = "slider-server.xml"; + + String TMP_LOGDIR_PREFIX = "/tmp/slider-"; + String TMP_DIR_PREFIX = "tmp"; + String AM_DIR_PREFIX = "appmaster"; + + /** + * Store the default app definition, e.g. metainfo file or content of a folder + */ + String APP_DEF_DIR = "appdef"; + /** + * Store additional app defs - co-processors + */ + String ADDONS_DIR = "addons"; + + String SLIDER_JAR = "slider.jar"; + String JCOMMANDER_JAR = "jcommander.jar"; + String GSON_JAR = "gson.jar"; + String AGENT_TAR = "slider-agent.tar.gz"; + String DEFAULT_APP_PKG = "appPkg.zip"; + + String DEFAULT_JVM_HEAP = "256M"; + int DEFAULT_YARN_MEMORY = 256; + String STDOUT_AM = "slider-out.txt"; + String STDERR_AM = "slider-err.txt"; + String DEFAULT_GC_OPTS = ""; + + String HADOOP_USER_NAME = "HADOOP_USER_NAME"; + String HADOOP_PROXY_USER = "HADOOP_PROXY_USER"; + String SLIDER_PASSPHRASE = "SLIDER_PASSPHRASE"; + + boolean PROPAGATE_RESOURCE_OPTION = true; + + /** + * Security associated keys. + */ + String SECURITY_DIR = "security"; + String CRT_FILE_NAME = "ca.crt"; + String CSR_FILE_NAME = "ca.csr"; + String KEY_FILE_NAME = "ca.key"; + String KEYSTORE_FILE_NAME = "keystore.p12"; + String CRT_PASS_FILE_NAME = "pass.txt"; + String PASS_LEN = "50"; + + String COMP_STORES_REQUIRED_KEY = + "slider.component.security.stores.required"; + String COMP_KEYSTORE_PASSWORD_PROPERTY_KEY = + "slider.component.keystore.password.property"; + String COMP_KEYSTORE_PASSWORD_ALIAS_KEY = + "slider.component.keystore.credential.alias.property"; + String COMP_KEYSTORE_PASSWORD_ALIAS_DEFAULT = + "component.keystore.credential.alias"; + String COMP_TRUSTSTORE_PASSWORD_PROPERTY_KEY = + "slider.component.truststore.password.property"; + String COMP_TRUSTSTORE_PASSWORD_ALIAS_KEY = + "slider.component.truststore.credential.alias.property"; + String COMP_TRUSTSTORE_PASSWORD_ALIAS_DEFAULT = + "component.truststore.credential.alias"; + + /** + * Python specific + */ + String PYTHONPATH = "PYTHONPATH"; + + + /** + * Name of the AM filter to use: {@value} + */ + String AM_FILTER_NAME = + "org.apache.hadoop.yarn.server.webproxy.amfilter.AmFilterInitializer"; + + /** + * Allowed port range. This MUST be set in app_conf/global. + * {@value} + */ + String KEY_ALLOWED_PORT_RANGE = "site.global.slider.allowed.ports"; + + /** + * env var for custom JVM options. + */ + String SLIDER_JVM_OPTS = "SLIDER_JVM_OPTS"; + + String SLIDER_CLASSPATH_EXTRA = "SLIDER_CLASSPATH_EXTRA"; + String YARN_CONTAINER_PATH = "/node/container/"; +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/31c4a419/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/SliderXMLConfKeysForTesting.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/SliderXMLConfKeysForTesting.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/SliderXMLConfKeysForTesting.java new file mode 100644 index 0000000..61c828e --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/SliderXMLConfKeysForTesting.java @@ -0,0 +1,83 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.slider.common; + +/** + * Keys shared across tests + */ +public interface SliderXMLConfKeysForTesting { + + String KEY_TEST_THAW_WAIT_TIME = "slider.test.thaw.wait.seconds"; + + int DEFAULT_THAW_WAIT_TIME_SECONDS = 60; + + + String KEY_TEST_FREEZE_WAIT_TIME = "slider.test.freeze.wait.seconds"; + + int DEFAULT_TEST_FREEZE_WAIT_TIME_SECONDS = 60; + + String KEY_TEST_TIMEOUT = "slider.test.timeout.seconds"; + + int DEFAULT_TEST_TIMEOUT_SECONDS = 30 * 60; + + String KEY_ACCUMULO_LAUNCH_TIME = + "slider.test.accumulo.launch.wait.seconds"; + int DEFAULT_ACCUMULO_LAUNCH_TIME_SECONDS = 60 * 3; + + String KEY_ACCUMULO_GO_LIVE_TIME = + "slider.test.accumulo.live.wait.seconds"; + int DEFAULT_ACCUMULO_LIVE_TIME_SECONDS = 90; + + String KEY_TEST_AGENT_ENABLED = "slider.test.agent.enabled"; + String KEY_AGENTTESTS_QUEUE_LABELED_DEFINED = "slider.test.agent.labeled.queue.enabled"; + String KEY_AGENTTESTS_LABELS_RED_BLUE_DEFINED = "slider.test.agent.labels.defined"; + String KEY_AGENTTESTS_AM_FAILURES_ENABLED = "slider.test.agent.am.failures.enabled"; + + int DEFAULT_AGENT_LAUNCH_TIME_SECONDS = 60 * 3; + + String KEY_TEST_AGENT_HOME = "slider.test.agent.home"; + String KEY_TEST_AGENT_TAR = "slider.test.agent.tar"; + + String KEY_TEST_TEARDOWN_KILLALL = "slider.test.teardown.killall"; + boolean DEFAULT_TEARDOWN_KILLALL = true; + + + /** + * Key for amount of RAM to request + */ + String KEY_TEST_YARN_RAM_REQUEST = "slider.test.yarn.ram"; + String DEFAULT_YARN_RAM_REQUEST = "192"; + + /** + * security related keys + */ + String TEST_SECURITY_DIR = "/tmp/work/security"; + + /** + * Local path to AM keytab: {@value} + */ + String KEY_TEST_AM_KEYTAB = "slider.test.am.keytab.local"; + + /** + * Is the test cluster windows? Default is: same as the local system. + * {@value} + */ + String KEY_TEST_WINDOWS_CLUSTER = "slider.test.windows.cluster"; + +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/31c4a419/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/SliderXmlConfKeys.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/SliderXmlConfKeys.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/SliderXmlConfKeys.java new file mode 100644 index 0000000..72dd44f --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/SliderXmlConfKeys.java @@ -0,0 +1,206 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.slider.common; + +import org.apache.hadoop.registry.client.api.RegistryConstants; + +/** + * These are the keys that can be added to conf/slider-client.xml. + */ +public interface SliderXmlConfKeys { + String PREFIX_PROVIDER = "slider.provider"; + /** + * pattern to identify a provider + * {@value} + */ + String KEY_PROVIDER = PREFIX_PROVIDER + ".%s"; + + /** + * conf option set to point to where the config came from + * {@value} + */ + String KEY_TEMPLATE_ORIGIN = "slider.template.origin"; + + /** + * Original name for the default FS. This is still + * expected by applications deployed + */ + String FS_DEFAULT_NAME_CLASSIC = "fs.default.name"; + + /** + * Slider principal + */ + String KEY_KERBEROS_PRINCIPAL = "slider.kerberos.principal"; + + /** + * Name of the property for ACLs for Slider AM. + * {@value} + */ + String KEY_PROTOCOL_ACL = "slider.security.protocol.acl"; + + /** + * Limit on restarts for the AM + * {@value} + */ + String KEY_AM_RESTART_LIMIT = "slider.yarn.restart.limit"; + + /** + * queue name, by default let YARN pick the queue + */ + String KEY_YARN_QUEUE = "slider.yarn.queue"; + String DEFAULT_YARN_QUEUE = null; + + /** + * default priority + */ + String KEY_YARN_QUEUE_PRIORITY = "slider.yarn.queue.priority"; + int DEFAULT_YARN_QUEUE_PRIORITY = 1; + + + /** + * The slider base path: {@value} + * Defaults to HomeDir/.slider + */ + String KEY_SLIDER_BASE_PATH = "slider.base.path"; + + + /** + * Option for the permissions for the cluster directory itself: {@value} + */ + String CLUSTER_DIRECTORY_PERMISSIONS = + "slider.cluster.directory.permissions"; + + /** + * Default value for the permissions :{@value} + */ + String DEFAULT_CLUSTER_DIRECTORY_PERMISSIONS = "750"; + + /** + * + * Option for the permissions for the data directory itself: {@value} + */ + String DATA_DIRECTORY_PERMISSIONS = "slider.data.directory.permissions"; + + /** + * Default value for the data directory permissions: {@value} + */ + String DEFAULT_DATA_DIRECTORY_PERMISSIONS = "750"; + + /** + * + * Use {@link RegistryConstants#KEY_REGISTRY_ZK_ROOT} + * + */ + @Deprecated + String REGISTRY_PATH = "slider.registry.path"; + + /** + * + * @Deprecated use {@link RegistryConstants#KEY_REGISTRY_ZK_QUORUM} + * + */ + @Deprecated + String REGISTRY_ZK_QUORUM = "slider.zookeeper.quorum"; + + + String IPC_CLIENT_FALLBACK_TO_SIMPLE_AUTH = + "ipc.client.fallback-to-simple-auth-allowed"; + String HADOOP_HTTP_FILTER_INITIALIZERS = + "hadoop.http.filter.initializers"; + String KEY_KEYSTORE_LOCATION = "ssl.server.keystore.location"; + String KEY_AM_LOGIN_KEYTAB_NAME = "slider.am.login.keytab.name"; + /** Declare that a keytab must be provided */ + String KEY_AM_LOGIN_KEYTAB_REQUIRED = "slider.am.login.keytab.required"; + String KEY_HDFS_KEYTAB_DIR = "slider.hdfs.keytab.dir"; + String KEY_AM_KEYTAB_LOCAL_PATH = "slider.am.keytab.local.path"; + String KEY_KEYTAB_PRINCIPAL = "slider.keytab.principal.name"; + String KEY_SECURITY_ENABLED = "site.global.security_enabled"; + + /** + * Set to disable server-side checks for python, openssl &c. + * This should only be set for testing + */ + String KEY_SLIDER_AM_DEPENDENCY_CHECKS_DISABLED = + "slider.am.dependency.checks.disabled"; + + /** + * The path to the python executable utilized to launch the agent. + */ + String PYTHON_EXECUTABLE_PATH = "agent.python.exec.path"; + + /** + * Flag to enable the insecure AM filter: {@value} + */ + String X_DEV_INSECURE_WS = "slider.feature.ws.insecure"; + + /** + * Flag to indicate the insecure AM filter is enabled by default: {@value}. + */ + boolean X_DEV_INSECURE_DEFAULT = false; + + + /** + * Flag to indicate the insecure AM filter is required for + * complex REST Verbs: {@value}. + * When Slider switches to being Hadoop 2.7+ only, this flag + * can be set to false + */ + boolean X_DEV_INSECURE_REQUIRED = true; + + /** + * + */ + String KEY_IPC_CLIENT_RETRY_POLICY_ENABLED = + "slider.ipc.client.retry.enabled"; + boolean IPC_CLIENT_RETRY_POLICY_ENABLED_DEFAULT = true; + String KEY_IPC_CLIENT_RETRY_POLICY_SPEC = + "slider.ipc.client.retry.policy.spec"; + String IPC_CLIENT_RETRY_POLICY_SPEC_DEFAULT = + "10000,6,60000,10"; //t1,n1,t2,n2,... + + String KEY_AM_LAUNCH_ENV = "slider.am.launch.env"; + + /** + * From {@code DFSConfigKeys.DFS_NAMENODE_KERBEROS_PRINCIPAL_KEY} + */ + String DFS_NAMENODE_KERBEROS_PRINCIPAL_KEY = "dfs.namenode.kerberos.principal"; + + String DFS_DATANODE_KERBEROS_PRINCIPAL_KEY = "dfs.datanode.kerberos.principal"; + + //Delegation token related keys + String DFS_NAMENODE_DELEGATION_KEY_UPDATE_INTERVAL_KEY + = "dfs.namenode.delegation.key.update-interval"; + long DFS_NAMENODE_DELEGATION_KEY_UPDATE_INTERVAL_DEFAULT = 24 * 60 * 60 * + 1000; // 1 day + String DFS_NAMENODE_DELEGATION_TOKEN_RENEW_INTERVAL_KEY + = "dfs.namenode.delegation.token.renew-interval"; + long DFS_NAMENODE_DELEGATION_TOKEN_RENEW_INTERVAL_DEFAULT = 24 * 60 * 60 * + 1000; // 1 day + String DFS_NAMENODE_DELEGATION_TOKEN_MAX_LIFETIME_KEY + = "dfs.namenode.delegation.token.max-lifetime"; + long DFS_NAMENODE_DELEGATION_TOKEN_MAX_LIFETIME_DEFAULT = 7 * 24 * 60 * 60 * + 1000; // 7 days + String DFS_NAMENODE_DELEGATION_TOKEN_ALWAYS_USE_KEY + = "dfs.namenode.delegation.token.always-use"; // for tests + boolean DFS_NAMENODE_DELEGATION_TOKEN_ALWAYS_USE_DEFAULT = false; + String DFS_NAMENODE_KEYTAB_FILE_KEY = "dfs.namenode.keytab.file"; + String DFS_NAMENODE_DU_RESERVED_KEY = "dfs.namenode.resource.du.reserved"; + + String MAPREDUCE_JOB_CREDENTIALS_BINARY = "mapreduce.job.credentials.binary"; +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/31c4a419/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/AbstractActionArgs.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/AbstractActionArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/AbstractActionArgs.java new file mode 100644 index 0000000..e3cb288 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/AbstractActionArgs.java @@ -0,0 +1,178 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.slider.common.params; + +import com.beust.jcommander.Parameter; +import org.apache.hadoop.fs.Path; +import org.apache.slider.core.exceptions.BadCommandArgumentsException; +import org.apache.slider.core.exceptions.ErrorStrings; +import org.apache.slider.core.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() { + } + + /** + * URI/binding to the filesystem + */ + @Parameter(names = {ARG_FILESYSTEM, ARG_FILESYSTEM_LONG}, + description = "Filesystem Binding") + public String filesystemBinding; + + @Parameter(names = {ARG_BASE_PATH}, + description = "Slider base path on the filesystem", + converter = PathArgumentConverter.class) + public Path basePath; + + /** + * This is the default parameter + */ + @Parameter + public final 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 getClusterName() { + return (parameters.isEmpty()) ? null : parameters.get(0); + } + + /** + -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. + + */ + + @Parameter(names = ARG_DEFINE, arity = 1, description = "Definitions") + public final 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.") + public final List sysprops = new ArrayList<>(0); + + + @Parameter(names = {ARG_MANAGER_SHORT, ARG_MANAGER}, + description = "Binding (usually hostname:port) of the YARN resource manager") + public String manager; + + + @Parameter(names = ARG_DEBUG, description = "Debug mode") + public boolean debug = false; + + @Parameter(names = {ARG_HELP}, description = "Help", help = true) + public boolean help = 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; + for (String actionArg : parameters) { + log.error("[{}] \"{}\"", index++, actionArg); + message += " \"" + actionArg + "\" "; + } + throw new BadCommandArgumentsException(message); + } + } + + @Override + public String toString() { + return super.toString() + ": " + getActionName(); + } + + /** + * Override point: + * Flag to indicate that core hadoop API services are needed (HDFS, YARN, etc) + * —and that validation of the client state should take place. + * + * @return a flag to indicate that the core hadoop services will be needed. + */ + public boolean getHadoopServicesRequired() { + return true; + } + + /** + * Flag to disable secure login. + * This MUST only be set if the action is bypassing security or setting + * it itself + * @return true if login at slider client init time is to be skipped + */ + public boolean disableSecureLogin() { + return false; + } +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/31c4a419/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/AbstractArgsDelegate.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/AbstractArgsDelegate.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/AbstractArgsDelegate.java new file mode 100644 index 0000000..23ba414 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/AbstractArgsDelegate.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.slider.common.params; + + +/** + * Base class for all the delegates + */ +public class AbstractArgsDelegate extends ArgOps implements Arguments { +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/31c4a419/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/AbstractClusterBuildingActionArgs.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/AbstractClusterBuildingActionArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/AbstractClusterBuildingActionArgs.java new file mode 100644 index 0000000..2a5eedc --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/AbstractClusterBuildingActionArgs.java @@ -0,0 +1,217 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.slider.common.params; + +import com.beust.jcommander.Parameter; +import com.beust.jcommander.ParametersDelegate; +import com.google.common.annotations.VisibleForTesting; +import org.apache.hadoop.fs.Path; +import org.apache.slider.core.conf.ConfTree; +import org.apache.slider.core.conf.ConfTreeOperations; +import org.apache.slider.core.exceptions.BadCommandArgumentsException; +import org.apache.slider.providers.SliderProviderFactory; + +import java.io.File; +import java.util.List; +import java.util.Map; + +/** + * Abstract Action to build things; shares args across build and + * list + */ +public abstract class AbstractClusterBuildingActionArgs extends + AbstractActionArgs { + + /** + * Declare the image configuration directory to use when creating or + * reconfiguring a slider cluster. The path must be on a filesystem visible + * to all nodes in the YARN cluster. Only one configuration directory can + * be specified. + */ + @Parameter(names = ARG_CONFDIR, + description = "Path to cluster configuration directory in HDFS", + converter = PathArgumentConverter.class) + public Path confdir; + + @Parameter(names = ARG_ZKPATH, + description = "Zookeeper path for the application") + public String appZKPath; + + @Parameter(names = ARG_ZKHOSTS, + description = "comma separated list of the Zookeeper hosts") + public String zkhosts; + + /** + * --image path + * the full path to a .tar or .tar.gz path containing an HBase image. + */ + @Parameter(names = ARG_IMAGE, + description = "The full path to a .tar or .tar.gz path containing the application", + converter = PathArgumentConverter.class) + public Path image; + + @Parameter(names = ARG_APP_HOME, + description = "Home directory of a pre-installed application") + public String appHomeDir; + + @Parameter(names = ARG_PROVIDER, + description = "Provider of the specific cluster application") + public String provider = SliderProviderFactory.DEFAULT_CLUSTER_TYPE; + + @Parameter(names = {ARG_PACKAGE}, + description = "URI to a slider package") + public String packageURI; + + @Parameter(names = {ARG_RESOURCES}, + description = "File defining the resources of this instance") + public File resources; + + @Parameter(names = {ARG_TEMPLATE}, + description = "Template application configuration") + public File template; + + @Parameter(names = {ARG_METAINFO}, + description = "Application meta info file") + public File appMetaInfo; + + @Parameter(names = {ARG_METAINFO_JSON}, + description = "Application meta info JSON blob") + public String appMetaInfoJson; + + @Parameter(names = {ARG_APPDEF}, + description = "Application def (folder or a zip package)") + public File appDef; + + @Parameter(names = {ARG_QUEUE}, + description = "Queue to submit the application") + public String queue; + + @ParametersDelegate + public ComponentArgsDelegate componentDelegate = new ComponentArgsDelegate(); + + @ParametersDelegate + public AddonArgsDelegate addonDelegate = new AddonArgsDelegate(); + + + @ParametersDelegate + public AppAndResouceOptionArgsDelegate optionsDelegate = + new AppAndResouceOptionArgsDelegate(); + + + public Map getOptionsMap() throws + BadCommandArgumentsException { + return optionsDelegate.getOptionsMap(); + } + + /** + * Get the role heap mapping (may be empty, but never null) + * @return role heap mapping + * @throws BadCommandArgumentsException parse problem + */ + public Map> getCompOptionMap() throws + BadCommandArgumentsException { + return optionsDelegate.getCompOptionMap(); + } + + + public Map getResourceOptionsMap() throws + BadCommandArgumentsException { + return optionsDelegate.getResourceOptionsMap(); + } + + /** + * Get the role heap mapping (may be empty, but never null) + * @return role heap mapping + * @throws BadCommandArgumentsException parse problem + */ + public Map> getResourceCompOptionMap() throws + BadCommandArgumentsException { + return optionsDelegate.getResourceCompOptionMap(); + } + + @VisibleForTesting + public List getComponentTuples() { + return componentDelegate.getComponentTuples(); + } + + /** + * Get the role mapping (may be empty, but never null) + * @return role mapping + * @throws BadCommandArgumentsException parse problem + */ + public Map getComponentMap() throws + BadCommandArgumentsException { + return componentDelegate.getComponentMap(); + } + + @VisibleForTesting + public List getAddonTuples() { + return addonDelegate.getAddonTuples(); + } + + /** + * Get the list of addons (may be empty, but never null) + */ + public Map getAddonMap() throws + BadCommandArgumentsException { + return addonDelegate.getAddonMap(); + } + + public Path getConfdir() { + return confdir; + } + + public String getAppZKPath() { + return appZKPath; + } + + public String getZKhosts() { + return zkhosts; + } + + public Path getImage() { + return image; + } + + public String getAppHomeDir() { + return appHomeDir; + } + + public String getProvider() { + return provider; + } + + public ConfTree buildAppOptionsConfTree() throws + BadCommandArgumentsException { + return buildConfTree(getOptionsMap()); + } + + public ConfTree buildResourceOptionsConfTree() throws + BadCommandArgumentsException { + return buildConfTree(getResourceOptionsMap()); + } + + protected ConfTree buildConfTree(Map optionsMap) throws + BadCommandArgumentsException { + ConfTree confTree = new ConfTree(); + ConfTreeOperations ops = new ConfTreeOperations(confTree); + confTree.global.putAll(optionsMap); + return confTree; + } +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/31c4a419/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionAMSuicideArgs.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionAMSuicideArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionAMSuicideArgs.java new file mode 100644 index 0000000..5b4cfdc --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionAMSuicideArgs.java @@ -0,0 +1,44 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.slider.common.params; + +import com.beust.jcommander.Parameter; +import com.beust.jcommander.Parameters; + +@Parameters(commandNames = {SliderActions.ACTION_AM_SUICIDE}, + commandDescription = SliderActions.DESCRIBE_ACTION_AM_SUICIDE) +public class ActionAMSuicideArgs extends AbstractActionArgs { + + @Override + public String getActionName() { + return SliderActions.ACTION_AM_SUICIDE; + } + + @Parameter(names = {ARG_MESSAGE}, + description = "reason for the action") + public String message = ""; + + @Parameter(names = {ARG_EXITCODE}, + description = "exit code") + public int exitcode = 1; + + @Parameter(names = {ARG_WAIT}, + description = "time for AM to wait before exiting") + public int waittime = 1000; +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/31c4a419/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionBuildArgs.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionBuildArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionBuildArgs.java new file mode 100644 index 0000000..1a182d1 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionBuildArgs.java @@ -0,0 +1,32 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.slider.common.params; + +import com.beust.jcommander.Parameters; + +@Parameters(commandNames = {SliderActions.ACTION_BUILD}, + commandDescription = SliderActions.DESCRIBE_ACTION_BUILD) + +public class ActionBuildArgs extends AbstractClusterBuildingActionArgs { + + @Override + public String getActionName() { + return SliderActions.ACTION_BUILD; + } +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/31c4a419/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionClientArgs.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionClientArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionClientArgs.java new file mode 100644 index 0000000..85d39ea --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionClientArgs.java @@ -0,0 +1,98 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.slider.common.params; + +import com.beust.jcommander.Parameter; +import com.beust.jcommander.Parameters; + +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_GETCERTSTORE}, + description = "Get a certificate store") + public boolean getCertStore; + + @Parameter(names = {ARG_KEYSTORE}, + description = "Retrieve keystore to specified location") + public File keystore; + + @Parameter(names = {ARG_TRUSTSTORE}, + description = "Retrieve truststore to specified location") + public File truststore; + + @Parameter(names = {ARG_HOSTNAME}, + description = "(Optional) Specify the hostname to use for generation of keystore certificate") + public String hostname; + + @Parameter(names = {ARG_NAME}, + description = "The name of the application") + public String name; + + @Parameter(names = {ARG_PROVIDER}, + description = "The credential provider in which the password is stored") + public String provider; + + @Parameter(names = {ARG_ALIAS}, + description = "The credential provider alias associated with the password") + public String alias; + + @Parameter(names = {ARG_PASSWORD}, + description = "The certificate store password (alternative to " + + "provider/alias; if password is specified, those will be ignored)") + public String password; + + @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; + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/hadoop/blob/31c4a419/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionCreateArgs.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionCreateArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionCreateArgs.java new file mode 100644 index 0000000..e70f30a --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionCreateArgs.java @@ -0,0 +1,59 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.slider.common.params; + +import com.beust.jcommander.Parameters; +import com.beust.jcommander.ParametersDelegate; + +import java.io.File; + +@Parameters(commandNames = {SliderActions.ACTION_CREATE}, + commandDescription = SliderActions.DESCRIBE_ACTION_CREATE) + +public class ActionCreateArgs extends AbstractClusterBuildingActionArgs + implements WaitTimeAccessor, LaunchArgsAccessor { + + @Override + public String getActionName() { + return SliderActions.ACTION_CREATE; + } + + @ParametersDelegate + LaunchArgsDelegate launchArgs = new LaunchArgsDelegate(); + + @Override + public File getOutputFile() { + return launchArgs.getOutputFile(); + } + + @Override + public String getRmAddress() { + return launchArgs.getRmAddress(); + } + + @Override + public int getWaittime() { + return launchArgs.getWaittime(); + } + + @Override + public void setWaittime(int waittime) { + launchArgs.setWaittime(waittime); + } +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/31c4a419/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionDependencyArgs.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionDependencyArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionDependencyArgs.java new file mode 100644 index 0000000..87f9f0dc --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionDependencyArgs.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.slider.common.params; + +import org.apache.slider.core.exceptions.BadCommandArgumentsException; +import org.apache.slider.core.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 }, + description = "Upload AM and agent libraries to HDFS for this client") + 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"); + } + } +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/31c4a419/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionDestroyArgs.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionDestroyArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionDestroyArgs.java new file mode 100644 index 0000000..4a129ab --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionDestroyArgs.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.slider.common.params; + +import com.beust.jcommander.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; +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/31c4a419/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionDiagnosticArgs.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionDiagnosticArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionDiagnosticArgs.java new file mode 100644 index 0000000..c891873 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionDiagnosticArgs.java @@ -0,0 +1,73 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.slider.common.params; + +import com.beust.jcommander.Parameter; +import com.beust.jcommander.Parameters; + +@Parameters( + commandNames = {SliderActions.ACTION_DIAGNOSTICS}, + commandDescription = SliderActions.DESCRIBE_ACTION_DIAGNOSTIC) +public class ActionDiagnosticArgs extends AbstractActionArgs { + + @Override + public String getActionName() { + return SliderActions.ACTION_DIAGNOSTICS; + } + + @Parameter(names = {ARG_NAME}, + description = "the name of the running application") + public String name; + + @Parameter(names = {ARG_CLIENT}, + description = "print configuration of the slider client") + public boolean client = false; + + @Parameter(names = {ARG_APPLICATION}, + description = "print configuration of the running application") + public boolean application; + + @Parameter(names = {ARG_VERBOSE}, + description = "print out information in details") + public boolean verbose = false; + + @Parameter(names = {ARG_YARN}, + description = "print configuration of the YARN cluster") + public boolean yarn = false; + + @Parameter(names = {ARG_CREDENTIALS}, + description = "print credentials of the current user") + public boolean credentials = false; + + @Parameter(names = {ARG_ALL}, + description = "print all of the information above") + public boolean all; + + @Parameter(names = {ARG_LEVEL}, + description = "diagnose each slider configuration one by one") + public boolean level; + + /** + * Get the min #of params expected + * @return the min number of params in the {@link #parameters} field + */ + @Override + public int getMinParams() { + return 0; + } +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/31c4a419/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionEchoArgs.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionEchoArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionEchoArgs.java new file mode 100644 index 0000000..d05f10b --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionEchoArgs.java @@ -0,0 +1,33 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.slider.common.params; + +import com.beust.jcommander.Parameter; + +public class ActionEchoArgs extends AbstractActionArgs { + @Override + public String getActionName() { + return SliderActions.ACTION_ECHO; + } + + @Parameter(names = {ARG_MESSAGE}, + description = "message to echo") + public String message; + +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/31c4a419/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionExistsArgs.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionExistsArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionExistsArgs.java new file mode 100644 index 0000000..dd1c04b --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionExistsArgs.java @@ -0,0 +1,47 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.slider.common.params; + +import com.beust.jcommander.Parameter; +import com.beust.jcommander.Parameters; + +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 application is running") + public boolean live; + + @Parameter(names = {ARG_STATE}, + description = "verify that the application is in the specific YARN state") + public String state = ""; + + @Parameter(names = {ARG_OUTPUT, ARG_OUTPUT_SHORT}, + description = "output file for any application report") + public File out; +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/31c4a419/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionFlexArgs.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionFlexArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionFlexArgs.java new file mode 100644 index 0000000..725973e --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionFlexArgs.java @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.slider.common.params; + +import com.beust.jcommander.Parameters; +import com.beust.jcommander.ParametersDelegate; +import org.apache.slider.core.exceptions.BadCommandArgumentsException; + +import java.util.List; +import java.util.Map; + +@Parameters(commandNames = {SliderActions.ACTION_FLEX}, + commandDescription = SliderActions.DESCRIBE_ACTION_FLEX) + +public class ActionFlexArgs extends AbstractActionArgs { + + @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(); + } + + public List getComponentTuples() { + return componentDelegate.getComponentTuples(); + } + +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/31c4a419/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionFreezeArgs.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionFreezeArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionFreezeArgs.java new file mode 100644 index 0000000..e3085d9 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionFreezeArgs.java @@ -0,0 +1,56 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.slider.common.params; + +import com.beust.jcommander.Parameter; +import com.beust.jcommander.Parameters; +import com.beust.jcommander.ParametersDelegate; + +@Parameters(commandNames = {SliderActions.ACTION_FREEZE}, + commandDescription = SliderActions.DESCRIBE_ACTION_FREEZE) + +public class ActionFreezeArgs extends AbstractActionArgs implements + WaitTimeAccessor { + @Override + public String getActionName() { + return SliderActions.ACTION_FREEZE; + } + + 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; +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/31c4a419/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionHelpArgs.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionHelpArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionHelpArgs.java new file mode 100644 index 0000000..62773c4 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionHelpArgs.java @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.slider.common.params; + +import com.beust.jcommander.Parameters; + +/** + * 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; + } + + /** + * This action does not need hadoop services + * @return false + */ + @Override + public boolean getHadoopServicesRequired() { + return false; + } +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/31c4a419/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionInstallKeytabArgs.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionInstallKeytabArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionInstallKeytabArgs.java new file mode 100644 index 0000000..4cfb889 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionInstallKeytabArgs.java @@ -0,0 +1,57 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.slider.common.params; + +import com.beust.jcommander.Parameter; +import com.beust.jcommander.Parameters; + +@Parameters(commandNames = {SliderActions.ACTION_INSTALL_KEYTAB}, + commandDescription = SliderActions.DESCRIBE_ACTION_INSTALL_KEYTAB) + +public class ActionInstallKeytabArgs extends AbstractActionArgs { + + @Override + public String getActionName() { + return SliderActions.ACTION_INSTALL_KEYTAB; + } + + @Parameter(names = {ARG_KEYTAB}, + description = "Path to keytab on local disk") + public String keytabUri; + + @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; + } +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/31c4a419/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionInstallPackageArgs.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionInstallPackageArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionInstallPackageArgs.java new file mode 100644 index 0000000..646e795 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionInstallPackageArgs.java @@ -0,0 +1,58 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.slider.common.params; + +import com.beust.jcommander.Parameter; +import com.beust.jcommander.Parameters; +import com.beust.jcommander.ParametersDelegate; + +@Parameters(commandNames = {SliderActions.ACTION_INSTALL_PACKAGE}, + commandDescription = SliderActions.DESCRIBE_ACTION_INSTALL_PACKAGE) + +public class ActionInstallPackageArgs extends AbstractActionArgs { + + @Override + public String getActionName() { + return SliderActions.ACTION_INSTALL_PACKAGE; + } + + @Parameter(names = {ARG_PACKAGE}, + description = "Path to app package on local disk") + public String packageURI; + + @Parameter(names = {ARG_NAME}, + description = "The type of the package") + public String name; + + @Parameter(names = {ARG_REPLACE_PKG}, description = "Overwrite existing package") + public boolean replacePkg = 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; + } +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/31c4a419/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionKDiagArgs.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionKDiagArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionKDiagArgs.java new file mode 100644 index 0000000..9fc9d2e --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionKDiagArgs.java @@ -0,0 +1,86 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.slider.common.params; + +import com.beust.jcommander.Parameter; +import com.beust.jcommander.Parameters; +import org.apache.slider.common.tools.SliderUtils; +import org.apache.slider.core.exceptions.BadCommandArgumentsException; +import org.apache.slider.core.exceptions.UsageException; + +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +@Parameters(commandNames = {SliderActions.ACTION_KDIAG}, + commandDescription = SliderActions.DESCRIBE_ACTION_KDIAG) + +public class ActionKDiagArgs extends AbstractActionArgs { + + @Override + public String getActionName() { + return SliderActions.ACTION_KDIAG; + } + + @Parameter(names = {ARG_SERVICES}, variableArity = true, + description =" list of services to check") + public List services = new ArrayList<>(); + + @Parameter(names = {ARG_OUTPUT, ARG_OUTPUT_SHORT}, + description = "output file for report") + public File out; + + @Parameter(names = {ARG_KEYTAB}, description = "keytab to use") + public File keytab; + + @Parameter(names = {ARG_KEYLEN}, description = "minimum key length") + public int keylen = 256; + + @Parameter(names = {ARG_PRINCIPAL}, description = "principal to log in from a keytab") + public String principal; + + @Parameter(names = {ARG_SECURE}, description = "Is security required") + public boolean secure = false; + + @Override + public int getMinParams() { + return 0; + } + + @Override + public boolean getHadoopServicesRequired() { + return false; + } + + @Override + public boolean disableSecureLogin() { + return true; + } + + @Override + public void validate() throws BadCommandArgumentsException, UsageException { + super.validate(); + if (keytab != null && SliderUtils.isUnset(principal)) { + throw new UsageException("Missing argument " + ARG_PRINCIPAL); + } + if (keytab == null && SliderUtils.isSet(principal)) { + throw new UsageException("Missing argument " + ARG_KEYTAB); + } + } +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/31c4a419/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionKeytabArgs.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionKeytabArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionKeytabArgs.java new file mode 100644 index 0000000..32b1d2b --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionKeytabArgs.java @@ -0,0 +1,81 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.slider.common.params; + +import com.beust.jcommander.Parameter; +import com.beust.jcommander.Parameters; + +@Parameters(commandNames = {SliderActions.ACTION_KEYTAB}, + commandDescription = SliderActions.DESCRIBE_ACTION_KEYTAB) + +public class ActionKeytabArgs extends AbstractActionArgs { + + public ActionKeytabArgs(ActionInstallKeytabArgs installKeytabInfo) { + this.install = true; + this.overwrite = installKeytabInfo.overwrite; + this.keytab = installKeytabInfo.keytabUri; + this.folder = installKeytabInfo.folder; + } + + 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; + } + +} http://git-wip-us.apache.org/repos/asf/hadoop/blob/31c4a419/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionKillContainerArgs.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionKillContainerArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionKillContainerArgs.java new file mode 100644 index 0000000..8c18ad8 --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionKillContainerArgs.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.slider.common.params; + +import com.beust.jcommander.Parameter; +import com.beust.jcommander.Parameters; + +@Parameters(commandNames = {SliderActions.ACTION_KILL_CONTAINER}, + commandDescription = SliderActions.DESCRIBE_ACTION_KILL_CONTAINER) + +public class ActionKillContainerArgs extends AbstractActionArgs { + @Override + public String getActionName() { + return SliderActions.ACTION_KILL_CONTAINER; + } + + @Parameter(names = {ARG_ID}, + description = "ID of the container") + public String id; + +} --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org For additional commands, e-mail: common-commits-help@hadoop.apache.org