http://git-wip-us.apache.org/repos/asf/hadoop/blob/2b3aff2f/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/SliderClientAPI.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/SliderClientAPI.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/SliderClientAPI.java deleted file mode 100644 index f1bf2ad..0000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/SliderClientAPI.java +++ /dev/null @@ -1,258 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.slider.client; - -import org.apache.hadoop.registry.client.api.RegistryOperations; -import org.apache.hadoop.service.Service; -import org.apache.hadoop.yarn.exceptions.YarnException; -import org.apache.slider.api.resource.Application; -import org.apache.slider.api.types.NodeInformationList; -import org.apache.slider.common.params.AbstractClusterBuildingActionArgs; -import org.apache.slider.common.params.ActionAMSuicideArgs; -import org.apache.slider.common.params.ActionClientArgs; -import org.apache.hadoop.yarn.service.client.params.ActionDependencyArgs; -import org.apache.slider.common.params.ActionDiagnosticArgs; -import org.apache.hadoop.yarn.service.client.params.ActionFlexArgs; -import org.apache.slider.common.params.ActionFreezeArgs; -import org.apache.slider.common.params.ActionKeytabArgs; -import org.apache.slider.common.params.ActionNodesArgs; -import org.apache.slider.common.params.ActionKillContainerArgs; -import org.apache.slider.common.params.ActionListArgs; -import org.apache.slider.common.params.ActionRegistryArgs; -import org.apache.slider.common.params.ActionResolveArgs; -import org.apache.slider.common.params.ActionResourceArgs; -import org.apache.slider.common.params.ActionStatusArgs; -import org.apache.slider.common.params.ActionThawArgs; -import org.apache.slider.common.params.ActionUpgradeArgs; -import org.apache.slider.core.exceptions.BadCommandArgumentsException; -import org.apache.slider.core.exceptions.SliderException; - -import java.io.IOException; - -/** - * Interface of those method calls in the slider API that are intended - * for direct public invocation. - * <p> - * Stability: evolving - */ -public interface SliderClientAPI extends Service { - - int actionDestroy(String clustername) throws YarnException, IOException; - - /** - * AM to commit an asynchronous suicide - */ - int actionAmSuicide(String clustername, - ActionAMSuicideArgs args) throws YarnException, IOException; - - /** - * Manage keytabs leveraged by slider - * - * @param keytabInfo the arguments needed to manage the keytab - * @throws YarnException Yarn problems - * @throws IOException other problems - * @throws BadCommandArgumentsException bad arguments. - */ - int actionKeytab(ActionKeytabArgs keytabInfo) - throws YarnException, IOException; - - /** - * Manage file resources leveraged by slider - * - * @param resourceInfo the arguments needed to manage the resource - * @throws YarnException Yarn problems - * @throws IOException other problems - * @throws BadCommandArgumentsException bad arguments. - */ - int actionResource(ActionResourceArgs resourceInfo) - throws YarnException, IOException; - - /** - * Perform client operations such as install or configure - * - * @param clientInfo the arguments needed for client operations - * - * @throws SliderException bad arguments. - * @throws IOException problems related to package and destination folders - */ - int actionClient(ActionClientArgs clientInfo) - throws IOException, YarnException; - - /** - * Update the cluster specification - * - * @param clustername cluster name - * @param buildInfo the arguments needed to update the cluster - * @throws YarnException Yarn problems - * @throws IOException other problems - */ - int actionUpdate(String clustername, - AbstractClusterBuildingActionArgs buildInfo) - throws YarnException, IOException; - - /** - * Upgrade the cluster with a newer version of the application - * - * @param clustername cluster name - * @param buildInfo the arguments needed to upgrade the cluster - * @throws YarnException Yarn problems - * @throws IOException other problems - */ - int actionUpgrade(String clustername, - ActionUpgradeArgs buildInfo) - throws YarnException, IOException; - - /** - * Implement the list action: list all nodes - * @return exit code of 0 if a list was created - */ - int actionList(String clustername, ActionListArgs args) throws IOException, YarnException; - - - int actionFlex(String name, ActionFlexArgs args) throws YarnException, - IOException; - - /** - * Test for a cluster existing probe for a cluster of the given name existing - * in the filesystem. If the live param is set, it must be a live cluster - * @return exit code - */ - int actionExists(String name, boolean checkLive) throws YarnException, IOException; - - /** - * Kill a specific container of the cluster - * @param name cluster name - * @param args arguments - * @return exit code - * @throws YarnException - * @throws IOException - */ - int actionKillContainer(String name, ActionKillContainerArgs args) - throws YarnException, IOException; - - /** - * Status operation - * - * @param clustername cluster name - * @param statusArgs status arguments - * @return 0 -for success, else an exception is thrown - * @throws YarnException - * @throws IOException - */ - int actionStatus(String clustername, ActionStatusArgs statusArgs) - throws YarnException, IOException; - - /** - * Status operation which returns the status object as a string instead of - * printing it to the console or file. - * - * @param clustername cluster name - * @return cluster status details - * @throws YarnException - * @throws IOException - */ - Application actionStatus(String clustername) throws YarnException, IOException; - - /** - * Version Details - * @return exit code - */ - int actionVersion(); - - /** - * Stop the cluster - * - * @param clustername cluster name - * @param freezeArgs arguments to the stop - * @return EXIT_SUCCESS if the cluster was not running by the end of the operation - */ - int actionStop(String clustername, ActionFreezeArgs freezeArgs) - throws YarnException, IOException; - - /** - * Restore a cluster - */ - int actionStart(String clustername, ActionThawArgs thaw) throws YarnException, IOException; - - /** - * Registry operation - * - * @param args registry Arguments - * @return 0 for success, -1 for some issues that aren't errors, just failures - * to retrieve information (e.g. no configurations for that entry) - * @throws YarnException YARN problems - * @throws IOException Network or other problems - */ - int actionResolve(ActionResolveArgs args) - throws YarnException, IOException; - - /** - * Registry operation - * - * @param registryArgs registry Arguments - * @return 0 for success, -1 for some issues that aren't errors, just failures - * to retrieve information (e.g. no configurations for that entry) - * @throws YarnException YARN problems - * @throws IOException Network or other problems - */ - int actionRegistry(ActionRegistryArgs registryArgs) - throws YarnException, IOException; - - /** - * diagnostic operation - * - * @param diagnosticArgs diagnostic Arguments - * @return 0 for success, -1 for some issues that aren't errors, just - * failures to retrieve information (e.g. no application name - * specified) - * @throws YarnException YARN problems - * @throws IOException Network or other problems - */ - int actionDiagnostic(ActionDiagnosticArgs diagnosticArgs); - - /** - * Get the registry binding. As this may start the registry, it can take time - * and fail - * @return the registry - */ - RegistryOperations getRegistryOperations() - throws SliderException, IOException; - - /** - * Upload all Slider AM and agent dependency libraries to HDFS, so that they - * do not need to be uploaded with every create call. This operation is - * Slider version specific. So it needs to be invoked for every single - * version of slider/slider-client. - * - * @throws SliderException - * @throws IOException - */ - int actionDependency(ActionDependencyArgs dependencyArgs) throws IOException, - YarnException; - - /** - * List the nodes - * @param args - * @return - * @throws YarnException - * @throws IOException - */ - NodeInformationList listYarnClusterNodes(ActionNodesArgs args) - throws YarnException, IOException; -}
http://git-wip-us.apache.org/repos/asf/hadoop/blob/2b3aff2f/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/SliderYarnClientImpl.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/SliderYarnClientImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/SliderYarnClientImpl.java deleted file mode 100644 index e1b578c..0000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/SliderYarnClientImpl.java +++ /dev/null @@ -1,294 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.slider.client; - -import com.google.common.base.Preconditions; -import org.apache.commons.lang.StringUtils; -import org.apache.hadoop.yarn.api.ApplicationClientProtocol; -import org.apache.hadoop.yarn.api.records.ApplicationId; -import org.apache.hadoop.yarn.api.records.ApplicationReport; -import org.apache.hadoop.yarn.api.records.NodeReport; -import org.apache.hadoop.yarn.api.records.NodeState; -import org.apache.hadoop.yarn.api.records.YarnApplicationState; -import org.apache.hadoop.yarn.client.api.impl.YarnClientImpl; -import org.apache.hadoop.yarn.exceptions.YarnException; -import org.apache.slider.api.types.NodeInformation; -import org.apache.slider.api.types.NodeInformationList; -import org.apache.hadoop.yarn.service.conf.SliderKeys; -import org.apache.slider.common.tools.Duration; -import org.apache.slider.common.tools.SliderUtils; -import org.apache.slider.core.exceptions.BadCommandArgumentsException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.EnumSet; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -//TODO, Remove this class and YarnAppListClient -// why do we need so many yarn client wrappers ? -// - yarn client already provides most of functionality already - -/** - * A class that extends visibility to some of the YarnClientImpl - * members and data structures, and factors out pure-YARN operations - * from the slider entry point service - */ -public class SliderYarnClientImpl extends YarnClientImpl { - protected static final Logger log = LoggerFactory.getLogger(SliderYarnClientImpl.class); - - /** - * Get the RM Client RPC interface - * @return an RPC interface valid after initialization and authentication - */ - public ApplicationClientProtocol getRmClient() { - return rmClient; - } - - /** - * List Slider <i>deployed</i>instances belonging to a specific user in a - * given set of states and filtered by an application name tag. - * <p> - * Deployed means: known about in the YARN cluster; it will include all apps - * in the specified set of states and tagged with the specified app name. - * - * @param user - * user: "" means all users - * @param appStates - * filter by a set of YarnApplicationState - * @param appname - * an application name tag in the format defined by - * {@link SliderUtils#createNameTag(String)} - * @return a possibly empty list of Slider AMs - * @throws YarnException - * @throws IOException - */ - public List<ApplicationReport> listDeployedInstances(String user, - EnumSet<YarnApplicationState> appStates, String appname) - throws YarnException, IOException { - Preconditions.checkArgument(user != null, "Null User"); - Set<String> types = new HashSet<>(1); - types.add(SliderKeys.APP_TYPE); - Set<String> tags = null; - if (appname != null) { - tags = Collections.singleton(SliderUtils.createNameTag(appname)); - } - List<ApplicationReport> allApps = getApplications(types, appStates, tags); - List<ApplicationReport> results = new ArrayList<>(); - for (ApplicationReport report : allApps) { - if (StringUtils.isEmpty(user) || user.equals(report.getUser())) { - results.add(report); - } - } - return results; - } - - /** - * Helper method to determine if a cluster application is running -or - * is earlier in the lifecycle - * @param app application report - * @return true if the application is considered live - */ - public boolean isApplicationLive(ApplicationReport app) { - Preconditions.checkArgument(app != null, "Null app report"); - - return app.getYarnApplicationState().ordinal() <= YarnApplicationState.RUNNING.ordinal(); - } - - /** - * find all live instances of a specific app -if there is >1 in the cluster, - * this returns them all. State should be running or less - * @param user user - * @param appname application name - * @return the list of all matching application instances - */ - public List<ApplicationReport> findAllLiveInstances(String user, - String appname) throws YarnException, IOException { - Preconditions.checkArgument(StringUtils.isNotEmpty(appname), - "Null/empty application name"); - return listDeployedInstances(user, SliderUtils.getAllLiveAppStates(), - appname); - } - - /** - * Find a cluster in the instance list; biased towards live instances - * @param instances list of instances - * @param appname application name - * @return the first found instance, else a failed/finished instance, or null - * if there are none of those - */ - public ApplicationReport findClusterInInstanceList(List<ApplicationReport> instances, - String appname) { - Preconditions.checkArgument(instances != null, "Null instances list"); - Preconditions.checkArgument(StringUtils.isNotEmpty(appname), - "Null/empty application name"); - // sort by most recent - SliderUtils.sortApplicationsByMostRecent(instances); - ApplicationReport found = null; - for (ApplicationReport app : instances) { - if (app.getName().equals(appname)) { - if (isApplicationLive(app)) { - return app; - } - // set the found value if not set - found = found != null ? found : app; - } - } - return found; - } - - /** - * Find an app in the instance list in the desired state - * @param instances instance list - * @param appname application name - * @param desiredState yarn state desired - * @return the match or null for none - */ - public ApplicationReport findAppInInstanceList(List<ApplicationReport> instances, - String appname, - YarnApplicationState desiredState) { - Preconditions.checkArgument(instances != null, "Null instances list"); - Preconditions.checkArgument(StringUtils.isNotEmpty(appname), - "Null/empty application name"); - Preconditions.checkArgument(desiredState != null, "Null desiredState"); - log.debug("Searching {} records for instance name {} in state '{}'", - instances.size(), appname, desiredState); - for (ApplicationReport app : instances) { - if (app.getName().equals(appname)) { - - YarnApplicationState appstate = - app.getYarnApplicationState(); - log.debug("app ID {} is in state {}", app.getApplicationId(), appstate); - if (appstate.equals(desiredState)) { - log.debug("match"); - return app; - } - } - } - // nothing found in desired state - log.debug("No match"); - return null; - } - - /** - * List the nodes in the cluster, possibly filtering by node state or label. - * - * @param label label to filter by -or "" for any - * @param live flag to request running nodes only - * @return a possibly empty list of nodes in the cluster - * @throws IOException IO problems - * @throws YarnException YARN problems - */ - public NodeInformationList listNodes(String label, boolean live) - throws IOException, YarnException { - Preconditions.checkArgument(label != null, "null label"); - NodeState[] states; - if (live) { - states = new NodeState[1]; - states[0] = NodeState.RUNNING; - } else { - states = new NodeState[0]; - } - List<NodeReport> reports = getNodeReports(states); - NodeInformationList results = new NodeInformationList(reports.size()); - for (NodeReport report : reports) { - if (live && report.getNodeState() != NodeState.RUNNING) { - continue; - } - if (!label.isEmpty() && !report.getNodeLabels().contains(label)) { - continue; - } - // build node info from report - NodeInformation info = new NodeInformation(); - info.hostname = report.getNodeId().getHost(); - info.healthReport = report.getHealthReport(); - info.httpAddress = report.getHttpAddress(); - info.labels = SliderUtils.extractNodeLabel(report); - info.rackName = report.getRackName(); - info.state = report.getNodeState().toString(); - results.add(info); - } - return results; - } - - /** - * Monitor the submitted application for reaching the requested state. - * Will also report if the app reaches a later state (failed, killed, etc) - * Kill application if duration!= null & time expires. - * @param appId Application Id of application to be monitored - * @param duration how long to wait -must be more than 0 - * @param desiredState desired state. - * @return the application report -null on a timeout - * @throws YarnException - * @throws IOException - */ - public ApplicationReport monitorAppToState( - ApplicationId appId, YarnApplicationState desiredState, Duration duration) - throws YarnException, IOException { - - if (appId == null) { - throw new BadCommandArgumentsException("null application ID"); - } - if (duration.limit <= 0) { - throw new BadCommandArgumentsException("Invalid monitoring duration"); - } - log.debug("Waiting {} millis for app to reach state {} ", - duration.limit, - desiredState); - duration.start(); - try { - while (true) { - // Get application report for the appId we are interested in - - ApplicationReport r = getApplicationReport(appId); - - log.debug("queried status is\n{}", - new SliderUtils.OnDemandReportStringifier(r)); - - YarnApplicationState state = r.getYarnApplicationState(); - if (state.ordinal() >= desiredState.ordinal()) { - log.debug("App in desired state (or higher) :{}", state); - return r; - } - if (duration.getLimitExceeded()) { - log.debug( - "Wait limit of {} millis to get to state {}, exceeded; app " + - "status\n {}", - duration.limit, - desiredState, - new SliderUtils.OnDemandReportStringifier(r)); - return null; - } - - // sleep 1s. - try { - Thread.sleep(1000); - } catch (InterruptedException ignored) { - log.debug("Thread sleep in monitoring loop interrupted"); - } - } - } finally { - duration.close(); - } - } -} http://git-wip-us.apache.org/repos/asf/hadoop/blob/2b3aff2f/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/TokensOperation.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/TokensOperation.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/TokensOperation.java deleted file mode 100644 index 84c65b3..0000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/TokensOperation.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.slider.client; - -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.fs.FileSystem; -import org.apache.hadoop.security.Credentials; -import org.apache.hadoop.security.UserGroupInformation; -import org.apache.hadoop.yarn.client.api.impl.YarnClientImpl; -import org.apache.hadoop.yarn.exceptions.YarnException; -import org.apache.slider.common.params.ActionTokensArgs; -import org.apache.slider.core.exceptions.BadClusterStateException; -import org.apache.slider.core.exceptions.NotFoundException; -import static org.apache.slider.core.launch.CredentialUtils.*; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.io.IOException; - -public class TokensOperation { - - private static final Logger log = LoggerFactory.getLogger(TokensOperation.class); - public static final String E_INSECURE - = "Cluster is not secure -tokens cannot be acquired"; - public static final String E_MISSING_SOURCE_FILE = "Missing source file: "; - public static final String E_NO_KEYTAB = "No keytab: "; - - public int actionTokens(ActionTokensArgs args, FileSystem fs, - Configuration conf, - YarnClientImpl yarnClient) - throws IOException, YarnException { - Credentials credentials; - String footnote = ""; - UserGroupInformation user = UserGroupInformation.getCurrentUser(); - boolean isSecure = UserGroupInformation.isSecurityEnabled(); - if (args.keytab != null) { - File keytab = args.keytab; - if (!keytab.isFile()) { - throw new NotFoundException(E_NO_KEYTAB + keytab.getAbsolutePath()); - } - String principal = args.principal; - log.info("Logging in as {} from keytab {}", principal, keytab); - user = UserGroupInformation.loginUserFromKeytabAndReturnUGI( - principal, keytab.getCanonicalPath()); - } - Credentials userCredentials = user.getCredentials(); - File output = args.output; - if (output != null) { - if (!isSecure) { - throw new BadClusterStateException(E_INSECURE); - } - credentials = new Credentials(userCredentials); - // filesystem - addRMRenewableFSDelegationTokens(conf, fs, credentials); - addRMDelegationToken(yarnClient, credentials); - if (maybeAddTimelineToken(conf, credentials) != null) { - log.debug("Added timeline token"); - } - saveTokens(output, credentials); - String filename = output.getCanonicalPath(); - footnote = String.format( - "%d tokens saved to %s%n" + "To use these in the environment:%n" - + "export %s=%s", credentials.numberOfTokens(), filename, - UserGroupInformation.HADOOP_TOKEN_FILE_LOCATION, filename); - } else if (args.source != null) { - File source = args.source; - log.info("Reading credentials from file {}", source); - if (!source.isFile()) { - throw new NotFoundException( E_MISSING_SOURCE_FILE + source.getAbsolutePath()); - } - credentials = Credentials.readTokenStorageFile(args.source, conf); - } else { - StringBuffer origin = new StringBuffer(); - File file = locateEnvCredentials(System.getenv(), conf, - origin); - if (file != null) { - log.info("Credential Source {}", origin); - } else { - log.info("Credential source: logged in user"); - } - credentials = userCredentials; - } - // list the tokens - log.info("\n{}", dumpTokens(credentials, "\n")); - if (!footnote.isEmpty()) { - log.info(footnote); - } - return 0; - } - -} http://git-wip-us.apache.org/repos/asf/hadoop/blob/2b3aff2f/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java deleted file mode 100644 index e89a660..0000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/ipc/SliderClusterOperations.java +++ /dev/null @@ -1,355 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.slider.client.ipc; - -import com.google.common.annotations.VisibleForTesting; -import org.apache.hadoop.yarn.exceptions.YarnException; -import org.apache.slider.api.ClusterNode; -import org.apache.slider.api.SliderClusterProtocol; -import org.apache.slider.api.StateValues; -import org.apache.slider.api.proto.Messages; -import org.apache.slider.api.resource.Application; -import org.apache.slider.api.types.ContainerInformation; -import org.apache.slider.api.types.NodeInformation; -import org.apache.slider.api.types.NodeInformationList; -import org.apache.slider.api.types.PingInformation; -import org.apache.slider.common.tools.Duration; -import org.apache.slider.core.exceptions.NoSuchNodeException; -import org.apache.slider.core.exceptions.SliderException; -import org.apache.slider.core.exceptions.WaitTimeoutException; -import org.apache.slider.core.persist.JsonSerDeser; -import org.codehaus.jackson.JsonParseException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import static org.apache.slider.api.types.RestTypeMarshalling.unmarshall; - -/** - * Cluster operations at a slightly higher level than the RPC code - */ -public class SliderClusterOperations { - protected static final Logger - log = LoggerFactory.getLogger(SliderClusterOperations.class); - - private final SliderClusterProtocol appMaster; - private static final JsonSerDeser<Application> jsonSerDeser = - new JsonSerDeser<Application>(Application.class); - private static final Messages.EmptyPayloadProto EMPTY; - static { - EMPTY = Messages.EmptyPayloadProto.newBuilder().build(); - } - - public SliderClusterOperations(SliderClusterProtocol appMaster) { - this.appMaster = appMaster; - } - - @Override - public String toString() { - final StringBuilder sb = - new StringBuilder("SliderClusterOperations{"); - sb.append("IPC binding=").append(appMaster); - sb.append('}'); - return sb.toString(); - } - - /** - * Get a node from the AM - * @param uuid uuid of node - * @return deserialized node - * @throws IOException IO problems - * @throws NoSuchNodeException if the node isn't found - */ - public ClusterNode getNode(String uuid) - throws IOException, NoSuchNodeException, YarnException { - Messages.GetNodeRequestProto req = - Messages.GetNodeRequestProto.newBuilder().setUuid(uuid).build(); - Messages.GetNodeResponseProto node = appMaster.getNode(req); - return ClusterNode.fromProtobuf(node.getClusterNode()); - } - - /** - * Unmarshall a list of nodes from a protobud response - * @param nodes node list - * @return possibly empty list of cluster nodes - * @throws IOException - */ - public List<ClusterNode> convertNodeWireToClusterNodes(List<Messages.RoleInstanceState> nodes) - throws IOException { - List<ClusterNode> nodeList = new ArrayList<>(nodes.size()); - for (Messages.RoleInstanceState node : nodes) { - nodeList.add(ClusterNode.fromProtobuf(node)); - } - return nodeList; - } - - /** - * Echo text (debug action) - * @param text text - * @return the text, echoed back - * @throws YarnException - * @throws IOException - */ - public String echo(String text) throws YarnException, IOException { - Messages.EchoRequestProto.Builder builder = - Messages.EchoRequestProto.newBuilder(); - builder.setText(text); - Messages.EchoRequestProto req = builder.build(); - Messages.EchoResponseProto response = appMaster.echo(req); - return response.getText(); - } - - - /** - * Connect to a live cluster and get its current state - * @return its description - */ - public Application getApplication() throws YarnException, IOException { - Messages.GetJSONClusterStatusRequestProto req = - Messages.GetJSONClusterStatusRequestProto.newBuilder().build(); - Messages.GetJSONClusterStatusResponseProto resp = - appMaster.getJSONClusterStatus(req); - String statusJson = resp.getClusterSpec(); - try { - return jsonSerDeser.fromJson(statusJson); - } catch (JsonParseException e) { - log.error("Error when parsing app json file", e); - throw e; - } - } - - /** - * Kill a container - * @param id container ID - * @return a success flag - * @throws YarnException - * @throws IOException - */ - public boolean killContainer(String id) throws - YarnException, - IOException { - Messages.KillContainerRequestProto.Builder builder = - Messages.KillContainerRequestProto.newBuilder(); - builder.setId(id); - Messages.KillContainerRequestProto req = builder.build(); - Messages.KillContainerResponseProto response = appMaster.killContainer(req); - return response.getSuccess(); - } - - /** - * List all node UUIDs in a role - * @param role role name or "" for all - * @return an array of UUID strings - * @throws IOException - * @throws YarnException - */ - public String[] listNodeUUIDsByRole(String role) throws IOException, YarnException { - Collection<String> uuidList = innerListNodeUUIDSByRole(role); - String[] uuids = new String[uuidList.size()]; - return uuidList.toArray(uuids); - } - - public List<String> innerListNodeUUIDSByRole(String role) throws IOException, YarnException { - Messages.ListNodeUUIDsByRoleRequestProto req = - Messages.ListNodeUUIDsByRoleRequestProto - .newBuilder() - .setRole(role) - .build(); - Messages.ListNodeUUIDsByRoleResponseProto resp = appMaster.listNodeUUIDsByRole(req); - return resp.getUuidList(); - } - - /** - * List all nodes in a role. This is a double round trip: once to list - * the nodes in a role, another to get their details - * @param role - * @return an array of ContainerNode instances - * @throws IOException - * @throws YarnException - */ - public List<ClusterNode> listClusterNodesInRole(String role) - throws IOException, YarnException { - - Collection<String> uuidList = innerListNodeUUIDSByRole(role); - Messages.GetClusterNodesRequestProto req = - Messages.GetClusterNodesRequestProto - .newBuilder() - .addAllUuid(uuidList) - .build(); - Messages.GetClusterNodesResponseProto resp = appMaster.getClusterNodes(req); - return convertNodeWireToClusterNodes(resp.getClusterNodeList()); - } - - /** - * Get the details on a list of uuids - * @param uuids instance IDs - * @return a possibly empty list of node details - * @throws IOException - * @throws YarnException - */ - @VisibleForTesting - public List<ClusterNode> listClusterNodes(String[] uuids) - throws IOException, YarnException { - - Messages.GetClusterNodesRequestProto req = - Messages.GetClusterNodesRequestProto - .newBuilder() - .addAllUuid(Arrays.asList(uuids)) - .build(); - Messages.GetClusterNodesResponseProto resp = appMaster.getClusterNodes(req); - return convertNodeWireToClusterNodes(resp.getClusterNodeList()); - } - - /** - * Wait for an instance of a named role to be live (or past it in the lifecycle) - * @param role role to look for - * @param timeout time to wait - * @return the state. If still in CREATED, the cluster didn't come up - * in the time period. If LIVE, all is well. If >LIVE, it has shut for a reason - * @throws IOException IO - * @throws SliderException Slider - * @throws WaitTimeoutException if the wait timed out - */ - @VisibleForTesting - public int waitForRoleInstanceLive(String role, long timeout) - throws WaitTimeoutException, IOException, YarnException { - Duration duration = new Duration(timeout); - duration.start(); - boolean live = false; - int state = StateValues.STATE_CREATED; - - log.info("Waiting {} millis for a live node in role {}", timeout, role); - try { - while (!live) { - // see if there is a node in that role yet - List<String> uuids = innerListNodeUUIDSByRole(role); - String[] containers = uuids.toArray(new String[uuids.size()]); - int roleCount = containers.length; - ClusterNode roleInstance = null; - if (roleCount != 0) { - - // if there is, get the node - roleInstance = getNode(containers[0]); - if (roleInstance != null) { - state = roleInstance.state; - live = state >= StateValues.STATE_LIVE; - } - } - if (!live) { - if (duration.getLimitExceeded()) { - throw new WaitTimeoutException( - String.format("Timeout after %d millis" + - " waiting for a live instance of type %s; " + - "instances found %d %s", - timeout, role, roleCount, - (roleInstance != null - ? (" instance -\n" + roleInstance.toString()) - : "") - )); - } else { - try { - Thread.sleep(1000); - } catch (InterruptedException ignored) { - // ignored - } - } - } - } - } finally { - duration.close(); - } - return state; - } - - public void flex(Map<String, Long> componentCounts) throws IOException{ - Messages.FlexComponentsRequestProto.Builder builder = - Messages.FlexComponentsRequestProto.newBuilder(); - for (Entry<String, Long> componentCount : componentCounts.entrySet()) { - Messages.ComponentCountProto componentProto = - Messages.ComponentCountProto.newBuilder() - .setName(componentCount.getKey()) - .setNumberOfContainers(componentCount.getValue()).build(); - builder.addComponents(componentProto); - } - appMaster.flexComponents(builder.build()); - } - - /** - * Commit (possibly delayed) AM suicide - * - * @param signal exit code - * @param text text text to log - * @param delay delay in millis - * @throws YarnException - * @throws IOException - */ - public void amSuicide(String text, int signal, int delay) - throws IOException { - Messages.AMSuicideRequestProto.Builder builder = - Messages.AMSuicideRequestProto.newBuilder(); - if (text != null) { - builder.setText(text); - } - builder.setSignal(signal); - builder.setDelay(delay); - Messages.AMSuicideRequestProto req = builder.build(); - appMaster.amSuicide(req); - } - - public List<ContainerInformation> getContainers() throws IOException { - Messages.GetLiveContainersResponseProto response = appMaster - .getLiveContainers(Messages.GetLiveContainersRequestProto.newBuilder() - .build()); - return unmarshall(response); - } - - public NodeInformationList getLiveNodes() throws IOException { - Messages.GetLiveNodesResponseProto response = - appMaster.getLiveNodes(Messages.GetLiveNodesRequestProto.newBuilder().build()); - - int records = response.getNodesCount(); - NodeInformationList nil = new NodeInformationList(records); - for (int i = 0; i < records; i++) { - nil.add(unmarshall(response.getNodes(i))); - } - return nil; - } - - public NodeInformation getLiveNode(String hostname) throws IOException { - Messages.GetLiveNodeRequestProto.Builder builder = - Messages.GetLiveNodeRequestProto.newBuilder(); - builder.setName(hostname); - return unmarshall(appMaster.getLiveNode(builder.build())); - } - - public PingInformation ping(String text) throws IOException { - return null; - } - - public void stop(String text) throws IOException { - amSuicide(text, 3, 0); - } -} http://git-wip-us.apache.org/repos/asf/hadoop/blob/2b3aff2f/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/rest/BaseRestClient.java ---------------------------------------------------------------------- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/rest/BaseRestClient.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/rest/BaseRestClient.java deleted file mode 100644 index d936a22..0000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/rest/BaseRestClient.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.slider.client.rest; - -import com.google.common.base.Preconditions; -import com.sun.jersey.api.client.Client; -import com.sun.jersey.api.client.ClientHandlerException; -import com.sun.jersey.api.client.GenericType; -import com.sun.jersey.api.client.UniformInterfaceException; -import com.sun.jersey.api.client.WebResource; -import org.apache.slider.core.exceptions.ExceptionConverter; -import org.apache.slider.core.restclient.HttpVerb; -import org.apache.slider.core.restclient.UgiJerseyBinding; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.ws.rs.core.MediaType; -import java.io.IOException; -import java.net.URI; - - -/** - * This is a base class for Jersey REST clients in Slider. - * It supports the execution of operations âwith - * exceptions uprated to IOExceptions when needed. - * <p> - * Subclasses can use these operations to provide an API-like view - * of the REST model - */ -public class BaseRestClient { - private static final Logger log = - LoggerFactory.getLogger(BaseRestClient.class); - private final Client client; - - public BaseRestClient( - Client client) { - Preconditions.checkNotNull(client, "null jersey client"); - this.client = client; - } - - /** - * Get the jersey client - * @return jersey client - */ - public Client getClient() { - return client; - } - - /** - * Execute the operation. Failures are raised as IOException subclasses - * @param method method to execute - * @param resource resource to work against - * @param c class to build - * @param <T> type expected - * @return an instance of the type T - * @throws IOException on any failure - */ - public <T> T exec(HttpVerb method, WebResource resource, Class<T> c) - throws IOException { - try { - Preconditions.checkArgument(c != null); - log.debug("{}} {}", method, resource.getURI()); - return resource.accept(MediaType.APPLICATION_JSON_TYPE) - .method(method.getVerb(), c); - } catch (ClientHandlerException ex) { - throw ExceptionConverter.convertJerseyException(method.getVerb(), - resource.getURI().toString(), - ex); - } catch (UniformInterfaceException ex) { - throw UgiJerseyBinding.uprateFaults(method, - resource.getURI().toString(), - ex); - } - } - - /** - * Execute the operation. Failures are raised as IOException subclasses - * @param method method to execute - * @param resource resource to work against - * @param t type to work with - * @param <T> type expected - * @return an instance of the type T - * @throws IOException on any failure - */ - public <T> T exec(HttpVerb method, WebResource resource, GenericType<T> t) - throws IOException { - try { - Preconditions.checkArgument(t != null); - log.debug("{}} {}", method, resource.getURI()); - resource.accept(MediaType.APPLICATION_JSON_TYPE); - return resource.method(method.getVerb(), t); - } catch (ClientHandlerException ex) { - throw ExceptionConverter.convertJerseyException(method.getVerb(), - resource.getURI().toString(), - ex); - } catch (UniformInterfaceException ex) { - throw UgiJerseyBinding.uprateFaults(method, resource.getURI().toString(), - ex); - } - } - - - /** - * Execute the GET operation. Failures are raised as IOException subclasses - * @param resource resource to work against - * @param c class to build - * @param <T> type expected - * @return an instance of the type T - * @throws IOException on any failure - */ - public <T> T get(WebResource resource, Class<T> c) throws IOException { - return exec(HttpVerb.GET, resource, c); - } - - /** - * Create a Web resource from the client. - * - * @param u the URI of the resource. - * @return the Web resource. - */ - public WebResource resource(URI u) { - return client.resource(u); - } - - /** - * Create a Web resource from the client. - * - * @param u the URI of the resource. - * @return the Web resource. - */ - - public WebResource resource(String url) { - return client.resource(url); - } - -} http://git-wip-us.apache.org/repos/asf/hadoop/blob/2b3aff2f/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/Constants.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/Constants.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/Constants.java deleted file mode 100644 index 0e3559a..0000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/Constants.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.slider.common; - -public class Constants { - public static final int CONNECT_TIMEOUT = 10000; - public static final int RPC_TIMEOUT = 15000; - - public static final String HADOOP_JAAS_DEBUG = "HADOOP_JAAS_DEBUG"; - public static final String KRB5_CCNAME = "KRB5CCNAME"; - public static final String JAVA_SECURITY_KRB5_CONF - = "java.security.krb5.conf"; - public static final String JAVA_SECURITY_KRB5_REALM - = "java.security.krb5.realm"; - public static final String SUN_SECURITY_KRB5_DEBUG - = "sun.security.krb5.debug"; - public static final String SUN_SECURITY_SPNEGO_DEBUG - = "sun.security.spnego.debug"; -} http://git-wip-us.apache.org/repos/asf/hadoop/blob/2b3aff2f/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 deleted file mode 100644 index 61c828e..0000000 --- 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 +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.slider.common; - -/** - * 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/2b3aff2f/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 deleted file mode 100644 index ec88ca1..0000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/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.slider.common.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 { -} http://git-wip-us.apache.org/repos/asf/hadoop/blob/2b3aff2f/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 deleted file mode 100644 index 57c27e7..0000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/AbstractClusterBuildingActionArgs.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.slider.common.params; - -import com.beust.jcommander.Parameter; -import com.beust.jcommander.ParametersDelegate; -import com.google.common.annotations.VisibleForTesting; -import org.apache.hadoop.yarn.service.client.params.AbstractActionArgs; -import org.apache.hadoop.yarn.service.client.params.ComponentArgsDelegate; -import org.apache.slider.core.exceptions.BadCommandArgumentsException; - -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 { - @Parameter(names = {ARG_APPDEF}, - description = "Template application definition file in JSON format.") - public File appDef; - - public File getAppDef() { - return appDef; - } - - @Parameter(names = { - ARG_QUEUE }, description = "Queue to submit the application") - public String queue; - - @Parameter(names = { - ARG_LIFETIME }, description = "Lifetime of the application from the time of request") - public long lifetime; - - @ParametersDelegate - public ComponentArgsDelegate componentDelegate = new ComponentArgsDelegate(); - - @ParametersDelegate - public OptionArgsDelegate optionsDelegate = - new OptionArgsDelegate(); - - - public Map<String, String> getOptionsMap() throws - BadCommandArgumentsException { - return optionsDelegate.getOptionsMap(); - } - - /** - * Get the role heap mapping (may be empty, but never null). - * @return role heap mapping - * @throws BadCommandArgumentsException parse problem - */ - public Map<String, Map<String, String>> getCompOptionMap() throws - BadCommandArgumentsException { - return optionsDelegate.getCompOptionMap(); - } - - @VisibleForTesting - public List<String> getComponentTuples() { - return componentDelegate.getComponentTuples(); - } - - /** - * Get the role mapping (may be empty, but never null). - * @return role mapping - * @throws BadCommandArgumentsException parse problem - */ - public Map<String, String> getComponentMap() throws - BadCommandArgumentsException { - return componentDelegate.getComponentMap(); - } -} http://git-wip-us.apache.org/repos/asf/hadoop/blob/2b3aff2f/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 deleted file mode 100644 index 04ec9e2..0000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionAMSuicideArgs.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.slider.common.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_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/2b3aff2f/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 deleted file mode 100644 index 8dfde36..0000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/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.slider.common.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 application") - 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; - } -} http://git-wip-us.apache.org/repos/asf/hadoop/blob/2b3aff2f/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 deleted file mode 100644 index cb36961..0000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionDiagnosticArgs.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.slider.common.params; - -import com.beust.jcommander.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_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/2b3aff2f/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 deleted file mode 100644 index b075ce0..0000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/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.slider.common.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 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/2b3aff2f/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 deleted file mode 100644 index b08e1cf..0000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionFreezeArgs.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.slider.common.params; - -import com.beust.jcommander.Parameter; -import com.beust.jcommander.Parameters; -import com.beust.jcommander.ParametersDelegate; -import org.apache.hadoop.yarn.service.client.params.AbstractActionArgs; -import org.apache.hadoop.yarn.service.client.params.SliderActions; - -@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; -} http://git-wip-us.apache.org/repos/asf/hadoop/blob/2b3aff2f/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 deleted file mode 100644 index fc6eb4f..0000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionHelpArgs.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.slider.common.params; - -import com.beust.jcommander.Parameters; -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; - } - - /** - * 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/2b3aff2f/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 deleted file mode 100644 index be370bb..0000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionKDiagArgs.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.slider.common.params; - -import com.beust.jcommander.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 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<String> 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/2b3aff2f/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 deleted file mode 100644 index 7a46c66..0000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/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.slider.common.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; - } - -} http://git-wip-us.apache.org/repos/asf/hadoop/blob/2b3aff2f/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 deleted file mode 100644 index e1e94bd..0000000 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionKillContainerArgs.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.slider.common.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_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-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org