diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/api/ApplicationApi.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/api/ApplicationApi.java
index 0f4bdae..b504d8f 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/api/ApplicationApi.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/api/ApplicationApi.java
@@ -19,7 +19,7 @@
import javax.ws.rs.core.Response;
-import org.apache.slider.api.resource.Application;
+import org.apache.hadoop.yarn.service.api.records.Application;
/**
* Apache Hadoop YARN Services REST API interface.
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/api/impl/ApplicationApiService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/api/impl/ApplicationApiService.java
index decd849..04416cd 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/api/impl/ApplicationApiService.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/api/impl/ApplicationApiService.java
@@ -27,11 +27,11 @@
import org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException;
import org.apache.hadoop.yarn.exceptions.YarnException;
import org.apache.hadoop.yarn.service.client.ServiceClient;
-import org.apache.slider.api.resource.Application;
-import org.apache.slider.api.resource.ApplicationState;
-import org.apache.slider.api.resource.ApplicationStatus;
-import org.apache.slider.api.resource.Component;
-import org.apache.slider.common.tools.SliderUtils;
+import org.apache.hadoop.yarn.service.api.records.Application;
+import org.apache.hadoop.yarn.service.api.records.ApplicationState;
+import org.apache.hadoop.yarn.service.api.records.ApplicationStatus;
+import org.apache.hadoop.yarn.service.api.records.Component;
+import org.apache.hadoop.yarn.service.utils.SliderUtils;
import org.apache.hadoop.yarn.service.utils.ServiceApiUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -51,7 +51,7 @@
import java.util.Collections;
import java.util.Map;
-import static org.apache.slider.util.RestApiConstants.*;
+import static org.apache.hadoop.yarn.service.api.constants.RestApiConstants.*;
@Singleton
@Path(APPLICATIONS_API_RESOURCE_PATH)
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/webapp/ApplicationApiWebApp.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/webapp/ApplicationApiWebApp.java
index 7fc01a1..c52d205 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/webapp/ApplicationApiWebApp.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services-api/src/main/java/org/apache/hadoop/yarn/services/webapp/ApplicationApiWebApp.java
@@ -17,7 +17,7 @@
package org.apache.hadoop.yarn.services.webapp;
-import static org.apache.slider.util.RestApiConstants.*;
+import static org.apache.hadoop.yarn.service.api.constants.RestApiConstants.*;
import java.io.IOException;
import java.net.InetAddress;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/pom.xml b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/pom.xml
index 02317e5..30a1602 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/pom.xml
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/pom.xml
@@ -92,26 +92,6 @@
- org.apache.avro
- avro-maven-plugin
- ${avro.version}
-
-
- generate-sources
-
- schema
-
-
- ${project.basedir}/src/main/avro/
-
- ${project.build.directory}/generated-sources/java
-
-
-
-
-
-
- org.apache.ratapache-rat-plugin
@@ -218,11 +198,6 @@
- org.apache.avro
- avro
-
-
- org.apache.commonscommons-compress
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/avro/org/apache/slider/server/avro/RoleHistoryRecord.avsc b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/avro/org/apache/slider/server/avro/RoleHistoryRecord.avsc
deleted file mode 100644
index 3667c01..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/avro/org/apache/slider/server/avro/RoleHistoryRecord.avsc
+++ /dev/null
@@ -1,114 +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.
-
-[
-
- {
- "type": "record",
- "name": "NodeEntryRecord",
- "namespace": "org.apache.slider.server.avro",
- "fields": [
- {
- "name": "host",
- "type": "string"
- },
- {
- "name": "role",
- "type": "int"
- },
- {
- "name": "active",
- "type": "boolean"
- },
- {
- "name": "last_used",
- "type": "long"
- }
- ]
- },
-
- {
- "type": "record",
- "name": "RoleHistoryHeader",
- "namespace": "org.apache.slider.server.avro",
- "fields": [
- {
- "name": "version",
- "type": "int"
- },
- {
- "name": "saved",
- "type": "long"
- },
- {
- "name": "savedx",
- "type": "string"
- },
- {
- "name": "savedate",
- "type": "string",
- "default": ""
- },
- {
- "name": "roles",
- "type": "int"
- }
- ]
- },
- {
- "type": "record",
- "name": "RoleHistoryMapping",
- "namespace": "org.apache.slider.server.avro",
- "fields": [
- {
- "name": "rolemap",
- "type": {
- "type": "map",
- "values": "int"
- }
- }
- ]
- },
- {
- "type": "record",
- "name": "RoleHistoryFooter",
- "namespace": "org.apache.slider.server.avro",
- "fields": [
- {
- "name": "count",
- "type": "long"
- }
- ]
- },
-
- {
- "type": "record",
- "name": "RoleHistoryRecord",
- "namespace": "org.apache.slider.server.avro",
- "fields": [
- {
- "name": "entry",
- "type": [
- "org.apache.slider.server.avro.NodeEntryRecord",
- "org.apache.slider.server.avro.RoleHistoryHeader",
- "org.apache.slider.server.avro.RoleHistoryFooter",
- "org.apache.slider.server.avro.RoleHistoryMapping"
- ]
- }
- ]
- }
-
-]
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/ContainerFailureTracker.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/ContainerFailureTracker.java
index bbb4c44..815cef3 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/ContainerFailureTracker.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/ContainerFailureTracker.java
@@ -29,7 +29,7 @@
import java.util.Map;
import java.util.Set;
-import static org.apache.slider.api.ResourceKeys.NODE_FAILURE_THRESHOLD;
+import static org.apache.hadoop.yarn.service.conf.ResourceKeys.NODE_FAILURE_THRESHOLD;
/**
* This tracks the container failures per node. If the failure counter exceeds
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/ServiceContext.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/ServiceContext.java
index 80668a0..c7616af 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/ServiceContext.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/ServiceContext.java
@@ -21,9 +21,9 @@
import com.google.common.cache.LoadingCache;
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
import org.apache.hadoop.yarn.security.client.ClientToAMTokenSecretManager;
-import org.apache.slider.api.resource.Application;
-import org.apache.slider.api.resource.ConfigFile;
-import org.apache.slider.common.tools.SliderFileSystem;
+import org.apache.hadoop.yarn.service.api.records.Application;
+import org.apache.hadoop.yarn.service.api.records.ConfigFile;
+import org.apache.hadoop.yarn.service.utils.SliderFileSystem;
public class ServiceContext {
public Application application = null;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/ServiceMaster.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/ServiceMaster.java
index c22dec4..6cfd996 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/ServiceMaster.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/ServiceMaster.java
@@ -35,10 +35,11 @@
import org.apache.hadoop.yarn.exceptions.YarnException;
import org.apache.hadoop.yarn.security.client.ClientToAMTokenSecretManager;
import org.apache.hadoop.yarn.service.client.params.SliderAMArgs;
+import org.apache.hadoop.yarn.service.servicemonitor.ServiceMonitor;
import org.apache.hadoop.yarn.service.utils.ServiceApiUtil;
-import org.apache.slider.common.tools.SliderFileSystem;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.exceptions.BadClusterStateException;
+import org.apache.hadoop.yarn.service.utils.SliderFileSystem;
+import org.apache.hadoop.yarn.service.utils.SliderUtils;
+import org.apache.hadoop.yarn.service.exceptions.BadClusterStateException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/ServiceScheduler.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/ServiceScheduler.java
index 590655f..dc7ff34 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/ServiceScheduler.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/ServiceScheduler.java
@@ -54,6 +54,9 @@
import org.apache.hadoop.yarn.event.EventHandler;
import org.apache.hadoop.yarn.exceptions.YarnException;
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
+import org.apache.hadoop.yarn.service.api.constants.ServiceApiConstants;
+import org.apache.hadoop.yarn.service.api.records.Application;
+import org.apache.hadoop.yarn.service.api.records.ConfigFile;
import org.apache.hadoop.yarn.service.compinstance.ComponentInstance;
import org.apache.hadoop.yarn.service.compinstance.ComponentInstanceEvent;
import org.apache.hadoop.yarn.service.compinstance.ComponentInstanceEventType;
@@ -61,19 +64,15 @@
import org.apache.hadoop.yarn.service.component.ComponentEvent;
import org.apache.hadoop.yarn.service.component.ComponentEventType;
import org.apache.hadoop.yarn.service.conf.SliderKeys;
+import org.apache.hadoop.yarn.service.containerlaunch.ContainerLaunchService;
import org.apache.hadoop.yarn.service.metrics.ServiceMetrics;
import org.apache.hadoop.yarn.service.provider.ProviderUtils;
+import org.apache.hadoop.yarn.service.registry.YarnRegistryViewForProviders;
import org.apache.hadoop.yarn.service.timelineservice.ServiceMetricsSink;
import org.apache.hadoop.yarn.service.timelineservice.ServiceTimelinePublisher;
import org.apache.hadoop.yarn.service.utils.ServiceApiUtil;
+import org.apache.hadoop.yarn.service.utils.ZKIntegration;
import org.apache.hadoop.yarn.util.BoundedAppender;
-import org.apache.slider.api.RoleKeys;
-import org.apache.slider.api.ServiceApiConstants;
-import org.apache.slider.api.resource.Application;
-import org.apache.slider.api.resource.ConfigFile;
-import org.apache.slider.core.registry.info.CustomRegistryConstants;
-import org.apache.slider.core.zk.ZKIntegration;
-import org.apache.slider.server.services.yarnregistry.YarnRegistryViewForProviders;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -93,8 +92,8 @@
import static org.apache.hadoop.fs.FileSystem.FS_DEFAULT_NAME_KEY;
import static org.apache.hadoop.registry.client.api.RegistryConstants.*;
+import static org.apache.hadoop.yarn.service.api.constants.ServiceApiConstants.*;
import static org.apache.hadoop.yarn.service.component.ComponentEventType.*;
-import static org.apache.slider.api.ServiceApiConstants.*;
/**
*
@@ -236,7 +235,8 @@ public void serviceStop() throws Exception {
DefaultMetricsSystem.shutdown();
if (YarnConfiguration.timelineServiceV2Enabled(getConfig())) {
- serviceTimelinePublisher.serviceAttemptUnregistered(context);
+ serviceTimelinePublisher
+ .serviceAttemptUnregistered(context, diagnostics.toString());
}
// Cleanup each component instance. no need to release containers as
// they will be automatically released by RM
@@ -345,11 +345,11 @@ protected void registerServiceInstance(ApplicationAttemptId attemptId,
attemptId.getApplicationId().toString());
serviceRecord.set(YarnRegistryAttributes.YARN_PERSISTENCE,
PersistencePolicies.APPLICATION);
- serviceRecord.description = "Slider Application Master";
+ serviceRecord.description = "Yarn Service Master";
serviceRecord.addExternalEndpoint(RegistryTypeUtils
- .ipcEndpoint(CustomRegistryConstants.AM_IPC_PROTOCOL,
- new InetSocketAddress(5000))); // FIXME
+ .ipcEndpoint("classpath:org.apache.hadoop.yarn.service.appmaster.ipc",
+ context.clientAMService.getBindAddress()));
// set any provided attributes
setUserProvidedServiceRecordAttributes(application.getConfiguration(),
@@ -381,8 +381,8 @@ protected void registerServiceInstance(ApplicationAttemptId attemptId,
}
private void setUserProvidedServiceRecordAttributes(
- org.apache.slider.api.resource.Configuration conf, ServiceRecord record) {
- String prefix = RoleKeys.SERVICE_RECORD_ATTRIBUTE_PREFIX;
+ org.apache.hadoop.yarn.service.api.records.Configuration conf, ServiceRecord record) {
+ String prefix = "service.record.attribute";
for (Map.Entry entry : conf.getProperties().entrySet()) {
if (entry.getKey().startsWith(prefix)) {
String key = entry.getKey().substring(prefix.length() + 1);
@@ -395,10 +395,10 @@ private void createAllComponents() {
long allocateId = 0;
// sort components by dependencies
- Collection sortedComponents =
+ Collection sortedComponents =
ServiceApiUtil.sortByDependencies(app.getComponents());
- for (org.apache.slider.api.resource.Component compSpec : sortedComponents) {
+ for (org.apache.hadoop.yarn.service.api.records.Component compSpec : sortedComponents) {
Component component = new Component(compSpec, allocateId, context);
componentsById.put(allocateId, component);
componentsByName.put(component.getName(), component);
@@ -517,7 +517,7 @@ public void onContainersUpdated(List containers) {
@Override public float getProgress() {
// get running containers over desired containers
long total = 0;
- for (org.apache.slider.api.resource.Component component : app
+ for (org.apache.hadoop.yarn.service.api.records.Component component : app
.getComponents()) {
total += component.getNumberOfContainers();
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/util/RestApiConstants.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/constants/RestApiConstants.java
similarity index 97%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/util/RestApiConstants.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/constants/RestApiConstants.java
index daaf0e9..ab029dd 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/util/RestApiConstants.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/constants/RestApiConstants.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.slider.util;
+package org.apache.hadoop.yarn.service.api.constants;
public interface RestApiConstants {
String CONTEXT_ROOT = "/services/v1";
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/util/RestApiErrorMessages.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/constants/RestApiErrorMessages.java
similarity index 98%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/util/RestApiErrorMessages.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/constants/RestApiErrorMessages.java
index 74f7e06..e9d3edc 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/util/RestApiErrorMessages.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/constants/RestApiErrorMessages.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.slider.util;
+package org.apache.hadoop.yarn.service.api.constants;
public interface RestApiErrorMessages {
String ERROR_APPLICATION_NAME_INVALID =
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/ServiceApiConstants.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/constants/ServiceApiConstants.java
similarity index 97%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/ServiceApiConstants.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/constants/ServiceApiConstants.java
index fa21211..cf9e31f 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/ServiceApiConstants.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/constants/ServiceApiConstants.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.api;
+package org.apache.hadoop.yarn.service.api.constants;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/Application.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/Application.java
similarity index 99%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/Application.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/Application.java
index 626efb8..c999b0f 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/Application.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/Application.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.api.resource;
+package org.apache.hadoop.yarn.service.api.records;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/ApplicationState.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/ApplicationState.java
similarity index 95%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/ApplicationState.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/ApplicationState.java
index 6827c16..4a5bd89 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/ApplicationState.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/ApplicationState.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.slider.api.resource;
+package org.apache.hadoop.yarn.service.api.records;
import io.swagger.annotations.ApiModel;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/ApplicationStatus.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/ApplicationStatus.java
similarity index 98%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/ApplicationStatus.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/ApplicationStatus.java
index 06960a8..e8fbb73 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/ApplicationStatus.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/ApplicationStatus.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.slider.api.resource;
+package org.apache.hadoop.yarn.service.api.records;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/Artifact.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/Artifact.java
similarity index 98%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/Artifact.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/Artifact.java
index f274d7d..6ddd8dc 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/Artifact.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/Artifact.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.slider.api.resource;
+package org.apache.hadoop.yarn.service.api.records;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/BaseResource.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/BaseResource.java
similarity index 96%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/BaseResource.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/BaseResource.java
index a23c1fb..411b617 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/BaseResource.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/BaseResource.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.slider.api.resource;
+package org.apache.hadoop.yarn.service.api.records;
import java.io.Serializable;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/Component.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/Component.java
similarity index 99%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/Component.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/Component.java
index c15f82c..9ab29f3 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/Component.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/Component.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.slider.api.resource;
+package org.apache.hadoop.yarn.service.api.records;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/ConfigFile.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/ConfigFile.java
similarity index 99%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/ConfigFile.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/ConfigFile.java
index b4040b6..ace0150 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/ConfigFile.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/ConfigFile.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.slider.api.resource;
+package org.apache.hadoop.yarn.service.api.records;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/docstore/ConfigFormat.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/ConfigFormat.java
similarity index 96%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/docstore/ConfigFormat.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/ConfigFormat.java
index 081688b..bf3b349 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/docstore/ConfigFormat.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/ConfigFormat.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.core.registry.docstore;
+package org.apache.hadoop.yarn.service.api.records;
import java.util.Locale;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/Configuration.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/Configuration.java
similarity index 98%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/Configuration.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/Configuration.java
index e89306c..395e62c 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/Configuration.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/Configuration.java
@@ -15,14 +15,14 @@
* limitations under the License.
*/
-package org.apache.slider.api.resource;
+package org.apache.hadoop.yarn.service.api.records;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.apache.commons.lang.StringUtils;
-import org.apache.slider.common.tools.SliderUtils;
+import org.apache.hadoop.yarn.service.utils.SliderUtils;
import java.io.Serializable;
import java.util.ArrayList;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/Container.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/Container.java
similarity index 99%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/Container.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/Container.java
index c5dc627..9a070d5 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/Container.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/Container.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.slider.api.resource;
+package org.apache.hadoop.yarn.service.api.records;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/ContainerState.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/ContainerState.java
similarity index 94%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/ContainerState.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/ContainerState.java
index cd1ef4a..be054d1 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/ContainerState.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/ContainerState.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.slider.api.resource;
+package org.apache.hadoop.yarn.service.api.records;
/**
* The current state of the container of an application.
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/Error.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/Error.java
similarity index 98%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/Error.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/Error.java
index 3cf9b29..8fb396b 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/Error.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/Error.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.slider.api.resource;
+package org.apache.hadoop.yarn.service.api.records;
import io.swagger.annotations.ApiModelProperty;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/PlacementPolicy.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/PlacementPolicy.java
similarity index 98%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/PlacementPolicy.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/PlacementPolicy.java
index 306338f..8d370fc 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/PlacementPolicy.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/PlacementPolicy.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.slider.api.resource;
+package org.apache.hadoop.yarn.service.api.records;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/ReadinessCheck.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/ReadinessCheck.java
similarity index 99%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/ReadinessCheck.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/ReadinessCheck.java
index b3c85bd..2b3d134 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/ReadinessCheck.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/ReadinessCheck.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.slider.api.resource;
+package org.apache.hadoop.yarn.service.api.records;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/Resource.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/Resource.java
similarity index 99%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/Resource.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/Resource.java
index 314dfbb..57c10bc 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/resource/Resource.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/api/records/Resource.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.slider.api.resource;
+package org.apache.hadoop.yarn.service.api.records;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/ServiceCLI.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/ServiceCLI.java
index 5574ebd..5807c41 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/ServiceCLI.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/ServiceCLI.java
@@ -20,7 +20,7 @@
import org.apache.commons.lang.StringUtils;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
-import org.apache.slider.api.resource.Application;
+import org.apache.hadoop.yarn.service.api.records.Application;
import org.apache.hadoop.yarn.service.client.params.ClientArgs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/ServiceClient.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/ServiceClient.java
index 0ed4860..5142b41 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/ServiceClient.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/ServiceClient.java
@@ -58,6 +58,9 @@
import org.apache.hadoop.yarn.proto.ClientAMProtocol.StopRequestProto;
import org.apache.hadoop.yarn.service.ClientAMProtocol;
import org.apache.hadoop.yarn.service.ServiceMaster;
+import org.apache.hadoop.yarn.service.api.records.Application;
+import org.apache.hadoop.yarn.service.api.records.Component;
+import org.apache.hadoop.yarn.service.client.params.AbstractClusterBuildingActionArgs;
import org.apache.hadoop.yarn.service.client.params.ActionDependencyArgs;
import org.apache.hadoop.yarn.service.client.params.ActionFlexArgs;
import org.apache.hadoop.yarn.service.client.params.Arguments;
@@ -69,23 +72,20 @@
import org.apache.hadoop.yarn.service.conf.YarnServiceConf;
import org.apache.hadoop.yarn.service.provider.AbstractClientProvider;
import org.apache.hadoop.yarn.service.provider.ProviderUtils;
+import org.apache.hadoop.yarn.service.utils.ServiceApiUtil;
+import org.apache.hadoop.yarn.service.utils.SliderFileSystem;
+import org.apache.hadoop.yarn.service.utils.SliderUtils;
import org.apache.hadoop.yarn.util.Records;
import org.apache.hadoop.yarn.util.Times;
-import org.apache.slider.api.resource.Application;
-import org.apache.slider.api.resource.Component;
-import org.apache.slider.common.params.AbstractClusterBuildingActionArgs;
-import org.apache.slider.common.tools.SliderFileSystem;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.exceptions.BadClusterStateException;
-import org.apache.slider.core.exceptions.BadConfigException;
-import org.apache.slider.core.exceptions.SliderException;
-import org.apache.slider.core.exceptions.UsageException;
-import org.apache.slider.core.launch.ClasspathConstructor;
-import org.apache.slider.core.launch.JavaCommandLineBuilder;
-import org.apache.slider.core.registry.SliderRegistryUtils;
-import org.apache.slider.core.zk.ZKIntegration;
-import org.apache.slider.core.zk.ZookeeperUtils;
-import org.apache.hadoop.yarn.service.utils.ServiceApiUtil;
+import org.apache.hadoop.yarn.service.exceptions.BadClusterStateException;
+import org.apache.hadoop.yarn.service.exceptions.BadConfigException;
+import org.apache.hadoop.yarn.service.exceptions.SliderException;
+import org.apache.hadoop.yarn.service.exceptions.UsageException;
+import org.apache.hadoop.yarn.service.containerlaunch.ClasspathConstructor;
+import org.apache.hadoop.yarn.service.containerlaunch.JavaCommandLineBuilder;
+import org.apache.hadoop.yarn.service.utils.SliderRegistryUtils;
+import org.apache.hadoop.yarn.service.utils.ZKIntegration;
+import org.apache.hadoop.yarn.service.utils.ZookeeperUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -105,8 +105,7 @@
import static org.apache.hadoop.yarn.api.records.YarnApplicationState.*;
import static org.apache.hadoop.yarn.service.client.params.SliderActions.ACTION_CREATE;
import static org.apache.hadoop.yarn.service.client.params.SliderActions.ACTION_FLEX;
-import static org.apache.slider.common.Constants.HADOOP_JAAS_DEBUG;
-import static org.apache.slider.common.tools.SliderUtils.*;
+import static org.apache.hadoop.yarn.service.utils.SliderUtils.*;
public class ServiceClient extends CompositeService
implements SliderExitCodes, SliderKeys {
@@ -559,9 +558,9 @@ private String buildCommandLine(String appName, Configuration conf,
env.put("LANG", "en_US.UTF-8");
env.put("LC_ALL", "en_US.UTF-8");
env.put("LANGUAGE", "en_US.UTF-8");
- String jaas = System.getenv(HADOOP_JAAS_DEBUG);
+ String jaas = System.getenv("HADOOP_JAAS_DEBUG");
if (jaas != null) {
- env.put(HADOOP_JAAS_DEBUG, jaas);
+ env.put("HADOOP_JAAS_DEBUG", jaas);
}
if (!UserGroupInformation.isSecurityEnabled()) {
String userName = UserGroupInformation.getCurrentUser().getUserName();
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/AbstractActionArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/AbstractActionArgs.java
index 05c6501..a61b957 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/AbstractActionArgs.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/AbstractActionArgs.java
@@ -20,10 +20,9 @@
import com.beust.jcommander.Parameter;
import org.apache.hadoop.fs.Path;
-import org.apache.slider.common.params.PathArgumentConverter;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.ErrorStrings;
-import org.apache.slider.core.exceptions.UsageException;
+import org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException;
+import org.apache.hadoop.yarn.service.exceptions.ErrorStrings;
+import org.apache.hadoop.yarn.service.exceptions.UsageException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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/hadoop/yarn/service/client/params/AbstractArgsDelegate.java
similarity index 95%
rename from 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
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/AbstractArgsDelegate.java
index ec88ca1..457e357 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/AbstractArgsDelegate.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/AbstractArgsDelegate.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.common.params;
+package org.apache.hadoop.yarn.service.client.params;
import org.apache.hadoop.yarn.service.client.params.ArgOps;
import org.apache.hadoop.yarn.service.client.params.Arguments;
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/hadoop/yarn/service/client/params/AbstractClusterBuildingActionArgs.java
similarity index 91%
rename from 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
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/AbstractClusterBuildingActionArgs.java
index 57c27e7..19712dc 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/AbstractClusterBuildingActionArgs.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/AbstractClusterBuildingActionArgs.java
@@ -16,14 +16,12 @@
* limitations under the License.
*/
-package org.apache.slider.common.params;
+package org.apache.hadoop.yarn.service.client.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 org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException;
import java.io.File;
import java.util.List;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionBuildArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionBuildArgs.java
index 28381cf..c2ff545 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionBuildArgs.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionBuildArgs.java
@@ -18,8 +18,6 @@
package org.apache.hadoop.yarn.service.client.params;
import com.beust.jcommander.Parameters;
-import org.apache.hadoop.yarn.service.client.params.SliderActions;
-import org.apache.slider.common.params.AbstractClusterBuildingActionArgs;
@Parameters(commandNames = { SliderActions.ACTION_BUILD},
commandDescription = SliderActions.DESCRIBE_ACTION_BUILD)
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/hadoop/yarn/service/client/params/ActionClientArgs.java
similarity index 97%
rename from 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
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionClientArgs.java
index 8dfde36..0097b4e 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionClientArgs.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionClientArgs.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.common.params;
+package org.apache.hadoop.yarn.service.client.params;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionCreateArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionCreateArgs.java
index 35cef5a..eecffb6 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionCreateArgs.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionCreateArgs.java
@@ -19,8 +19,6 @@
package org.apache.hadoop.yarn.service.client.params;
import com.beust.jcommander.Parameters;
-import org.apache.hadoop.yarn.service.client.params.SliderActions;
-import org.apache.slider.common.params.AbstractClusterBuildingActionArgs;
@Parameters(commandNames = { SliderActions.ACTION_CREATE},
commandDescription = SliderActions.DESCRIBE_ACTION_CREATE)
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionDependencyArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionDependencyArgs.java
index b41b2af..51e07c9 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionDependencyArgs.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionDependencyArgs.java
@@ -17,8 +17,8 @@
*/
package org.apache.hadoop.yarn.service.client.params;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.UsageException;
+import org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException;
+import org.apache.hadoop.yarn.service.exceptions.UsageException;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
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/hadoop/yarn/service/client/params/ActionDiagnosticArgs.java
similarity index 97%
rename from 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
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionDiagnosticArgs.java
index cb36961..5cc9ad7 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionDiagnosticArgs.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionDiagnosticArgs.java
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.slider.common.params;
+package org.apache.hadoop.yarn.service.client.params;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
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/hadoop/yarn/service/client/params/ActionExistsArgs.java
similarity index 97%
rename from 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
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionExistsArgs.java
index b075ce0..ba3c5a9 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionExistsArgs.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionExistsArgs.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.common.params;
+package org.apache.hadoop.yarn.service.client.params;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionFlexArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionFlexArgs.java
index fcbb803..4a0c0ed 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionFlexArgs.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionFlexArgs.java
@@ -20,7 +20,7 @@
import com.beust.jcommander.Parameters;
import com.beust.jcommander.ParametersDelegate;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
+import org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException;
import java.util.List;
import java.util.Map;
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/hadoop/yarn/service/client/params/ActionFreezeArgs.java
similarity index 91%
rename from 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
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionFreezeArgs.java
index b08e1cf..aecf0eb 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionFreezeArgs.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionFreezeArgs.java
@@ -16,13 +16,11 @@
* limitations under the License.
*/
-package org.apache.slider.common.params;
+package org.apache.hadoop.yarn.service.client.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)
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/hadoop/yarn/service/client/params/ActionHelpArgs.java
similarity index 96%
rename from 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
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionHelpArgs.java
index fc6eb4f..f80ee55 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionHelpArgs.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionHelpArgs.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.common.params;
+package org.apache.hadoop.yarn.service.client.params;
import com.beust.jcommander.Parameters;
import org.apache.hadoop.yarn.service.client.params.AbstractActionArgs;
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/hadoop/yarn/service/client/params/ActionKDiagArgs.java
similarity index 87%
rename from 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
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionKDiagArgs.java
index be370bb..b40c0bf 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionKDiagArgs.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionKDiagArgs.java
@@ -16,15 +16,13 @@
* limitations under the License.
*/
-package org.apache.slider.common.params;
+package org.apache.hadoop.yarn.service.client.params;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
-import org.apache.hadoop.yarn.service.client.params.AbstractActionArgs;
-import org.apache.hadoop.yarn.service.client.params.SliderActions;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.UsageException;
+import org.apache.hadoop.yarn.service.utils.SliderUtils;
+import org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException;
+import org.apache.hadoop.yarn.service.exceptions.UsageException;
import java.io.File;
import java.util.ArrayList;
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/hadoop/yarn/service/client/params/ActionKeytabArgs.java
similarity index 97%
rename from 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
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionKeytabArgs.java
index 7a46c66..7e51457 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionKeytabArgs.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionKeytabArgs.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.common.params;
+package org.apache.hadoop.yarn.service.client.params;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
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/ActionListArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionListArgs.java
similarity index 97%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionListArgs.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionListArgs.java
index 51bde7b..005c172 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionListArgs.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionListArgs.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.common.params;
+package org.apache.hadoop.yarn.service.client.params;
import java.util.HashSet;
import java.util.Set;
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/ActionNodesArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionNodesArgs.java
similarity index 97%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionNodesArgs.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionNodesArgs.java
index 5a0b019..e1c296c 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionNodesArgs.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionNodesArgs.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.common.params;
+package org.apache.hadoop.yarn.service.client.params;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
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/ActionRegistryArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionRegistryArgs.java
similarity index 93%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionRegistryArgs.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionRegistryArgs.java
index fb76451..ef2a76f 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionRegistryArgs.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionRegistryArgs.java
@@ -16,17 +16,14 @@
* limitations under the License.
*/
-package org.apache.slider.common.params;
+package org.apache.hadoop.yarn.service.client.params;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
-import org.apache.hadoop.yarn.service.client.params.AbstractActionArgs;
-import org.apache.hadoop.yarn.service.client.params.Arguments;
-import org.apache.hadoop.yarn.service.client.params.SliderActions;
import org.apache.hadoop.yarn.service.conf.SliderKeys;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.UsageException;
-import org.apache.slider.core.registry.docstore.ConfigFormat;
+import org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException;
+import org.apache.hadoop.yarn.service.exceptions.UsageException;
+import org.apache.hadoop.yarn.service.api.records.ConfigFormat;
import static org.apache.hadoop.yarn.service.client.params.SliderActions.ACTION_REGISTRY;
import static org.apache.hadoop.yarn.service.client.params.SliderActions.DESCRIBE_ACTION_REGISTRY;
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/ActionResolveArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionResolveArgs.java
similarity index 92%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionResolveArgs.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionResolveArgs.java
index a953bc7..65f0472 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionResolveArgs.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionResolveArgs.java
@@ -16,15 +16,13 @@
* limitations under the License.
*/
-package org.apache.slider.common.params;
+package org.apache.hadoop.yarn.service.client.params;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
import org.apache.commons.lang.StringUtils;
-import org.apache.hadoop.yarn.service.client.params.AbstractActionArgs;
-import org.apache.hadoop.yarn.service.client.params.SliderActions;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.UsageException;
+import org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException;
+import org.apache.hadoop.yarn.service.exceptions.UsageException;
import java.io.File;
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/ActionResourceArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionResourceArgs.java
similarity index 97%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionResourceArgs.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionResourceArgs.java
index 6d60ca7..b03dc92 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionResourceArgs.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionResourceArgs.java
@@ -15,7 +15,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.slider.common.params;
+package org.apache.hadoop.yarn.service.client.params;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
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/ActionStatusArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionStatusArgs.java
similarity index 96%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionStatusArgs.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionStatusArgs.java
index 5285f7b..622e77d 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionStatusArgs.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionStatusArgs.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.common.params;
+package org.apache.hadoop.yarn.service.client.params;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionThawArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionThawArgs.java
similarity index 91%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionThawArgs.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionThawArgs.java
index e8bdcad..2b90479 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionThawArgs.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionThawArgs.java
@@ -16,13 +16,11 @@
* limitations under the License.
*/
-package org.apache.slider.common.params;
+package org.apache.hadoop.yarn.service.client.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;
import java.io.File;
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/ActionTokensArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionTokensArgs.java
similarity index 88%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionTokensArgs.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionTokensArgs.java
index f1f0125..cf48513 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionTokensArgs.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionTokensArgs.java
@@ -16,14 +16,12 @@
* limitations under the License.
*/
-package org.apache.slider.common.params;
+package org.apache.hadoop.yarn.service.client.params;
import com.beust.jcommander.Parameter;
import com.beust.jcommander.Parameters;
-import org.apache.hadoop.yarn.service.client.params.AbstractActionArgs;
-import org.apache.hadoop.yarn.service.client.params.SliderActions;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.UsageException;
+import org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException;
+import org.apache.hadoop.yarn.service.exceptions.UsageException;
import java.io.File;
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/ActionUpdateArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionUpdateArgs.java
similarity index 91%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionUpdateArgs.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionUpdateArgs.java
index 830e4ee..e310f45 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionUpdateArgs.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ActionUpdateArgs.java
@@ -16,10 +16,9 @@
* limitations under the License.
*/
-package org.apache.slider.common.params;
+package org.apache.hadoop.yarn.service.client.params;
import com.beust.jcommander.Parameters;
-import org.apache.hadoop.yarn.service.client.params.SliderActions;
@Parameters(commandNames = { SliderActions.ACTION_UPDATE},
commandDescription = SliderActions.DESCRIBE_ACTION_UPDATE)
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ArgOps.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ArgOps.java
index f7b7349..00151f4 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ArgOps.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ArgOps.java
@@ -20,8 +20,8 @@
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.ErrorStrings;
+import org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException;
+import org.apache.hadoop.yarn.service.exceptions.ErrorStrings;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ClientArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ClientArgs.java
index e85db58..80fa0ab 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ClientArgs.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ClientArgs.java
@@ -21,32 +21,10 @@
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
import org.apache.hadoop.yarn.service.conf.SliderXmlConfKeys;
-import org.apache.slider.common.params.AbstractClusterBuildingActionArgs;
-import org.apache.slider.common.params.ActionAMSuicideArgs;
-import org.apache.slider.common.params.ActionClientArgs;
-import org.apache.slider.common.params.ActionDiagnosticArgs;
-import org.apache.slider.common.params.ActionExistsArgs;
-import org.apache.slider.common.params.ActionFreezeArgs;
-import org.apache.slider.common.params.ActionHelpArgs;
-import org.apache.slider.common.params.ActionKDiagArgs;
-import org.apache.slider.common.params.ActionKeytabArgs;
-import org.apache.slider.common.params.ActionKillContainerArgs;
-import org.apache.slider.common.params.ActionListArgs;
-import org.apache.slider.common.params.ActionLookupArgs;
-import org.apache.slider.common.params.ActionNodesArgs;
-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.ActionTokensArgs;
-import org.apache.slider.common.params.ActionUpdateArgs;
-import org.apache.slider.common.params.ActionUpgradeArgs;
-import org.apache.slider.common.params.ActionVersionArgs;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.ErrorStrings;
-import org.apache.slider.core.exceptions.SliderException;
+import org.apache.hadoop.yarn.service.utils.SliderUtils;
+import org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException;
+import org.apache.hadoop.yarn.service.exceptions.ErrorStrings;
+import org.apache.hadoop.yarn.service.exceptions.SliderException;
import java.util.Collection;
@@ -74,7 +52,6 @@
// Keep all of these in alphabetical order. Thanks.
// =========================================================
- private final ActionAMSuicideArgs actionAMSuicideArgs = new ActionAMSuicideArgs();
private final ActionBuildArgs actionBuildArgs = new ActionBuildArgs();
private final ActionClientArgs actionClientArgs = new ActionClientArgs();
private final ActionCreateArgs actionCreateArgs = new ActionCreateArgs();
@@ -87,10 +64,7 @@
private final ActionHelpArgs actionHelpArgs = new ActionHelpArgs();
private final ActionKDiagArgs actionKDiagArgs = new ActionKDiagArgs();
private final ActionKeytabArgs actionKeytabArgs = new ActionKeytabArgs();
- private final ActionKillContainerArgs actionKillContainerArgs =
- new ActionKillContainerArgs();
private final ActionListArgs actionListArgs = new ActionListArgs();
- private final ActionLookupArgs actionLookupArgs = new ActionLookupArgs();
private final ActionNodesArgs actionNodesArgs = new ActionNodesArgs();
private final ActionRegistryArgs actionRegistryArgs = new ActionRegistryArgs();
private final ActionResolveArgs actionResolveArgs = new ActionResolveArgs();
@@ -99,8 +73,6 @@
private final ActionThawArgs actionThawArgs = new ActionThawArgs();
private final ActionTokensArgs actionTokenArgs = new ActionTokensArgs();
private final ActionUpdateArgs actionUpdateArgs = new ActionUpdateArgs();
- private final ActionUpgradeArgs actionUpgradeArgs = new ActionUpgradeArgs();
- private final ActionVersionArgs actionVersionArgs = new ActionVersionArgs();
public ClientArgs(String[] args) {
super(args);
@@ -114,7 +86,6 @@ public ClientArgs(Collection args) {
protected void addActionArguments() {
addActions(
- actionAMSuicideArgs,
actionBuildArgs,
actionClientArgs,
actionCreateArgs,
@@ -127,9 +98,7 @@ protected void addActionArguments() {
actionHelpArgs,
actionKDiagArgs,
actionKeytabArgs,
- actionKillContainerArgs,
actionListArgs,
- actionLookupArgs,
actionNodesArgs,
actionRegistryArgs,
actionResolveArgs,
@@ -137,9 +106,7 @@ protected void addActionArguments() {
actionStatusArgs,
actionThawArgs,
actionTokenArgs,
- actionUpdateArgs,
- actionUpgradeArgs,
- actionVersionArgs
+ actionUpdateArgs
);
}
@@ -167,10 +134,6 @@ public AbstractClusterBuildingActionArgs getBuildingActionArgs() {
return buildingActionArgs;
}
- public ActionAMSuicideArgs getActionAMSuicideArgs() {
- return actionAMSuicideArgs;
- }
-
public ActionBuildArgs getActionBuildArgs() {
return actionBuildArgs;
}
@@ -187,10 +150,6 @@ public ActionUpdateArgs getActionUpdateArgs() {
return actionUpdateArgs;
}
- public ActionUpgradeArgs getActionUpgradeArgs() {
- return actionUpgradeArgs;
- }
-
public ActionCreateArgs getActionCreateArgs() {
return actionCreateArgs;
}
@@ -215,10 +174,6 @@ public ActionFreezeArgs getActionFreezeArgs() {
return actionFreezeArgs;
}
- public ActionKillContainerArgs getActionKillContainerArgs() {
- return actionKillContainerArgs;
- }
-
public ActionListArgs getActionListArgs() {
return actionListArgs;
}
@@ -227,10 +182,6 @@ public ActionNodesArgs getActionNodesArgs() {
return actionNodesArgs;
}
- public ActionLookupArgs getActionLookupArgs() {
- return actionLookupArgs;
- }
-
public ActionRegistryArgs getActionRegistryArgs() {
return actionRegistryArgs;
}
@@ -286,10 +237,6 @@ public void applyAction() throws SliderException {
bindCoreAction(actionThawArgs);
break;
- case ACTION_AM_SUICIDE:
- bindCoreAction(actionAMSuicideArgs);
- break;
-
case ACTION_CLIENT:
bindCoreAction(actionClientArgs);
break;
@@ -326,18 +273,10 @@ public void applyAction() throws SliderException {
bindCoreAction(actionKeytabArgs);
break;
- case ACTION_KILL_CONTAINER:
- bindCoreAction(actionKillContainerArgs);
- break;
-
case ACTION_LIST:
bindCoreAction(actionListArgs);
break;
- case ACTION_LOOKUP:
- bindCoreAction(actionLookupArgs);
- break;
-
case ACTION_NODES:
bindCoreAction(actionNodesArgs);
break;
@@ -366,14 +305,6 @@ public void applyAction() throws SliderException {
bindCoreAction(actionUpdateArgs);
break;
- case ACTION_UPGRADE:
- bindCoreAction(actionUpgradeArgs);
- break;
-
- case ACTION_VERSION:
- bindCoreAction(actionVersionArgs);
- break;
-
default:
throw new BadCommandArgumentsException(ErrorStrings.ERROR_UNKNOWN_ACTION
+ " " + action);
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/CommonArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/CommonArgs.java
index 3160512..199aab5 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/CommonArgs.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/CommonArgs.java
@@ -25,11 +25,11 @@
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.ErrorStrings;
-import org.apache.slider.core.exceptions.SliderException;
-import org.apache.slider.core.exceptions.UsageException;
+import org.apache.hadoop.yarn.service.utils.SliderUtils;
+import org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException;
+import org.apache.hadoop.yarn.service.exceptions.ErrorStrings;
+import org.apache.hadoop.yarn.service.exceptions.SliderException;
+import org.apache.hadoop.yarn.service.exceptions.UsageException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ComponentArgsDelegate.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ComponentArgsDelegate.java
index 0bdf58e..b6cd0a1 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ComponentArgsDelegate.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/ComponentArgsDelegate.java
@@ -19,9 +19,7 @@
package org.apache.hadoop.yarn.service.client.params;
import com.beust.jcommander.Parameter;
-import org.apache.slider.common.params.AbstractArgsDelegate;
-import org.apache.slider.common.params.DontSplitArguments;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
+import org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException;
import java.util.ArrayList;
import java.util.List;
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/DontSplitArguments.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/DontSplitArguments.java
similarity index 95%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/DontSplitArguments.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/DontSplitArguments.java
index 0344305..85de615 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/DontSplitArguments.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/DontSplitArguments.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.common.params;
+package org.apache.hadoop.yarn.service.client.params;
import com.beust.jcommander.converters.IParameterSplitter;
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/LaunchArgsAccessor.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/LaunchArgsAccessor.java
similarity index 95%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/LaunchArgsAccessor.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/LaunchArgsAccessor.java
index 7524053..bf194b6 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/LaunchArgsAccessor.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/LaunchArgsAccessor.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.common.params;
+package org.apache.hadoop.yarn.service.client.params;
import java.io.File;
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/LaunchArgsDelegate.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/LaunchArgsDelegate.java
similarity index 96%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/LaunchArgsDelegate.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/LaunchArgsDelegate.java
index bc7e94c..157fb61 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/LaunchArgsDelegate.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/LaunchArgsDelegate.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.common.params;
+package org.apache.hadoop.yarn.service.client.params;
import com.beust.jcommander.Parameter;
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/OptionArgsDelegate.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/OptionArgsDelegate.java
similarity index 94%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/OptionArgsDelegate.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/OptionArgsDelegate.java
index e63bd12..7972716 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/OptionArgsDelegate.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/OptionArgsDelegate.java
@@ -16,10 +16,10 @@
* limitations under the License.
*/
-package org.apache.slider.common.params;
+package org.apache.hadoop.yarn.service.client.params;
import com.beust.jcommander.Parameter;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
+import org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException;
import java.util.ArrayList;
import java.util.List;
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/PathArgumentConverter.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/PathArgumentConverter.java
similarity index 95%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/PathArgumentConverter.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/PathArgumentConverter.java
index ccb526c..040ac64 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/PathArgumentConverter.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/PathArgumentConverter.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.common.params;
+package org.apache.hadoop.yarn.service.client.params;
import com.beust.jcommander.converters.BaseConverter;
import org.apache.hadoop.fs.Path;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/SliderAMCreateAction.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/SliderAMCreateAction.java
index 1853229..a446665 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/SliderAMCreateAction.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/SliderAMCreateAction.java
@@ -21,10 +21,6 @@
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;
-import org.apache.slider.common.params.LaunchArgsAccessor;
-import org.apache.slider.common.params.LaunchArgsDelegate;
import java.io.File;
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/WaitArgsDelegate.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/WaitArgsDelegate.java
similarity index 96%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/WaitArgsDelegate.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/WaitArgsDelegate.java
index 1c27c01..86f3709 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/WaitArgsDelegate.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/WaitArgsDelegate.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.common.params;
+package org.apache.hadoop.yarn.service.client.params;
import com.beust.jcommander.Parameter;
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/WaitTimeAccessor.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/WaitTimeAccessor.java
similarity index 94%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/WaitTimeAccessor.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/WaitTimeAccessor.java
index 13d4d5a..f6afae6 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/WaitTimeAccessor.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/client/params/WaitTimeAccessor.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.common.params;
+package org.apache.hadoop.yarn.service.client.params;
public interface WaitTimeAccessor {
int getWaittime();
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/compinstance/ComponentInstance.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/compinstance/ComponentInstance.java
index dcb455f..982a114 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/compinstance/ComponentInstance.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/compinstance/ComponentInstance.java
@@ -36,17 +36,17 @@
import org.apache.hadoop.yarn.exceptions.YarnException;
import org.apache.hadoop.yarn.exceptions.YarnRuntimeException;
import org.apache.hadoop.yarn.service.ServiceScheduler;
+import org.apache.hadoop.yarn.service.api.records.ContainerState;
import org.apache.hadoop.yarn.service.component.Component;
import org.apache.hadoop.yarn.state.InvalidStateTransitionException;
import org.apache.hadoop.yarn.state.SingleArcTransition;
import org.apache.hadoop.yarn.state.StateMachine;
import org.apache.hadoop.yarn.state.StateMachineFactory;
import org.apache.hadoop.yarn.util.BoundedAppender;
-import org.apache.slider.api.resource.ContainerState;
-import org.apache.slider.common.tools.SliderUtils;
+import org.apache.hadoop.yarn.service.utils.SliderUtils;
import org.apache.hadoop.yarn.service.timelineservice.ServiceTimelinePublisher;
-import org.apache.slider.server.servicemonitor.ProbeStatus;
-import org.apache.slider.server.services.yarnregistry.YarnRegistryViewForProviders;
+import org.apache.hadoop.yarn.service.servicemonitor.probe.ProbeStatus;
+import org.apache.hadoop.yarn.service.registry.YarnRegistryViewForProviders;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -88,7 +88,7 @@
private volatile ContainerStatus status;
private long containerStartedTime = 0;
// This container object is used for rest API query
- private org.apache.slider.api.resource.Container containerSpec;
+ private org.apache.hadoop.yarn.service.api.records.Container containerSpec;
private static final StateMachineFactory
@@ -142,11 +142,11 @@ public ComponentInstance(Component component,
compInstance.getContainerId(), compInstance), 0, 1,
TimeUnit.SECONDS);
- org.apache.slider.api.resource.Container container =
- new org.apache.slider.api.resource.Container();
+ org.apache.hadoop.yarn.service.api.records.Container container =
+ new org.apache.hadoop.yarn.service.api.records.Container();
container.setId(compInstance.getContainerId().toString());
container.setLaunchTime(new Date());
- container.setState(org.apache.slider.api.resource.ContainerState.RUNNING_BUT_UNREADY);
+ container.setState(ContainerState.RUNNING_BUT_UNREADY);
container.setBareHost(compInstance.container.getNodeId().getHost());
container.setComponentName(compInstance.getCompInstanceName());
if (compInstance.containerSpec != null) {
@@ -290,7 +290,7 @@ public ContainerStatus getContainerStatus() {
public void updateContainerStatus(ContainerStatus status) {
this.status = status;
- org.apache.slider.api.resource.Container container =
+ org.apache.hadoop.yarn.service.api.records.Container container =
getCompSpec().getContainer(getContainerId().toString());
if (container != null) {
container.setIp(StringUtils.join(",", status.getIPs()));
@@ -330,7 +330,7 @@ public NodeId getNodeId() {
return this.container.getNodeId();
}
- public org.apache.slider.api.resource.Component getCompSpec() {
+ public org.apache.hadoop.yarn.service.api.records.Component getCompSpec() {
return component.getComponentSpec();
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/component/Component.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/component/Component.java
index bfe40c0..176828c 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/component/Component.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/component/Component.java
@@ -39,9 +39,9 @@
import org.apache.hadoop.yarn.state.StateMachine;
import org.apache.hadoop.yarn.state.StateMachineFactory;
import org.apache.hadoop.yarn.util.Apps;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.server.servicemonitor.MonitorUtils;
-import org.apache.slider.server.servicemonitor.Probe;
+import org.apache.hadoop.yarn.service.utils.SliderUtils;
+import org.apache.hadoop.yarn.service.servicemonitor.probe.MonitorUtils;
+import org.apache.hadoop.yarn.service.servicemonitor.probe.Probe;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -61,12 +61,12 @@
import static org.apache.hadoop.yarn.service.compinstance.ComponentInstanceEventType.STARTED;
import static org.apache.hadoop.yarn.service.compinstance.ComponentInstanceEventType.STOP;
import static org.apache.hadoop.yarn.service.component.ComponentState.*;
-import static org.apache.slider.api.ResourceKeys.CONTAINER_FAILURE_THRESHOLD;
+import static org.apache.hadoop.yarn.service.conf.ResourceKeys.CONTAINER_FAILURE_THRESHOLD;
public class Component implements EventHandler {
private static final Logger LOG = LoggerFactory.getLogger(Component.class);
- private org.apache.slider.api.resource.Component componentSpec;
+ private org.apache.hadoop.yarn.service.api.records.Component componentSpec;
private long allocateId;
private Priority priority;
private ServiceMetrics componentMetrics;
@@ -124,7 +124,8 @@
FLEX, new FlexComponentTransition())
.installTopology();
- public Component(org.apache.slider.api.resource.Component component,
+ public Component(
+ org.apache.hadoop.yarn.service.api.records.Component component,
long allocateId, ServiceContext context) {
this.allocateId = allocateId;
this.priority = Priority.newInstance((int) allocateId);
@@ -418,7 +419,7 @@ public int getNumDesiredInstances() {
return compInstances;
}
- public org.apache.slider.api.resource.Component getComponentSpec() {
+ public org.apache.hadoop.yarn.service.api.records.Component getComponentSpec() {
return this.componentSpec;
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/InternalKeys.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/conf/InternalKeys.java
similarity index 99%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/InternalKeys.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/conf/InternalKeys.java
index 0e3b535..e3ee6a7 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/InternalKeys.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/conf/InternalKeys.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.api;
+package org.apache.hadoop.yarn.service.conf;
/**
* Keys for internal use, go into `internal.json` and not intended for normal
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/ResourceKeys.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/conf/ResourceKeys.java
similarity index 99%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/ResourceKeys.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/conf/ResourceKeys.java
index 2f71004..fb591dc 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/ResourceKeys.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/conf/ResourceKeys.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.api;
+package org.apache.hadoop.yarn.service.conf;
/**
* These are the keys valid in resource options
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/conf/SliderExitCodes.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/conf/SliderExitCodes.java
index d63c1a4..bdef600 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/conf/SliderExitCodes.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/conf/SliderExitCodes.java
@@ -18,7 +18,7 @@
package org.apache.hadoop.yarn.service.conf;
-import org.apache.slider.core.main.LauncherExitCodes;
+import org.apache.hadoop.yarn.service.exceptions.LauncherExitCodes;
public interface SliderExitCodes extends LauncherExitCodes {
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/conf/SliderKeys.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/conf/SliderKeys.java
index e1687d2..10cc7d5 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/conf/SliderKeys.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/conf/SliderKeys.java
@@ -44,7 +44,6 @@
* 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-dep";
String SLIDER_DEPENDENCY_TAR_GZ_FILE_EXT = ".tar.gz";
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/conf/YarnServiceConf.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/conf/YarnServiceConf.java
index 9225570..476f4b4 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/conf/YarnServiceConf.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/conf/YarnServiceConf.java
@@ -18,7 +18,7 @@
package org.apache.hadoop.yarn.service.conf;
-import org.apache.slider.api.resource.Configuration;
+import org.apache.hadoop.yarn.service.api.records.Configuration;
public class YarnServiceConf {
@@ -31,7 +31,9 @@
public static final String CONTAINER_RETRY_INTERVAL = "yarn.service.container-failure.retry-interval";
/**
- * Get long value for the property
+ * Get long value for the property. First get from the userConf, if not
+ * present get from systemConf.
+ *
* @param name name of the property
* @param defaultValue default value of the property, if it is not defined in
* userConf and systemConf.
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/AbstractLauncher.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/containerlaunch/AbstractLauncher.java
similarity index 98%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/AbstractLauncher.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/containerlaunch/AbstractLauncher.java
index a3e1bf2..374c3e7 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/AbstractLauncher.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/containerlaunch/AbstractLauncher.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.core.launch;
+package org.apache.hadoop.yarn.service.containerlaunch;
import com.google.common.base.Preconditions;
import org.apache.hadoop.security.Credentials;
@@ -27,8 +27,8 @@
import org.apache.hadoop.yarn.api.records.LocalResource;
import org.apache.hadoop.yarn.util.Records;
import org.apache.hadoop.yarn.service.conf.SliderKeys;
-import org.apache.slider.common.tools.CoreFileSystem;
-import org.apache.slider.common.tools.SliderUtils;
+import org.apache.hadoop.yarn.service.utils.CoreFileSystem;
+import org.apache.hadoop.yarn.service.utils.SliderUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/ClasspathConstructor.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/containerlaunch/ClasspathConstructor.java
similarity index 97%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/ClasspathConstructor.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/containerlaunch/ClasspathConstructor.java
index 6eb4058..22b3877 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/ClasspathConstructor.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/containerlaunch/ClasspathConstructor.java
@@ -16,13 +16,13 @@
* limitations under the License.
*/
-package org.apache.slider.core.launch;
+package org.apache.hadoop.yarn.service.containerlaunch;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.util.StringUtils;
import org.apache.hadoop.yarn.api.ApplicationConstants;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
-import org.apache.slider.common.tools.SliderUtils;
+import org.apache.hadoop.yarn.service.utils.SliderUtils;
import java.util.ArrayList;
import java.util.Arrays;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/CommandLineBuilder.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/containerlaunch/CommandLineBuilder.java
similarity index 95%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/CommandLineBuilder.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/containerlaunch/CommandLineBuilder.java
index 5ab0532..d6eba54 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/CommandLineBuilder.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/containerlaunch/CommandLineBuilder.java
@@ -16,11 +16,11 @@
* limitations under the License.
*/
-package org.apache.slider.core.launch;
+package org.apache.hadoop.yarn.service.containerlaunch;
import com.google.common.base.Preconditions;
import org.apache.hadoop.yarn.api.ApplicationConstants;
-import org.apache.slider.common.tools.SliderUtils;
+import org.apache.hadoop.yarn.service.utils.SliderUtils;
import java.util.ArrayList;
import java.util.List;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/ContainerLaunchService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/containerlaunch/ContainerLaunchService.java
similarity index 91%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/ContainerLaunchService.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/containerlaunch/ContainerLaunchService.java
index 2037a3b..fcbb69b 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/ContainerLaunchService.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/containerlaunch/ContainerLaunchService.java
@@ -16,17 +16,17 @@
* limitations under the License.
*/
-package org.apache.hadoop.yarn.service;
+package org.apache.hadoop.yarn.service.containerlaunch;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.service.AbstractService;
import org.apache.hadoop.yarn.api.records.Container;
+import org.apache.hadoop.yarn.service.api.records.Component;
import org.apache.hadoop.yarn.service.compinstance.ComponentInstance;
import org.apache.hadoop.yarn.service.provider.ProviderService;
import org.apache.hadoop.yarn.service.provider.ProviderFactory;
-import org.apache.slider.api.resource.Application;
-import org.apache.slider.common.tools.SliderFileSystem;
-import org.apache.slider.core.launch.AbstractLauncher;
+import org.apache.hadoop.yarn.service.api.records.Application;
+import org.apache.hadoop.yarn.service.utils.SliderFileSystem;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -81,7 +81,7 @@ public ContainerLauncher(
}
@Override public void run() {
- org.apache.slider.api.resource.Component compSpec = instance.getCompSpec();
+ Component compSpec = instance.getCompSpec();
ProviderService provider = ProviderFactory.getProviderService(
compSpec.getArtifact());
AbstractLauncher launcher = new AbstractLauncher(fs, null);
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/CredentialUtils.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/containerlaunch/CredentialUtils.java
similarity index 99%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/CredentialUtils.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/containerlaunch/CredentialUtils.java
index 1fd49ab..54f6254 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/CredentialUtils.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/containerlaunch/CredentialUtils.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.core.launch;
+package org.apache.hadoop.yarn.service.containerlaunch;
import com.google.common.base.Preconditions;
import org.apache.hadoop.conf.Configuration;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/JavaCommandLineBuilder.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/containerlaunch/JavaCommandLineBuilder.java
similarity index 96%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/JavaCommandLineBuilder.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/containerlaunch/JavaCommandLineBuilder.java
index b8aa4c6..cbcb0d6 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/JavaCommandLineBuilder.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/containerlaunch/JavaCommandLineBuilder.java
@@ -16,16 +16,15 @@
* limitations under the License.
*/
-package org.apache.slider.core.launch;
+package org.apache.hadoop.yarn.service.containerlaunch;
import com.google.common.base.Preconditions;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.yarn.api.ApplicationConstants;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.exceptions.BadConfigException;
+import org.apache.hadoop.yarn.service.utils.SliderUtils;
+import org.apache.hadoop.yarn.service.exceptions.BadConfigException;
-import java.util.Iterator;
import java.util.Map;
/**
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/BadClusterStateException.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/exceptions/BadClusterStateException.java
similarity index 91%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/BadClusterStateException.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/exceptions/BadClusterStateException.java
index e73ce57..db9de7a 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/BadClusterStateException.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/exceptions/BadClusterStateException.java
@@ -16,8 +16,9 @@
* limitations under the License.
*/
-package org.apache.slider.core.exceptions;
+package org.apache.hadoop.yarn.service.exceptions;
+import org.apache.hadoop.yarn.service.exceptions.SliderException;
/**
* The system is in a bad state
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/BadCommandArgumentsException.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/exceptions/BadCommandArgumentsException.java
similarity index 95%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/BadCommandArgumentsException.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/exceptions/BadCommandArgumentsException.java
index 0d5d686..41e3251 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/BadCommandArgumentsException.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/exceptions/BadCommandArgumentsException.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.core.exceptions;
+package org.apache.hadoop.yarn.service.exceptions;
public class BadCommandArgumentsException extends SliderException {
public BadCommandArgumentsException(String s, Object... args) {
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/BadConfigException.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/exceptions/BadConfigException.java
similarity index 96%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/BadConfigException.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/exceptions/BadConfigException.java
index 65a8ea8..8199c3c 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/BadConfigException.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/exceptions/BadConfigException.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.core.exceptions;
+package org.apache.hadoop.yarn.service.exceptions;
/**
* An exception to raise on a bad configuration
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/ErrorStrings.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/exceptions/ErrorStrings.java
similarity index 97%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/ErrorStrings.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/exceptions/ErrorStrings.java
index 8b04969..3577b59 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/ErrorStrings.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/exceptions/ErrorStrings.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.core.exceptions;
+package org.apache.hadoop.yarn.service.exceptions;
public interface ErrorStrings {
String E_UNSTABLE_CLUSTER = "Unstable Application Instance :";
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/main/ExitCodeProvider.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/exceptions/ExitCodeProvider.java
similarity index 95%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/main/ExitCodeProvider.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/exceptions/ExitCodeProvider.java
index 503b9b9..d66b860 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/main/ExitCodeProvider.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/exceptions/ExitCodeProvider.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.core.main;
+package org.apache.hadoop.yarn.service.exceptions;
/**
* Get the exit code of an exception. Making it an interface allows
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/main/LauncherExitCodes.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/exceptions/LauncherExitCodes.java
similarity index 99%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/main/LauncherExitCodes.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/exceptions/LauncherExitCodes.java
index 83e89f0..9657536 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/main/LauncherExitCodes.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/exceptions/LauncherExitCodes.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.core.main;
+package org.apache.hadoop.yarn.service.exceptions;
/*
* Common Exit codes
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/main/ServiceLaunchException.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/exceptions/ServiceLaunchException.java
similarity index 97%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/main/ServiceLaunchException.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/exceptions/ServiceLaunchException.java
index 27813b7..e83ccbe 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/main/ServiceLaunchException.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/exceptions/ServiceLaunchException.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.core.main;
+package org.apache.hadoop.yarn.service.exceptions;
import org.apache.hadoop.yarn.exceptions.YarnException;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/SliderException.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/exceptions/SliderException.java
similarity index 95%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/SliderException.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/exceptions/SliderException.java
index 1430c5a..5b74b80 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/SliderException.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/exceptions/SliderException.java
@@ -16,10 +16,9 @@
* limitations under the License.
*/
-package org.apache.slider.core.exceptions;
+package org.apache.hadoop.yarn.service.exceptions;
import org.apache.hadoop.yarn.service.conf.SliderExitCodes;
-import org.apache.slider.core.main.ServiceLaunchException;
public class SliderException extends ServiceLaunchException implements
SliderExitCodes {
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/UsageException.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/exceptions/UsageException.java
similarity index 95%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/UsageException.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/exceptions/UsageException.java
index 8684294..3a9fa25 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/UsageException.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/exceptions/UsageException.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.core.exceptions;
+package org.apache.hadoop.yarn.service.exceptions;
/**
* Used to raise a usage exception ... this has the exit code
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/AbstractClientProvider.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/AbstractClientProvider.java
index 6c91a13..0d11be2 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/AbstractClientProvider.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/AbstractClientProvider.java
@@ -19,18 +19,12 @@
package org.apache.hadoop.yarn.service.provider;
import org.apache.commons.lang.StringUtils;
-import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.registry.client.api.RegistryOperations;
-import org.apache.slider.api.resource.Artifact;
-import org.apache.slider.api.resource.ConfigFile;
-import org.apache.slider.common.tools.SliderFileSystem;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.exceptions.SliderException;
-import org.codehaus.jettison.json.JSONObject;
-
-import java.io.File;
+import org.apache.hadoop.yarn.service.api.records.Artifact;
+import org.apache.hadoop.yarn.service.api.records.ConfigFile;
+import org.apache.hadoop.yarn.service.utils.SliderUtils;
+
import java.io.IOException;
import java.nio.file.Paths;
import java.util.HashSet;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/AbstractProviderService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/AbstractProviderService.java
index 6f9f5175..45e2aee 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/AbstractProviderService.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/AbstractProviderService.java
@@ -20,14 +20,14 @@
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.yarn.api.ApplicationConstants;
import org.apache.hadoop.yarn.service.conf.YarnServiceConf;
-import org.apache.slider.api.resource.Application;
-import org.apache.slider.api.resource.Component;
+import org.apache.hadoop.yarn.service.api.records.Application;
+import org.apache.hadoop.yarn.service.api.records.Component;
import org.apache.hadoop.yarn.service.conf.SliderKeys;
-import org.apache.slider.common.tools.SliderFileSystem;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.exceptions.SliderException;
-import org.apache.slider.core.launch.AbstractLauncher;
-import org.apache.slider.core.launch.CommandLineBuilder;
+import org.apache.hadoop.yarn.service.utils.SliderFileSystem;
+import org.apache.hadoop.yarn.service.utils.SliderUtils;
+import org.apache.hadoop.yarn.service.exceptions.SliderException;
+import org.apache.hadoop.yarn.service.containerlaunch.AbstractLauncher;
+import org.apache.hadoop.yarn.service.containerlaunch.CommandLineBuilder;
import org.apache.hadoop.yarn.service.compinstance.ComponentInstance;
import org.apache.hadoop.yarn.service.ServiceContext;
import org.slf4j.Logger;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/ProviderFactory.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/ProviderFactory.java
index b53652a..83c9961 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/ProviderFactory.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/ProviderFactory.java
@@ -19,8 +19,7 @@
package org.apache.hadoop.yarn.service.provider;
import org.apache.hadoop.yarn.service.provider.defaultImpl.DefaultProviderFactory;
-import org.apache.slider.api.resource.Artifact;
-import org.apache.slider.core.exceptions.SliderException;
+import org.apache.hadoop.yarn.service.api.records.Artifact;
import org.apache.hadoop.yarn.service.provider.docker.DockerProviderFactory;
import org.apache.hadoop.yarn.service.provider.tarball.TarballProviderFactory;
import org.slf4j.Logger;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/ProviderService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/ProviderService.java
index 306620d..9ef0176 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/ProviderService.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/ProviderService.java
@@ -19,10 +19,10 @@
package org.apache.hadoop.yarn.service.provider;
import org.apache.hadoop.conf.Configuration;
-import org.apache.slider.api.resource.Application;
-import org.apache.slider.common.tools.SliderFileSystem;
-import org.apache.slider.core.exceptions.SliderException;
-import org.apache.slider.core.launch.AbstractLauncher;
+import org.apache.hadoop.yarn.service.api.records.Application;
+import org.apache.hadoop.yarn.service.utils.SliderFileSystem;
+import org.apache.hadoop.yarn.service.exceptions.SliderException;
+import org.apache.hadoop.yarn.service.containerlaunch.AbstractLauncher;
import org.apache.hadoop.yarn.service.compinstance.ComponentInstance;
import java.io.IOException;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/ProviderUtils.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/ProviderUtils.java
index 647bfe9..1f7e9ed 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/ProviderUtils.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/ProviderUtils.java
@@ -24,30 +24,25 @@
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.permission.FsAction;
import org.apache.hadoop.fs.permission.FsPermission;
-import org.apache.hadoop.util.StringUtils;
import org.apache.hadoop.yarn.api.records.LocalResource;
import org.apache.hadoop.yarn.api.records.LocalResourceType;
-import org.apache.slider.api.ClusterNode;
-import org.apache.slider.api.ResourceKeys;
-import org.apache.slider.api.RoleKeys;
-import org.apache.slider.api.resource.Application;
-import org.apache.slider.api.resource.Component;
-import org.apache.slider.api.resource.ConfigFile;
-import org.apache.slider.api.resource.Configuration;
+import org.apache.hadoop.yarn.service.ServiceContext;
+import org.apache.hadoop.yarn.service.api.records.Application;
+import org.apache.hadoop.yarn.service.api.records.Component;
+import org.apache.hadoop.yarn.service.api.records.ConfigFile;
+import org.apache.hadoop.yarn.service.api.records.ConfigFormat;
+import org.apache.hadoop.yarn.service.api.records.Configuration;
+import org.apache.hadoop.yarn.service.compinstance.ComponentInstance;
+import org.apache.hadoop.yarn.service.conf.ResourceKeys;
import org.apache.hadoop.yarn.service.conf.SliderKeys;
import org.apache.hadoop.yarn.service.conf.SliderXmlConfKeys;
-import org.apache.slider.common.tools.SliderFileSystem;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.SliderException;
-import org.apache.slider.core.launch.AbstractLauncher;
-import org.apache.slider.core.launch.ContainerLauncher;
-import org.apache.slider.core.registry.docstore.ConfigFormat;
-import org.apache.slider.core.registry.docstore.PublishedConfiguration;
-import org.apache.slider.core.registry.docstore.PublishedConfigurationOutputter;
-import org.apache.hadoop.yarn.service.compinstance.ComponentInstance;
-import org.apache.hadoop.yarn.service.ServiceContext;
-import org.apache.slider.server.appmaster.state.StateAccessForProviders;
+import org.apache.hadoop.yarn.service.containerlaunch.AbstractLauncher;
+import org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException;
+import org.apache.hadoop.yarn.service.exceptions.SliderException;
+import org.apache.hadoop.yarn.service.utils.PublishedConfiguration;
+import org.apache.hadoop.yarn.service.utils.PublishedConfigurationOutputter;
+import org.apache.hadoop.yarn.service.utils.SliderFileSystem;
+import org.apache.hadoop.yarn.service.utils.SliderUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -55,23 +50,18 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.Collection;
import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.regex.Pattern;
-import static org.apache.slider.api.ServiceApiConstants.*;
-import static org.apache.hadoop.yarn.service.utils.ServiceApiUtil.$;
+import static org.apache.hadoop.yarn.service.api.constants.ServiceApiConstants.*;
/**
* This is a factoring out of methods handy for providers. It's bonded to a log
* at construction time.
*/
-public class ProviderUtils implements RoleKeys, SliderKeys {
+public class ProviderUtils implements SliderKeys {
protected static final Logger log =
LoggerFactory.getLogger(ProviderUtils.class);
@@ -203,7 +193,7 @@ public int getRoleResourceRequirement(String val,
* @param fileSystem file system
* @throws IOException trouble uploading to HDFS
*/
- public void localizeServiceKeytabs(ContainerLauncher launcher,
+ public void localizeServiceKeytabs(AbstractLauncher launcher,
SliderFileSystem fileSystem, Application application) throws IOException {
Configuration conf = application.getConfiguration();
@@ -434,38 +424,4 @@ private static void resolvePlainTemplateAndSaveOnHdfs(FileSystem fs,
String.valueOf(instance.getCompInstanceId().getId()));
return tokens;
}
-
- /**
- * Add ROLE_HOST tokens for substitution into config values.
- * @param tokens existing tokens
- * @param amState access to AM state
- */
- public static void addComponentHostTokens(Map tokens,
- StateAccessForProviders amState) {
- if (amState == null) {
- return;
- }
- for (Map.Entry> entry :
- amState.getRoleClusterNodeMapping().entrySet()) {
- String tokenName = entry.getKey().toUpperCase(Locale.ENGLISH) + "_HOST";
- String hosts = StringUtils .join(",",
- getHostsList(entry.getValue().values(), true));
- tokens.put($(tokenName), hosts);
- }
- }
-
- /**
- * Return a list of hosts based on current ClusterNodes.
- * @param values cluster nodes
- * @param hostOnly whether host or host/server name will be added to list
- * @return list of hosts
- */
- public static Iterable getHostsList(Collection values,
- boolean hostOnly) {
- List hosts = new ArrayList<>();
- for (ClusterNode cn : values) {
- hosts.add(hostOnly ? cn.host : cn.host + "/" + cn.name);
- }
- return hosts;
- }
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/defaultImpl/DefaultClientProvider.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/defaultImpl/DefaultClientProvider.java
index 32cedb6..0920a9c 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/defaultImpl/DefaultClientProvider.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/defaultImpl/DefaultClientProvider.java
@@ -19,8 +19,8 @@
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.yarn.service.provider.AbstractClientProvider;
-import org.apache.slider.api.resource.Artifact;
-import org.apache.slider.api.resource.ConfigFile;
+import org.apache.hadoop.yarn.service.api.records.Artifact;
+import org.apache.hadoop.yarn.service.api.records.ConfigFile;
import java.io.IOException;
import java.nio.file.Paths;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/defaultImpl/DefaultProviderService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/defaultImpl/DefaultProviderService.java
index a77214c..33f8278 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/defaultImpl/DefaultProviderService.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/defaultImpl/DefaultProviderService.java
@@ -19,9 +19,9 @@
import org.apache.hadoop.yarn.service.compinstance.ComponentInstance;
import org.apache.hadoop.yarn.service.provider.AbstractProviderService;
-import org.apache.slider.api.resource.Application;
-import org.apache.slider.common.tools.SliderFileSystem;
-import org.apache.slider.core.launch.AbstractLauncher;
+import org.apache.hadoop.yarn.service.api.records.Application;
+import org.apache.hadoop.yarn.service.utils.SliderFileSystem;
+import org.apache.hadoop.yarn.service.containerlaunch.AbstractLauncher;
import java.io.IOException;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/docker/DockerClientProvider.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/docker/DockerClientProvider.java
index c1f225c..87cbec4 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/docker/DockerClientProvider.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/docker/DockerClientProvider.java
@@ -19,11 +19,11 @@
import org.apache.commons.lang.StringUtils;
import org.apache.hadoop.fs.FileSystem;
-import org.apache.slider.api.resource.Artifact;
-import org.apache.slider.api.resource.ConfigFile;
+import org.apache.hadoop.yarn.service.api.records.Artifact;
+import org.apache.hadoop.yarn.service.api.records.ConfigFile;
import org.apache.hadoop.yarn.service.conf.SliderKeys;
import org.apache.hadoop.yarn.service.provider.AbstractClientProvider;
-import org.apache.slider.util.RestApiErrorMessages;
+import org.apache.hadoop.yarn.service.api.constants.RestApiErrorMessages;
import java.io.IOException;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/docker/DockerProviderService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/docker/DockerProviderService.java
index c20eaad..236ddd9 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/docker/DockerProviderService.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/docker/DockerProviderService.java
@@ -21,9 +21,9 @@
import org.apache.hadoop.registry.client.binding.RegistryUtils;
import org.apache.hadoop.yarn.service.compinstance.ComponentInstance;
import org.apache.hadoop.yarn.service.provider.AbstractProviderService;
-import org.apache.slider.api.resource.Application;
-import org.apache.slider.common.tools.SliderFileSystem;
-import org.apache.slider.core.launch.AbstractLauncher;
+import org.apache.hadoop.yarn.service.api.records.Application;
+import org.apache.hadoop.yarn.service.utils.SliderFileSystem;
+import org.apache.hadoop.yarn.service.containerlaunch.AbstractLauncher;
import java.io.IOException;
import java.text.MessageFormat;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/tarball/TarballClientProvider.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/tarball/TarballClientProvider.java
index 2b54be9..438a2b7 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/tarball/TarballClientProvider.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/tarball/TarballClientProvider.java
@@ -20,11 +20,11 @@
import org.apache.commons.lang.StringUtils;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
-import org.apache.slider.api.resource.Artifact;
-import org.apache.slider.api.resource.ConfigFile;
+import org.apache.hadoop.yarn.service.api.records.Artifact;
+import org.apache.hadoop.yarn.service.api.records.ConfigFile;
import org.apache.hadoop.yarn.service.conf.SliderKeys;
import org.apache.hadoop.yarn.service.provider.AbstractClientProvider;
-import org.apache.slider.util.RestApiErrorMessages;
+import org.apache.hadoop.yarn.service.api.constants.RestApiErrorMessages;
import java.io.IOException;
import java.nio.file.Paths;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/tarball/TarballProviderService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/tarball/TarballProviderService.java
index 3c3d425..2403255 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/tarball/TarballProviderService.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/provider/tarball/TarballProviderService.java
@@ -22,9 +22,9 @@
import org.apache.hadoop.yarn.api.records.LocalResourceType;
import org.apache.hadoop.yarn.service.compinstance.ComponentInstance;
import org.apache.hadoop.yarn.service.provider.AbstractProviderService;
-import org.apache.slider.api.resource.Application;
-import org.apache.slider.common.tools.SliderFileSystem;
-import org.apache.slider.core.launch.AbstractLauncher;
+import org.apache.hadoop.yarn.service.api.records.Application;
+import org.apache.hadoop.yarn.service.utils.SliderFileSystem;
+import org.apache.hadoop.yarn.service.containerlaunch.AbstractLauncher;
import java.io.IOException;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/info/CustomRegistryConstants.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/registry/CustomRegistryConstants.java
similarity index 97%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/info/CustomRegistryConstants.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/registry/CustomRegistryConstants.java
index 13ad5c5..56634f6 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/info/CustomRegistryConstants.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/registry/CustomRegistryConstants.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.core.registry.info;
+package org.apache.hadoop.yarn.service.registry;
/**
* These are constants unique to the Slider AM
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/services/yarnregistry/YarnRegistryViewForProviders.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/registry/YarnRegistryViewForProviders.java
similarity index 97%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/services/yarnregistry/YarnRegistryViewForProviders.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/registry/YarnRegistryViewForProviders.java
index 76ce7a5..ef5ed91 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/services/yarnregistry/YarnRegistryViewForProviders.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/registry/YarnRegistryViewForProviders.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.server.services.yarnregistry;
+package org.apache.hadoop.yarn.service.registry;
import com.google.common.base.Preconditions;
import org.apache.commons.logging.Log;
@@ -30,9 +30,8 @@
import org.apache.hadoop.registry.client.binding.RegistryPathUtils;
import org.apache.hadoop.registry.client.types.ServiceRecord;
-import org.apache.hadoop.yarn.service.compinstance.ComponentInstance;
import org.apache.hadoop.yarn.service.compinstance.ComponentInstanceId;
-import org.apache.slider.common.tools.SliderUtils;
+import org.apache.hadoop.yarn.service.utils.SliderUtils;
import java.io.IOException;
import java.util.List;
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/hadoop/yarn/service/rest/BaseRestClient.java
similarity index 94%
rename from 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
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/rest/BaseRestClient.java
index d936a22..2d01bef 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/rest/BaseRestClient.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/rest/BaseRestClient.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.client.rest;
+package org.apache.hadoop.yarn.service.rest;
import com.google.common.base.Preconditions;
import com.sun.jersey.api.client.Client;
@@ -24,9 +24,6 @@
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;
@@ -141,7 +138,7 @@ public WebResource resource(URI u) {
/**
* Create a Web resource from the client.
*
- * @param u the URI of the resource.
+ * @param url the URI of the resource.
* @return the Web resource.
*/
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/ExceptionConverter.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/rest/ExceptionConverter.java
similarity index 99%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/ExceptionConverter.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/rest/ExceptionConverter.java
index efec676..12fdc79 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/ExceptionConverter.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/rest/ExceptionConverter.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.core.exceptions;
+package org.apache.hadoop.yarn.service.rest;
import com.sun.jersey.api.client.ClientHandlerException;
import com.sun.jersey.api.client.ClientResponse;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/restclient/HttpVerb.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/rest/HttpVerb.java
similarity index 97%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/restclient/HttpVerb.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/rest/HttpVerb.java
index c040345..93f9082 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/restclient/HttpVerb.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/rest/HttpVerb.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.core.restclient;
+package org.apache.hadoop.yarn.service.rest;
/**
* Http verbs with details on what they support in terms of submit and
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/restclient/SliderURLConnectionFactory.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/rest/SliderURLConnectionFactory.java
similarity index 99%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/restclient/SliderURLConnectionFactory.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/rest/SliderURLConnectionFactory.java
index e453f52..fcd7f55 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/restclient/SliderURLConnectionFactory.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/rest/SliderURLConnectionFactory.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.core.restclient;
+package org.apache.hadoop.yarn.service.rest;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hdfs.web.KerberosUgiAuthenticator;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/restclient/UgiJerseyBinding.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/rest/UgiJerseyBinding.java
similarity index 97%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/restclient/UgiJerseyBinding.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/rest/UgiJerseyBinding.java
index bf71861..b3fdef9 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/restclient/UgiJerseyBinding.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/rest/UgiJerseyBinding.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.core.restclient;
+package org.apache.hadoop.yarn.service.rest;
import com.google.common.base.Preconditions;
import com.sun.jersey.api.client.Client;
@@ -28,7 +28,6 @@
import com.sun.jersey.client.urlconnection.URLConnectionClientHandler;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.security.authentication.client.AuthenticationException;
-import org.apache.slider.core.exceptions.ExceptionConverter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/restclient/UrlConnectionOperations.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/rest/UrlConnectionOperations.java
similarity index 88%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/restclient/UrlConnectionOperations.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/rest/UrlConnectionOperations.java
index 46f0d02..d7f768e 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/restclient/UrlConnectionOperations.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/rest/UrlConnectionOperations.java
@@ -16,24 +16,17 @@
* limitations under the License.
*/
-package org.apache.slider.core.restclient;
+package org.apache.hadoop.yarn.service.rest;
import com.google.common.base.Preconditions;
-import org.apache.commons.io.IOUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
-import org.apache.hadoop.net.NetUtils;
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.security.authentication.client.AuthenticationException;
-import org.apache.hadoop.yarn.webapp.ForbiddenException;
-import org.apache.hadoop.yarn.webapp.NotFoundException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.net.ssl.SSLException;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/ServiceMonitor.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/servicemonitor/ServiceMonitor.java
similarity index 93%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/ServiceMonitor.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/servicemonitor/ServiceMonitor.java
index bc37614..b52c090 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/ServiceMonitor.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/servicemonitor/ServiceMonitor.java
@@ -16,21 +16,22 @@
* limitations under the License.
*/
-package org.apache.hadoop.yarn.service;
+package org.apache.hadoop.yarn.service.servicemonitor;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.service.AbstractService;
import org.apache.hadoop.yarn.api.records.ContainerId;
+import org.apache.hadoop.yarn.service.ServiceContext;
import org.apache.hadoop.yarn.service.component.Component;
import org.apache.hadoop.yarn.service.compinstance.ComponentInstance;
import org.apache.hadoop.yarn.service.conf.YarnServiceConf;
-import org.apache.slider.api.InternalKeys;
+import org.apache.hadoop.yarn.service.conf.InternalKeys;
import org.apache.hadoop.yarn.service.component.ComponentEvent;
import org.apache.hadoop.yarn.service.compinstance.ComponentInstanceEvent;
import org.apache.hadoop.yarn.service.component.ComponentState;
-import org.apache.slider.api.ResourceKeys;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.server.servicemonitor.ProbeStatus;
+import org.apache.hadoop.yarn.service.conf.ResourceKeys;
+import org.apache.hadoop.yarn.service.servicemonitor.probe.ProbeStatus;
+import org.apache.hadoop.yarn.service.utils.SliderUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/servicemonitor/HttpProbe.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/servicemonitor/probe/HttpProbe.java
similarity index 97%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/servicemonitor/HttpProbe.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/servicemonitor/probe/HttpProbe.java
index 5eba622..10c1160 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/servicemonitor/HttpProbe.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/servicemonitor/probe/HttpProbe.java
@@ -15,13 +15,13 @@
* limitations under the License.
*/
-package org.apache.slider.server.servicemonitor;
+package org.apache.hadoop.yarn.service.servicemonitor.probe;
import org.apache.commons.lang.StringUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.yarn.api.records.ContainerStatus;
import org.apache.hadoop.yarn.service.compinstance.ComponentInstance;
-import org.apache.slider.common.tools.SliderUtils;
+import org.apache.hadoop.yarn.service.utils.SliderUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/servicemonitor/LogEntryBuilder.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/servicemonitor/probe/LogEntryBuilder.java
similarity index 96%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/servicemonitor/LogEntryBuilder.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/servicemonitor/probe/LogEntryBuilder.java
index a1ad44f..b575d69 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/servicemonitor/LogEntryBuilder.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/servicemonitor/probe/LogEntryBuilder.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.slider.server.servicemonitor;
+package org.apache.hadoop.yarn.service.servicemonitor.probe;
/**
* Build up log entries for ease of splunk
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/servicemonitor/MonitorKeys.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/servicemonitor/probe/MonitorKeys.java
similarity index 97%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/servicemonitor/MonitorKeys.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/servicemonitor/probe/MonitorKeys.java
index e97ab43..f5f3d99 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/servicemonitor/MonitorKeys.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/servicemonitor/probe/MonitorKeys.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.slider.server.servicemonitor;
+package org.apache.hadoop.yarn.service.servicemonitor.probe;
/**
* Config keys for monitoring
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/servicemonitor/MonitorUtils.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/servicemonitor/probe/MonitorUtils.java
similarity index 95%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/servicemonitor/MonitorUtils.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/servicemonitor/probe/MonitorUtils.java
index 1e5c94c..46d1fdb 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/servicemonitor/MonitorUtils.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/servicemonitor/probe/MonitorUtils.java
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-package org.apache.slider.server.servicemonitor;
+package org.apache.hadoop.yarn.service.servicemonitor.probe;
-import org.apache.slider.api.resource.ReadinessCheck;
+import org.apache.hadoop.yarn.service.api.records.ReadinessCheck;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/servicemonitor/PortProbe.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/servicemonitor/probe/PortProbe.java
similarity index 95%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/servicemonitor/PortProbe.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/servicemonitor/probe/PortProbe.java
index da122da..f6cf3ae 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/servicemonitor/PortProbe.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/servicemonitor/probe/PortProbe.java
@@ -15,12 +15,11 @@
* limitations under the License.
*/
-package org.apache.slider.server.servicemonitor;
+package org.apache.hadoop.yarn.service.servicemonitor.probe;
import org.apache.hadoop.io.IOUtils;
import org.apache.hadoop.yarn.service.compinstance.ComponentInstance;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.server.appmaster.state.RoleInstance;
+import org.apache.hadoop.yarn.service.utils.SliderUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/servicemonitor/Probe.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/servicemonitor/probe/Probe.java
similarity index 95%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/servicemonitor/Probe.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/servicemonitor/probe/Probe.java
index 4809b45..b851fb7 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/servicemonitor/Probe.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/servicemonitor/probe/Probe.java
@@ -15,12 +15,11 @@
* limitations under the License.
*/
-package org.apache.slider.server.servicemonitor;
+package org.apache.hadoop.yarn.service.servicemonitor.probe;
import org.apache.commons.lang.StringUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.yarn.service.compinstance.ComponentInstance;
-import org.apache.slider.server.appmaster.state.RoleInstance;
import java.io.IOException;
import java.util.Map;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/servicemonitor/ProbeStatus.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/servicemonitor/probe/ProbeStatus.java
similarity index 98%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/servicemonitor/ProbeStatus.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/servicemonitor/probe/ProbeStatus.java
index 24668bd..7cd761c 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/servicemonitor/ProbeStatus.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/servicemonitor/probe/ProbeStatus.java
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-package org.apache.slider.server.servicemonitor;
+package org.apache.hadoop.yarn.service.servicemonitor.probe;
import java.io.Serializable;
import java.util.Date;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/timelineservice/ServiceTimelinePublisher.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/timelineservice/ServiceTimelinePublisher.java
index f115063..bc4fc52 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/timelineservice/ServiceTimelinePublisher.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/timelineservice/ServiceTimelinePublisher.java
@@ -21,24 +21,20 @@
import org.apache.hadoop.metrics2.AbstractMetric;
import org.apache.hadoop.service.CompositeService;
import org.apache.hadoop.yarn.api.records.ContainerState;
-import org.apache.hadoop.yarn.api.records.ContainerStatus;
import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
import org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntity;
import org.apache.hadoop.yarn.api.records.timelineservice.TimelineEvent;
import org.apache.hadoop.yarn.api.records.timelineservice.TimelineMetric;
import org.apache.hadoop.yarn.client.api.TimelineV2Client;
-import org.apache.hadoop.yarn.util.timeline.TimelineUtils;
-import org.apache.slider.api.resource.Application;
-import org.apache.slider.api.resource.Component;
-import org.apache.slider.api.resource.ConfigFile;
-import org.apache.slider.api.resource.Configuration;
-import org.apache.slider.api.resource.Container;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.server.appmaster.actions.ActionStopSlider;
-import org.apache.hadoop.yarn.service.compinstance.ComponentInstance;
import org.apache.hadoop.yarn.service.ServiceContext;
-import org.apache.slider.server.appmaster.state.AppState;
-import org.apache.slider.server.appmaster.state.RoleInstance;
+import org.apache.hadoop.yarn.service.api.records.Application;
+import org.apache.hadoop.yarn.service.api.records.Component;
+import org.apache.hadoop.yarn.service.api.records.ConfigFile;
+import org.apache.hadoop.yarn.service.api.records.Configuration;
+import org.apache.hadoop.yarn.service.api.records.Container;
+import org.apache.hadoop.yarn.service.compinstance.ComponentInstance;
+import org.apache.hadoop.yarn.service.utils.SliderUtils;
+import org.apache.hadoop.yarn.util.timeline.TimelineUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -50,6 +46,8 @@
import java.util.Map.Entry;
import java.util.Set;
+import static org.apache.hadoop.yarn.service.timelineservice.ServiceTimelineMetricsConstants.DIAGNOSTICS_INFO;
+
/**
* A single service that publishes all the Timeline Entities.
*/
@@ -129,12 +127,14 @@ public void serviceAttemptUpdated(Application application) {
putEntity(entity);
}
- public void serviceAttemptUnregistered(ServiceContext context) {
+ public void serviceAttemptUnregistered(ServiceContext context,
+ String diagnostics) {
TimelineEntity entity = createServiceAttemptEntity(
context.attemptId.getApplicationId().toString());
Map entityInfos = new HashMap();
entityInfos.put(ServiceTimelineMetricsConstants.STATE,
- FinalApplicationStatus.FAILED);
+ FinalApplicationStatus.ENDED);
+ entityInfos.put(DIAGNOSTICS_INFO, diagnostics);
entity.addInfo(entityInfos);
// add an event
@@ -147,39 +147,6 @@ public void serviceAttemptUnregistered(ServiceContext context) {
putEntity(entity);
}
- public void serviceAttemptUnregistered(AppState appState,
- ActionStopSlider stopAction) {
- long currentTimeMillis = System.currentTimeMillis();
-
- TimelineEntity entity =
- createServiceAttemptEntity(appState.getClusterStatus().getId());
-
- // add info
- Map entityInfos = new HashMap();
- entityInfos.put(ServiceTimelineMetricsConstants.EXIT_STATUS_CODE,
- stopAction.getExitCode());
- entityInfos.put(ServiceTimelineMetricsConstants.STATE,
- stopAction.getFinalApplicationStatus().toString());
- if (stopAction.getMessage() != null) {
- entityInfos.put(ServiceTimelineMetricsConstants.EXIT_REASON,
- stopAction.getMessage());
- }
- if (stopAction.getEx() != null) {
- entityInfos.put(ServiceTimelineMetricsConstants.DIAGNOSTICS_INFO,
- stopAction.getEx().toString());
- }
- entity.addInfo(entityInfos);
-
- // add an event
- TimelineEvent startEvent = new TimelineEvent();
- startEvent
- .setId(ServiceTimelineEvent.SERVICE_ATTEMPT_UNREGISTERED.toString());
- startEvent.setTimestamp(currentTimeMillis);
- entity.addEvent(startEvent);
-
- putEntity(entity);
- }
-
public void componentInstanceStarted(Container container,
ComponentInstance instance) {
@@ -210,29 +177,6 @@ public void componentInstanceStarted(Container container,
putEntity(entity);
}
- public void componentInstanceFinished(RoleInstance instance) {
- TimelineEntity entity = createComponentInstanceEntity(instance.id);
-
- // create info keys
- Map entityInfos = new HashMap();
- entityInfos.put(ServiceTimelineMetricsConstants.EXIT_STATUS_CODE,
- instance.exitCode);
- entityInfos.put(ServiceTimelineMetricsConstants.DIAGNOSTICS_INFO,
- instance.diagnostics);
- // TODO need to change the state based on enum value.
- entityInfos.put(ServiceTimelineMetricsConstants.STATE, "FINISHED");
- entity.addInfo(entityInfos);
-
- // add an event
- TimelineEvent startEvent = new TimelineEvent();
- startEvent
- .setId(ServiceTimelineEvent.COMPONENT_INSTANCE_UNREGISTERED.toString());
- startEvent.setTimestamp(System.currentTimeMillis());
- entity.addEvent(startEvent);
-
- putEntity(entity);
- }
-
public void componentInstanceFinished(ComponentInstance instance,
int exitCode, ContainerState state, String diagnostics) {
TimelineEntity entity = createComponentInstanceEntity(
@@ -242,7 +186,7 @@ public void componentInstanceFinished(ComponentInstance instance,
Map entityInfos = new HashMap();
entityInfos.put(ServiceTimelineMetricsConstants.EXIT_STATUS_CODE,
exitCode);
- entityInfos.put(ServiceTimelineMetricsConstants.DIAGNOSTICS_INFO, diagnostics);
+ entityInfos.put(DIAGNOSTICS_INFO, diagnostics);
entityInfos.put(ServiceTimelineMetricsConstants.STATE, state);
entity.addInfo(entityInfos);
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/persist/ApplicationReportSerDeser.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/ApplicationReportSerDeser.java
similarity index 94%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/persist/ApplicationReportSerDeser.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/ApplicationReportSerDeser.java
index a8c72ce..2607c08 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/persist/ApplicationReportSerDeser.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/ApplicationReportSerDeser.java
@@ -16,9 +16,8 @@
* limitations under the License.
*/
-package org.apache.slider.core.persist;
+package org.apache.hadoop.yarn.service.utils;
-import org.apache.slider.core.launch.SerializedApplicationReport;
import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
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/ClientRegistryBinder.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/ClientRegistryBinder.java
similarity index 99%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/ClientRegistryBinder.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/ClientRegistryBinder.java
index da37d11..86896b2 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/ClientRegistryBinder.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/ClientRegistryBinder.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.client;
+package org.apache.hadoop.yarn.service.utils;
import com.google.common.base.Preconditions;
import org.apache.hadoop.fs.PathNotFoundException;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/Comparators.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/Comparators.java
similarity index 97%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/Comparators.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/Comparators.java
index a83901b..9f0e5d4 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/Comparators.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/Comparators.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.common.tools;
+package org.apache.hadoop.yarn.service.utils;
import java.io.Serializable;
import java.util.Comparator;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/ConfigHelper.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/ConfigHelper.java
similarity index 99%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/ConfigHelper.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/ConfigHelper.java
index 64fd8ae..210123c 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/ConfigHelper.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/ConfigHelper.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.common.tools;
+package org.apache.hadoop.yarn.service.utils;
import com.google.common.base.Preconditions;
import org.apache.hadoop.conf.Configuration;
@@ -27,7 +27,7 @@
import org.apache.hadoop.io.IOUtils;
import org.apache.hadoop.yarn.service.conf.SliderKeys;
import org.apache.hadoop.yarn.service.conf.SliderXmlConfKeys;
-import org.apache.slider.core.exceptions.BadConfigException;
+import org.apache.hadoop.yarn.service.exceptions.BadConfigException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.w3c.dom.Document;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/docstore/ConfigUtils.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/ConfigUtils.java
similarity index 95%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/docstore/ConfigUtils.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/ConfigUtils.java
index 2e1615b..a969be9 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/docstore/ConfigUtils.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/ConfigUtils.java
@@ -15,10 +15,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.slider.core.registry.docstore;
+package org.apache.hadoop.yarn.service.utils;
import org.apache.hadoop.fs.Path;
-import org.apache.slider.common.tools.SliderFileSystem;
+import org.apache.hadoop.yarn.service.api.records.ConfigFormat;
+import org.apache.hadoop.yarn.service.utils.SliderFileSystem;
import java.io.IOException;
import java.util.HashMap;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/CoreFileSystem.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/CoreFileSystem.java
similarity index 76%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/CoreFileSystem.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/CoreFileSystem.java
index 43eb270..3dfefcf 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/CoreFileSystem.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/CoreFileSystem.java
@@ -16,10 +16,9 @@
* limitations under the License.
*/
-package org.apache.slider.common.tools;
+package org.apache.hadoop.yarn.service.utils;
import com.google.common.base.Preconditions;
-
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.CommonConfigurationKeys;
import org.apache.hadoop.fs.FSDataInputStream;
@@ -29,32 +28,27 @@
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.io.IOUtils;
+import org.apache.hadoop.util.VersionInfo;
import org.apache.hadoop.yarn.api.records.LocalResource;
import org.apache.hadoop.yarn.api.records.LocalResourceType;
import org.apache.hadoop.yarn.api.records.LocalResourceVisibility;
-import org.apache.hadoop.yarn.util.ConverterUtils;
-import org.apache.hadoop.yarn.util.Records;
import org.apache.hadoop.yarn.service.conf.SliderExitCodes;
import org.apache.hadoop.yarn.service.conf.SliderKeys;
import org.apache.hadoop.yarn.service.conf.SliderXmlConfKeys;
-import org.apache.slider.core.exceptions.BadClusterStateException;
-import org.apache.slider.core.exceptions.ErrorStrings;
-import org.apache.slider.core.exceptions.SliderException;
-import org.apache.slider.core.exceptions.UnknownApplicationInstanceException;
-import org.apache.slider.core.persist.Filenames;
+import org.apache.hadoop.yarn.service.exceptions.BadClusterStateException;
+import org.apache.hadoop.yarn.service.exceptions.ErrorStrings;
+import org.apache.hadoop.yarn.service.exceptions.SliderException;
+import org.apache.hadoop.yarn.util.ConverterUtils;
+import org.apache.hadoop.yarn.util.Records;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
-import java.nio.charset.Charset;
import java.util.HashMap;
import java.util.Map;
-import static org.apache.hadoop.yarn.service.conf.SliderXmlConfKeys.CLUSTER_DIRECTORY_PERMISSIONS;
-import static org.apache.hadoop.yarn.service.conf.SliderXmlConfKeys.DEFAULT_CLUSTER_DIRECTORY_PERMISSIONS;
-
public class CoreFileSystem {
private static final Logger
log = LoggerFactory.getLogger(CoreFileSystem.class);
@@ -227,25 +221,6 @@ public void createWithPermissions(Path dir, FsPermission clusterPerms) throws
}
/**
- * Get the permissions of a path
- *
- * @param path path to check
- * @return the permissions
- * @throws IOException any IO problem (including file not found)
- */
- public FsPermission getPathPermissions(Path path) throws IOException {
- FileStatus status = fileSystem.getFileStatus(path);
- return status.getPermission();
- }
-
- public FsPermission getInstanceDirectoryPermissions() {
- String clusterDirPermsOct =
- configuration.get(CLUSTER_DIRECTORY_PERMISSIONS,
- DEFAULT_CLUSTER_DIRECTORY_PERMISSIONS);
- return new FsPermission(clusterDirPermsOct);
- }
-
- /**
* Verify that the cluster directory is not present
*
* @param clustername name of the cluster
@@ -373,13 +348,8 @@ public Path getBaseApplicationPath() {
* @return the parent dir path of slider.tar.gz in HDFS
*/
public Path getDependencyPath() {
- // FIXME: 3/20/17 HDP ???????????
- String parentDir = (SliderUtils.isHdp()) ? SliderKeys.SLIDER_DEPENDENCY_HDP_PARENT_DIR
- + SliderKeys.SLIDER_DEPENDENCY_DIR
- : SliderKeys.SLIDER_DEPENDENCY_DIR;
- Path dependencyPath = new Path(String.format(parentDir,
- SliderUtils.getSliderVersion()));
- return dependencyPath;
+ String parentDir = SliderKeys.SLIDER_DEPENDENCY_DIR;
+ return new Path(String.format(parentDir, VersionInfo.getVersion()));
}
/**
@@ -400,28 +370,6 @@ public Path getHomeDirectory() {
return fileSystem.getHomeDirectory();
}
- public boolean maybeAddImagePath(Map localResources,
- Path imagePath) throws IOException {
- if (imagePath != null) {
- LocalResource resource = createAmResource(imagePath,
- LocalResourceType.ARCHIVE);
- localResources.put(SliderKeys.LOCAL_TARBALL_INSTALL_SUBDIR, resource);
- return true;
- } else {
- return false;
- }
- }
-
- public boolean maybeAddImagePath(Map localResources,
- String imagePath) throws IOException {
-
- return imagePath != null &&
- maybeAddImagePath(localResources, new Path(imagePath));
- }
-
-
-
-
/**
* Create an AM resource from the
*
@@ -580,60 +528,6 @@ public String listFSDir(Path path) throws IOException {
return builder.toString();
}
- /**
- * List all application instances persisted for this user, giving the
- * path. The instance name is the last element in the path
- * @return a possibly empty map of application instance names to paths
- */
- public Map listPersistentInstances() throws IOException {
- FileSystem fs = getFileSystem();
- Path path = new Path(getBaseApplicationPath(), SliderKeys.CLUSTER_DIRECTORY);
- log.debug("Looking for all persisted application at {}", path.toString());
- if (!fs.exists(path)) {
- // special case: no instances have ever been created
- return new HashMap(0);
- }
- FileStatus[] statuses = fs.listStatus(path);
- Map instances = new HashMap(statuses.length);
-
- // enum the child entries
- for (FileStatus status : statuses) {
- if (status.isDirectory()) {
- // for directories, look for an internal.json underneath
- Path child = status.getPath();
- Path internalJson = new Path(child, Filenames.INTERNAL);
- if (fs.exists(internalJson)) {
- // success => this is an instance
- instances.put(child.getName(), child);
- } else {
- log.info("Malformed cluster found at {}. It does not appear to be a valid persisted instance.",
- child.toString());
- }
- }
- }
- return instances;
- }
-
- public void touch(Path path, boolean overwrite) throws IOException {
- FSDataOutputStream out = null;
- try {
- out = fileSystem.create(path, overwrite);
- } finally {
- IOUtils.closeStream(out);
- }
- }
-
- public void cat(Path path, boolean overwrite, String data) throws IOException {
- FSDataOutputStream out = null;
- try {
- out = fileSystem.create(path, overwrite);
- byte[] bytes = data.getBytes(Charset.forName("UTF-8"));
- out.write(bytes);
- } finally {
- IOUtils.closeStream(out);
- }
- }
-
public String cat(Path path) throws IOException {
FileStatus status = fileSystem.getFileStatus(path);
byte[] b = new byte[(int) status.getLen()];
@@ -646,55 +540,4 @@ public String cat(Path path) throws IOException {
IOUtils.closeStream(in);
}
}
-
- /**
- * Create a path that must exist in the cluster fs
- * @param uri uri to create
- * @return the path
- * @throws SliderException if the path does not exist
- */
- public Path createPathThatMustExist(String uri) throws
- SliderException, IOException {
- Preconditions.checkNotNull(uri);
- Path path = new Path(uri);
- verifyPathExists(path);
- return path;
- }
-
- /**
- * Locate an application conf json in the FS. This includes a check to verify
- * that the file is there.
- *
- * @param clustername name of the cluster
- * @return the path to the spec.
- * @throws IOException IO problems
- * @throws SliderException if the path isn't there
- */
- public Path locateInstanceDefinition(String clustername) throws IOException,
- SliderException {
- Path clusterDirectory = buildClusterDirPath(clustername);
- Path appConfPath =
- new Path(clusterDirectory, Filenames.APPCONF);
- verifyClusterSpecExists(clustername, appConfPath);
- return appConfPath;
- }
-
- /**
- * Verify that a cluster specification exists
- * @param clustername name of the cluster (For errors only)
- * @param clusterSpecPath cluster specification path
- * @throws IOException IO problems
- * @throws SliderException if the cluster specification is not present
- */
- public void verifyClusterSpecExists(String clustername, Path clusterSpecPath)
- throws IOException,
- SliderException {
- if (!fileSystem.isFile(clusterSpecPath)) {
- log.debug("Missing specification file {}", clusterSpecPath);
- throw UnknownApplicationInstanceException.unknownInstance(
- clustername + "\n (definition not found at " + clusterSpecPath);
- }
- }
-
-
}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/Duration.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/Duration.java
similarity index 98%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/Duration.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/Duration.java
index e5fa424..6fadfd3 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/Duration.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/Duration.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.common.tools;
+package org.apache.hadoop.yarn.service.utils;
import java.io.Closeable;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/persist/JsonSerDeser.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/JsonSerDeser.java
similarity index 99%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/persist/JsonSerDeser.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/JsonSerDeser.java
index 8fe2549..7b22e3e 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/persist/JsonSerDeser.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/JsonSerDeser.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.core.persist;
+package org.apache.hadoop.yarn.service.utils;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FSDataOutputStream;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/security/KerberosDiags.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/KerberosDiags.java
similarity index 98%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/security/KerberosDiags.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/KerberosDiags.java
index 905d4b1..c0712c3 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/security/KerberosDiags.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/KerberosDiags.java
@@ -16,13 +16,17 @@
* limitations under the License.
*/
-package org.apache.hadoop.security;
+package org.apache.hadoop.yarn.service.utils;
import com.google.common.annotations.VisibleForTesting;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.io.Text;
+import org.apache.hadoop.security.Credentials;
+import org.apache.hadoop.security.SaslPropertiesResolver;
+import org.apache.hadoop.security.SecurityUtil;
+import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.security.token.Token;
import org.apache.hadoop.security.token.TokenIdentifier;
import org.apache.hadoop.util.ExitUtil;
@@ -36,7 +40,6 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.io.PrintStream;
-import java.io.PrintWriter;
import java.lang.reflect.InvocationTargetException;
import java.net.InetAddress;
import java.security.NoSuchAlgorithmException;
@@ -162,8 +165,8 @@ public boolean execute() throws Exception {
for (String env : new String[]{
"HADOOP_JAAS_DEBUG",
KRB5_CCNAME,
- HADOOP_USER_NAME,
- HADOOP_PROXY_USER,
+ "HADOOP_USER_NAME",
+ "HADOOP_PROXY_USER",
HADOOP_TOKEN_FILE_LOCATION,
}) {
printEnv(env);
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/services/utility/PatternValidator.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/PatternValidator.java
similarity index 91%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/services/utility/PatternValidator.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/PatternValidator.java
index 6ab9de6..6efa880 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/server/services/utility/PatternValidator.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/PatternValidator.java
@@ -16,9 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.server.services.utility;
-
-import org.apache.slider.server.appmaster.web.rest.RestPaths;
+package org.apache.hadoop.yarn.service.utils;
import java.util.regex.Pattern;
@@ -39,7 +37,6 @@ public PatternValidator(String pattern) {
/**
* Validate the name -restricting it to the set defined in
- * {@link RestPaths#PUBLISHED_CONFIGURATION_REGEXP}
* @param name name to validate
* @throws IllegalArgumentException if not a valid name
*/
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/PortScanner.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/PortScanner.java
similarity index 95%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/PortScanner.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/PortScanner.java
index 235d3da..2dbf37f 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/PortScanner.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/PortScanner.java
@@ -14,11 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.slider.common.tools;
+package org.apache.hadoop.yarn.service.utils;
import org.apache.hadoop.yarn.service.conf.SliderExitCodes;
-import org.apache.slider.core.exceptions.BadConfigException;
-import org.apache.slider.core.exceptions.SliderException;
+import org.apache.hadoop.yarn.service.exceptions.BadConfigException;
+import org.apache.hadoop.yarn.service.exceptions.SliderException;
import java.io.IOException;
import java.util.ArrayList;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedConfiguration.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/PublishedConfiguration.java
similarity index 96%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedConfiguration.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/PublishedConfiguration.java
index 50b522f..9d00b3c 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedConfiguration.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/PublishedConfiguration.java
@@ -16,11 +16,11 @@
* limitations under the License.
*/
-package org.apache.slider.core.registry.docstore;
+package org.apache.hadoop.yarn.service.utils;
import org.apache.hadoop.conf.Configuration;
-import org.apache.slider.common.tools.ConfigHelper;
-import org.apache.slider.core.exceptions.BadConfigException;
+import org.apache.hadoop.yarn.service.api.records.ConfigFormat;
+import org.apache.hadoop.yarn.service.exceptions.BadConfigException;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.map.ObjectMapper;
import org.codehaus.jackson.map.SerializationConfig;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedConfigurationOutputter.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/PublishedConfigurationOutputter.java
similarity index 98%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedConfigurationOutputter.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/PublishedConfigurationOutputter.java
index 4ec513c..88ecf2c 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedConfigurationOutputter.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/PublishedConfigurationOutputter.java
@@ -16,14 +16,14 @@
* limitations under the License.
*/
-package org.apache.slider.core.registry.docstore;
+package org.apache.hadoop.yarn.service.utils;
import com.google.common.base.Charsets;
import com.google.common.base.Preconditions;
import org.apache.commons.io.FileUtils;
import org.apache.commons.io.IOUtils;
import org.apache.hadoop.conf.Configuration;
-import org.apache.slider.common.tools.ConfigHelper;
+import org.apache.hadoop.yarn.service.api.records.ConfigFormat;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.DumperOptions.FlowStyle;
import org.yaml.snakeyaml.Yaml;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/SerializedApplicationReport.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/SerializedApplicationReport.java
similarity index 96%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/SerializedApplicationReport.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/SerializedApplicationReport.java
index 8e0ef5a..405f690 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/SerializedApplicationReport.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/SerializedApplicationReport.java
@@ -16,12 +16,12 @@
* limitations under the License.
*/
-package org.apache.slider.core.launch;
+package org.apache.hadoop.yarn.service.utils;
import org.apache.hadoop.yarn.api.records.ApplicationAttemptId;
import org.apache.hadoop.yarn.api.records.ApplicationReport;
import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
-import org.apache.slider.core.persist.ApplicationReportSerDeser;
+import org.apache.hadoop.yarn.service.utils.ApplicationReportSerDeser;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.codehaus.jackson.map.annotate.JsonSerialize;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/ServiceApiUtil.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/ServiceApiUtil.java
index c87c3b4..39bee74 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/ServiceApiUtil.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/ServiceApiUtil.java
@@ -25,20 +25,16 @@
import org.apache.hadoop.registry.client.api.RegistryConstants;
import org.apache.hadoop.registry.client.binding.RegistryUtils;
import org.apache.hadoop.yarn.exceptions.YarnException;
-import org.apache.slider.api.resource.Application;
-import org.apache.slider.api.resource.Artifact;
-import org.apache.slider.api.resource.Component;
-import org.apache.slider.api.resource.Configuration;
-import org.apache.slider.api.resource.Resource;
-import org.apache.slider.common.tools.SliderFileSystem;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.persist.JsonSerDeser;
+import org.apache.hadoop.yarn.service.api.records.Application;
+import org.apache.hadoop.yarn.service.api.records.Artifact;
+import org.apache.hadoop.yarn.service.api.records.Component;
+import org.apache.hadoop.yarn.service.api.records.Configuration;
+import org.apache.hadoop.yarn.service.api.records.Resource;
import org.apache.hadoop.yarn.service.provider.AbstractClientProvider;
import org.apache.hadoop.yarn.service.provider.ProviderFactory;
-import org.apache.slider.server.servicemonitor.MonitorUtils;
-import org.apache.slider.server.services.utility.PatternValidator;
-import org.apache.slider.util.RestApiConstants;
-import org.apache.slider.util.RestApiErrorMessages;
+import org.apache.hadoop.yarn.service.servicemonitor.probe.MonitorUtils;
+import org.apache.hadoop.yarn.service.api.constants.RestApiConstants;
+import org.apache.hadoop.yarn.service.api.constants.RestApiErrorMessages;
import org.codehaus.jackson.map.PropertyNamingStrategy;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/SliderFileSystem.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/SliderFileSystem.java
similarity index 97%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/SliderFileSystem.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/SliderFileSystem.java
index 40b07bd..d6d664e 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/SliderFileSystem.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/SliderFileSystem.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.common.tools;
+package org.apache.hadoop.yarn.service.utils;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/SliderRegistryUtils.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/SliderRegistryUtils.java
similarity index 97%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/SliderRegistryUtils.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/SliderRegistryUtils.java
index ac8fca5..4a9e339 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/SliderRegistryUtils.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/SliderRegistryUtils.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.core.registry;
+package org.apache.hadoop.yarn.service.utils;
import com.google.common.base.Preconditions;
import org.apache.hadoop.registry.client.binding.RegistryUtils;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/SliderUtils.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/SliderUtils.java
similarity index 80%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/SliderUtils.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/SliderUtils.java
index fc57c82..25f156e 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/SliderUtils.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/SliderUtils.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.common.tools;
+package org.apache.hadoop.yarn.service.utils;
import com.google.common.base.Preconditions;
import org.apache.commons.compress.archivers.tar.TarArchiveEntry;
@@ -37,30 +37,23 @@
import org.apache.hadoop.security.UserGroupInformation;
import org.apache.hadoop.util.ExitUtil;
import org.apache.hadoop.util.Shell;
-import org.apache.hadoop.util.VersionInfo;
import org.apache.hadoop.yarn.api.ApplicationConstants;
import org.apache.hadoop.yarn.api.records.ApplicationReport;
import org.apache.hadoop.yarn.api.records.Container;
import org.apache.hadoop.yarn.api.records.LocalResource;
-import org.apache.hadoop.yarn.api.records.NodeReport;
import org.apache.hadoop.yarn.api.records.YarnApplicationState;
import org.apache.hadoop.yarn.client.api.AMRMClient;
import org.apache.hadoop.yarn.conf.YarnConfiguration;
-import org.apache.slider.Slider;
-import org.apache.slider.api.RoleKeys;
-import org.apache.slider.api.types.ContainerInformation;
-import org.apache.hadoop.yarn.service.conf.SliderKeys;
-import org.apache.hadoop.yarn.service.conf.SliderXmlConfKeys;
import org.apache.hadoop.yarn.service.client.params.Arguments;
import org.apache.hadoop.yarn.service.client.params.SliderActions;
-import org.apache.slider.core.exceptions.BadClusterStateException;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.BadConfigException;
-import org.apache.slider.core.exceptions.SliderException;
-import org.apache.slider.core.launch.ClasspathConstructor;
-import org.apache.slider.core.main.LauncherExitCodes;
-import org.apache.slider.server.services.utility.PatternValidator;
-import org.apache.slider.server.services.workflow.ForkedProcessService;
+import org.apache.hadoop.yarn.service.conf.SliderKeys;
+import org.apache.hadoop.yarn.service.conf.SliderXmlConfKeys;
+import org.apache.hadoop.yarn.service.containerlaunch.ClasspathConstructor;
+import org.apache.hadoop.yarn.service.exceptions.BadClusterStateException;
+import org.apache.hadoop.yarn.service.exceptions.BadCommandArgumentsException;
+import org.apache.hadoop.yarn.service.exceptions.BadConfigException;
+import org.apache.hadoop.yarn.service.exceptions.LauncherExitCodes;
+import org.apache.hadoop.yarn.service.exceptions.SliderException;
import org.apache.zookeeper.server.util.KerberosUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -72,15 +65,12 @@
import java.io.FileOutputStream;
import java.io.FilenameFilter;
import java.io.IOException;
-import java.io.InputStream;
import java.io.PrintWriter;
import java.io.Serializable;
import java.io.StringWriter;
import java.net.InetSocketAddress;
import java.net.ServerSocket;
import java.net.Socket;
-import java.net.URI;
-import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLDecoder;
import java.text.DateFormat;
@@ -100,10 +90,7 @@
import java.util.Properties;
import java.util.Set;
import java.util.TimeZone;
-import java.util.TimerTask;
import java.util.TreeMap;
-import java.util.TreeSet;
-import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.regex.Pattern;
import java.util.zip.GZIPOutputStream;
@@ -714,72 +701,6 @@ public static String appReportToString(ApplicationReport r,
}
/**
- * Convert the instance details of an application to a string
- * @param name instance name
- * @param report the application report
- * @param verbose verbose output
- * @return a string
- */
- public static String instanceDetailsToString(String name,
- ApplicationReport report,
- List containers,
- String version,
- Set components,
- boolean verbose) {
- // format strings
- String staticf = "%-30s";
- String reportedf = staticf + " %10s %-42s";
- String livef = reportedf + " %s";
- StringBuilder builder = new StringBuilder(200);
- if (report == null) {
- builder.append(String.format(staticf, name));
- } else {
- // there's a report to look at
- String appId = report.getApplicationId().toString();
- String state = report.getYarnApplicationState().toString();
- if (report.getYarnApplicationState() == YarnApplicationState.RUNNING) {
- // running: there's a URL
- builder.append(
- String.format(livef, name, state, appId, report.getTrackingUrl()));
- } else {
- builder.append(String.format(reportedf, name, state, appId));
- }
- if (verbose) {
- builder.append('\n');
- builder.append(SliderUtils.appReportToString(report, "\n "));
- }
- if (containers != null) {
- builder.append('\n');
- builder.append(SliderUtils.containersToString(containers, version,
- components));
- }
- }
-
- builder.append('\n');
- return builder.toString();
- }
-
- public static String containersToString(
- List containers, String version,
- Set components) {
- String containerf = " %-28s %30s %45s %s%n";
- StringBuilder builder = new StringBuilder(512);
- builder.append("Containers:%n");
- builder.append(String.format(" %-28s %30s %45s %s%n", "Component Name",
- "App Version", "Container Id", "Container Info/Logs"));
- for (ContainerInformation container : containers) {
- if (filter(container.appVersion, version)
- || filter(container.component, components)) {
- continue;
- }
- builder.append(String.format(containerf, container.component,
- container.appVersion, container.containerId, container.host
- + SliderKeys.YARN_CONTAINER_PATH + container.containerId));
- }
- return builder.toString();
- }
-
- /**
* Filter a string value given a single filter
*
* @param value
@@ -1220,23 +1141,10 @@ public static boolean isPortAvailable(int port) {
}
}
- /**
- * Build the environment map from a role option map, finding all entries
- * beginning with "env.", adding them to a map of (prefix-removed)
- * env vars
- * @param roleOpts role options. This can be null, meaning the
- * role is undefined
- * @return a possibly empty map of environment variables.
- */
- public static Map buildEnvMap(Map roleOpts) {
- return buildEnvMap(roleOpts, null);
- }
-
-
// Build env map: key -> value;
// value will be replaced by the corresponding value in tokenMap, if any.
public static Map buildEnvMap(
- org.apache.slider.api.resource.Configuration conf,
+ org.apache.hadoop.yarn.service.api.records.Configuration conf,
Map tokenMap) {
if (tokenMap == null) {
return conf.getEnv();
@@ -1254,31 +1162,6 @@ public static boolean isPortAvailable(int port) {
return env;
}
-
- public static Map buildEnvMap(Map roleOpts,
- Map tokenMap) {
- Map env = new HashMap<>();
- if (roleOpts != null) {
- for (Map.Entry entry : roleOpts.entrySet()) {
- String key = entry.getKey();
- if (key.startsWith(RoleKeys.ENV_PREFIX)) {
- String envName = key.substring(RoleKeys.ENV_PREFIX.length());
- if (!envName.isEmpty()) {
- String value = entry.getValue();
- if (tokenMap != null) {
- for (Map.Entry token : tokenMap.entrySet()) {
- value = value.replaceAll(Pattern.quote(token.getKey()),
- token.getValue());
- }
- }
- env.put(envName, value);
- }
- }
- }
- }
- return env;
- }
-
/**
* Apply a set of command line options to a cluster role map
* @param clusterRoleMap cluster role map to merge onto
@@ -1765,47 +1648,6 @@ public static File verifyKeytabExists(Configuration siteConf,
}
/**
- * Convert an epoch time to a GMT time. This
- * uses the deprecated Date.toString() operation,
- * so is in one place to reduce the number of deprecation warnings.
- * @param time timestamp
- * @return string value as ISO-9601
- */
- @SuppressWarnings({"CallToDateToString", "deprecation"})
- public static String toGMTString(long time) {
- return new Date(time).toGMTString();
- }
-
- /**
- * Add the cluster build information; this will include Hadoop details too
- * @param info cluster info
- * @param prefix prefix for the build info
- */
- public static void addBuildInfo(Map info, String prefix) {
-
- Properties props = SliderVersionInfo.loadVersionProperties();
- info.put(prefix + "." + SliderVersionInfo.APP_BUILD_INFO, props.getProperty(
- SliderVersionInfo.APP_BUILD_INFO));
- info.put(prefix + "." + SliderVersionInfo.HADOOP_BUILD_INFO,
- props.getProperty(SliderVersionInfo.HADOOP_BUILD_INFO));
-
- info.put(prefix + "." + SliderVersionInfo.HADOOP_DEPLOYED_INFO,
- VersionInfo.getBranch() + " @" + VersionInfo.getSrcChecksum());
- }
-
- public static String propertiesToString(Properties props) {
- TreeSet keys = new TreeSet<>(props.stringPropertyNames());
- StringBuilder builder = new StringBuilder();
- for (String key : keys) {
- builder.append(key)
- .append("=")
- .append(props.getProperty(key))
- .append("\n");
- }
- return builder.toString();
- }
-
- /**
* Add a subpath to an existing URL. This extends
* the path, inserting a / between all entries
* if needed.
@@ -1827,21 +1669,6 @@ public static String appendToURL(String base, String path) {
}
/**
- * Append a list of paths, inserting "/" signs as appropriate
- * @param base base path/URL
- * @param paths subpaths
- * @return base+"/"+paths[0]+"/"+paths[1]...
- */
- public static String appendToURL(String base, String... paths) {
- String result = base;
- for (String path : paths) {
- result = appendToURL(result, path);
- }
- return result;
- }
-
-
- /**
* Truncate the given string to a maximum length provided
* with a pad (...) added to the end if expected size if more than 10.
* @param toTruncate string to truncate; may be null
@@ -1862,62 +1689,6 @@ public static String truncate(String toTruncate, int maxSize) {
}
/**
- * Get a string node label value from a node report
- * @param report node report
- * @return a single trimmed label or ""
- */
- public static String extractNodeLabel(NodeReport report) {
- Set newlabels = report.getNodeLabels();
- if (newlabels != null && !newlabels.isEmpty()) {
- return newlabels.iterator().next().trim();
- } else {
- return "";
- }
- }
-
- /**
- * Callable for async/scheduled halt
- */
- public static class DelayedHalt extends TimerTask {
- private final int status;
- private final String text;
-
- public DelayedHalt(int status, String text) {
- this.status = status;
- this.text = text;
- }
-
- @Override
- public void run() {
- try {
- ExitUtil.halt(status, text);
- //this should never be reached
- } catch (ExitUtil.HaltException e) {
- log.info("Halt failed");
- }
- }
- }
-
- /**
- * A compareTo function that converts the result of a long
- * comparision into the integer that Comparable
- * expects.
- * @param left left side
- * @param right right side
- * @return -1, 0, 1 depending on the diff
- */
- public static int compareTo(long left, long right) {
- long diff = left - right;
- if (diff < 0) {
- return -1;
- }
- if (diff > 0) {
- return 1;
- }
- return 0;
- }
-
- /**
* Given a source folder create zipped file
*
* @param srcFolder
@@ -2009,20 +1780,6 @@ public static boolean isHdp() {
return StringUtils.isNotEmpty(getHdpVersion());
}
- /**
- * Retrieve the version of the current Slider install
- *
- * @return the version string of the Slider release
- */
- public static String getSliderVersion() {
- if (isHdp()) {
- return getHdpVersion();
- } else {
- Properties props = SliderVersionInfo.loadVersionProperties();
- return props.getProperty(SliderVersionInfo.APP_VERSION);
- }
- }
-
private static void generateFileList(List fileList, File node,
File rootFolder, Boolean relative) {
generateFileList(fileList, node, rootFolder, relative, null);
@@ -2116,26 +1873,6 @@ public static void maybeVerifyWinUtilsValid() throws
}
}
- public static void verifyIsFile(String program, File exe) throws
- FileNotFoundException {
- if (!exe.isFile()) {
- throw new FileNotFoundException(program
- + " at " + exe
- + " is not a file");
-
- }
- }
-
- public static void verifyFileSize(String program,
- File exe,
- int minFileSize) throws FileNotFoundException {
- if (exe.length() < minFileSize) {
- throw new FileNotFoundException(program
- + " at " + exe
- + " is too short to be an executable");
- }
- }
-
/**
* Write bytes to a file
* @param outfile output file
@@ -2160,217 +1897,6 @@ public static void write(File outfile, byte[] data)
}
/**
- * Execute a command for a test operation
- * @param name name in error
- * @param status status code expected
- * @param timeoutMillis timeout in millis for process to finish
- * @param logger
- * @param outputString optional string to grep for (must not span a line)
- * @param commands commands @return the process
- * @throws IOException on any failure.
- */
- public static ForkedProcessService execCommand(String name,
- int status,
- long timeoutMillis,
- Logger logger,
- String outputString,
- String... commands) throws IOException, SliderException {
- Preconditions.checkArgument(isSet(name), "no name");
- Preconditions.checkArgument(commands.length > 0, "no commands");
- Preconditions.checkArgument(isSet(commands[0]), "empty command");
-
- ForkedProcessService process;
-
-
- process = new ForkedProcessService(
- name,
- new HashMap(),
- Arrays.asList(commands));
- process.setProcessLog(logger);
- process.init(new Configuration());
- String errorText = null;
- process.start();
- try {
- if (!process.waitForServiceToStop(timeoutMillis)) {
- throw new TimeoutException(
- "Process did not stop in " + timeoutMillis + "mS");
- }
- int exitCode = process.getExitCode();
- List recentOutput = process.getRecentOutput();
- if (status != exitCode) {
- // error condition
- errorText = "Expected exit code={" + status + "}, "
- + "actual exit code={" + exitCode + "}";
- } else {
- if (isSet(outputString)) {
- boolean found = false;
- for (String line : recentOutput) {
- if (line.contains(outputString)) {
- found = true;
- break;
- }
- }
- if (!found) {
- errorText = "Did not find \"" + outputString + "\""
- + " in output";
- }
- }
- }
- if (errorText == null) {
- return process;
- }
-
- } catch (TimeoutException e) {
- errorText = e.toString();
- }
- // error text: non null ==> operation failed
- log.warn(errorText);
- List recentOutput = process.getRecentOutput();
- for (String line : recentOutput) {
- log.info(line);
- }
- throw new SliderException(LauncherExitCodes.EXIT_OTHER_FAILURE,
- "Process %s failed: %s", name, errorText);
-
- }
-
-
- /**
- * Validate the slider client-side execution environment.
- * This looks for everything felt to be critical for execution, including
- * native binaries and other essential dependencies.
- * @param logger logger to log to on normal execution
- * @throws IOException on IO failures
- * @throws SliderException on validation failures
- */
- public static void validateSliderClientEnvironment(Logger logger) throws
- IOException,
- SliderException {
- maybeVerifyWinUtilsValid();
- }
-
- /**
- * Validate the slider server-side execution environment.
- * This looks for everything felt to be critical for execution, including
- * native binaries and other essential dependencies.
- * @param logger logger to log to on normal execution
- * @param dependencyChecks flag to indicate checks for agent dependencies
- * @throws IOException on IO failures
- * @throws SliderException on validation failures
- */
- public static void validateSliderServerEnvironment(Logger logger,
- boolean dependencyChecks) throws
- IOException,
- SliderException {
- maybeVerifyWinUtilsValid();
- if (dependencyChecks) {
- validatePythonEnv(logger);
- validateOpenSSLEnv(logger);
- }
- }
-
- public static void validateOpenSSLEnv(Logger logger) throws
- IOException,
- SliderException {
- execCommand(OPENSSL, 0, 5000, logger, "OpenSSL", OPENSSL, "version");
- }
-
- public static void validatePythonEnv(Logger logger) throws
- IOException,
- SliderException {
- execCommand(PYTHON, 0, 5000, logger, "Python", PYTHON, "-V");
- }
-
- /**
- * return the path to the currently running slider command
- *
- * @throws NullPointerException
- * - If the pathname argument is null
- * @throws SecurityException
- * - if a security manager exists and its checkPermission method
- * doesn't allow getting the ProtectionDomain
- */
- public static String getCurrentCommandPath() {
- File f = new File(Slider.class.getProtectionDomain().getCodeSource()
- .getLocation().getPath());
- return f.getAbsolutePath();
- }
-
- /**
- * return the path to the slider-client.xml used by the current running
- * slider command
- *
- * @throws SecurityException
- * - if a security manager exists and its checkPermission method
- * denies access to the class loader for the class
- */
- public static String getClientConfigPath() {
- URL path = ConfigHelper.class.getClassLoader().getResource(
- SliderKeys.SLIDER_CLIENT_XML);
- Preconditions.checkNotNull(path, "Failed to locate resource " + SliderKeys.SLIDER_CLIENT_XML);
- return path.toString();
- }
-
- /**
- * validate if slider-client.xml under the path can be opened
- *
- * @throws IOException
- * : the file can't be found or open
- */
- public static void validateClientConfigFile() throws IOException {
- URL resURL = SliderVersionInfo.class.getClassLoader().getResource(
- SliderKeys.SLIDER_CLIENT_XML);
- if (resURL == null) {
- throw new IOException(
- "slider-client.xml doesn't exist on the path: "
- + getClientConfigPath());
- }
-
- try {
- InputStream inStream = resURL.openStream();
- if (inStream == null) {
- throw new IOException("slider-client.xml can't be opened");
- }
- } catch (IOException e) {
- throw new IOException("slider-client.xml can't be opened: "
- + e.toString());
- }
- }
-
- /**
- * validate if a file on HDFS can be open
- *
- * @throws IOException the file can't be found or opened
- * @throws URISyntaxException
- */
- public static void validateHDFSFile(SliderFileSystem sliderFileSystem,
- String pathStr)
- throws IOException, URISyntaxException {
- try(InputStream inputStream =
- sliderFileSystem.getFileSystem().open(new Path(new URI(pathStr)))) {
- if (inputStream == null) {
- throw new IOException("HDFS file " + pathStr + " can't be opened");
- }
- }
- }
-
- /**
- * return the version and path of the JDK invoking the current running
- * slider command
- *
- * @throws SecurityException
- * - if a security manager exists and its checkPropertyAccess
- * method doesn't allow access to the specified system property.
- */
- public static String getJDKInfo() {
- String version = System.getProperty("java.version");
- String javaHome = System.getProperty("java.home");
- return
- "The version of the JDK invoking the current running slider command: "
- + version + "; The path to it is: " + javaHome;
- }
-
- /**
* Compare the times of two applications: most recent app comes first
* Specifically: the one whose start time value is greater.
*/
@@ -2522,8 +2048,8 @@ public static String createDescriptionTag(String description) {
* @param defSecs
* @return the aggregate time range in seconds
*/
- public static long getTimeRange(org.apache.slider.api.resource
- .Configuration conf,
+ public static long getTimeRange(
+ org.apache.hadoop.yarn.service.api.records.Configuration conf,
String basekey,
long defDays,
long defHours,
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/zk/ZKIntegration.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/ZKIntegration.java
similarity index 99%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/zk/ZKIntegration.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/ZKIntegration.java
index 519cd16..093ba55 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/zk/ZKIntegration.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/ZKIntegration.java
@@ -16,7 +16,7 @@
* limitations under the License.
*/
-package org.apache.slider.core.zk;
+package org.apache.hadoop.yarn.service.utils;
import org.apache.zookeeper.CreateMode;
import org.apache.zookeeper.KeeperException;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/zk/ZookeeperUtils.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/ZookeeperUtils.java
similarity index 96%
rename from hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/zk/ZookeeperUtils.java
rename to hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/ZookeeperUtils.java
index cc1b2c9..1fa07ce 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/zk/ZookeeperUtils.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/hadoop/yarn/service/utils/ZookeeperUtils.java
@@ -16,12 +16,11 @@
* limitations under the License.
*/
-package org.apache.slider.core.zk;
+package org.apache.hadoop.yarn.service.utils;
import com.google.common.net.HostAndPort;
import org.apache.hadoop.util.StringUtils;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.exceptions.BadConfigException;
+import org.apache.hadoop.yarn.service.exceptions.BadConfigException;
import java.util.ArrayList;
import java.util.List;
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/Slider.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/Slider.java
deleted file mode 100644
index 5fc8618..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/Slider.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider;
-
-import org.apache.slider.client.SliderClient;
-import org.apache.slider.core.main.ServiceLauncher;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * This is just the entry point class
- */
-public class Slider extends SliderClient {
-
-
- public static final String SERVICE_CLASSNAME = "org.apache.slider.Slider";
-
- /**
- * This is the main entry point for the service launcher.
- * @param args command line arguments.
- */
- public static void main(String[] args) {
-
- //turn the args to a list
- List argsList = Arrays.asList(args);
- //create a new list, as the ArrayList type doesn't push() on an insert
- List extendedArgs = new ArrayList(argsList);
- //insert the service name
- extendedArgs.add(0, SERVICE_CLASSNAME);
- //now have the service launcher do its work
- ServiceLauncher.serviceMain(extendedArgs);
- }
-
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/ClusterNode.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/ClusterNode.java
deleted file mode 100644
index 8b0a563..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/ClusterNode.java
+++ /dev/null
@@ -1,220 +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.api;
-
-import org.apache.hadoop.yarn.api.records.ContainerId;
-import org.apache.slider.api.proto.Messages;
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.annotate.JsonIgnore;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-
-/**
- * Describe a specific node in the cluster
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL )
-public final class ClusterNode implements Cloneable {
- protected static final Logger
- LOG = LoggerFactory.getLogger(ClusterNode.class);
-
- @JsonIgnore
- public ContainerId containerId;
-
- /**
- * server name
- */
- public String name;
-
-
- /**
- * UUID of container used in Slider RPC to refer to instances
- */
- public String id;
-
- public String role;
-
- public int roleId;
-
- public long createTime;
- public long startTime;
- /**
- * flag set when it is released, to know if it has
- * already been targeted for termination
- */
- public boolean released;
- public String host;
- public String ip;
- public String hostname;
- public String hostUrl;
-
- /**
- * state from {@link ClusterDescription}
- */
- public int state;
-
- /**
- * Exit code: only valid if the state >= STOPPED
- */
- public int exitCode;
-
- /**
- * what was the command executed?
- */
- public String command;
-
- /**
- * Any diagnostics
- */
- public String diagnostics;
-
- /**
- * What is the tail output from the executed process (or [] if not started
- * or the log cannot be picked up
- */
- public String[] output;
-
- /**
- * Any environment details
- */
- public String[] environment;
-
- /**
- * server-side ctor takes the container ID and builds the name from it
- * @param containerId container ID; can be null
- */
- public ClusterNode(ContainerId containerId) {
- if (containerId != null) {
- this.containerId = containerId;
- this.name = containerId.toString();
- }
- }
-
- /**
- * ctor for deserialization
- */
- public ClusterNode() {
- }
-
- @Override
- public String toString() {
- StringBuilder builder = new StringBuilder();
- builder.append(name).append(": ");
- builder.append(state).append("\n");
- builder.append("state: ").append(state).append("\n");
- builder.append("role: ").append(role).append("\n");
- append(builder, "host", host);
- append(builder, "hostURL", hostUrl);
- append(builder, "command", command);
- if (output != null) {
- for (String line : output) {
- builder.append(line).append("\n");
- }
- }
- append(builder, "diagnostics", diagnostics);
- return builder.toString();
- }
-
- private void append(StringBuilder builder, String key, Object val) {
- if (val != null) {
- builder.append(key).append(": ").append(val.toString()).append("\n");
- }
- }
-
- /**
- * Convert to a JSON string
- * @return a JSON string description
- * @throws IOException Problems mapping/writing the object
- */
- public String toJsonString() throws IOException {
- ObjectMapper mapper = new ObjectMapper();
- return mapper.writeValueAsString(this);
- }
-
-
- /**
- * Convert from JSON
- * @param json input
- * @return the parsed JSON
- * @throws IOException IO
- */
- public static ClusterNode fromJson(String json)
- throws IOException, JsonParseException, JsonMappingException {
- ObjectMapper mapper = new ObjectMapper();
- try {
- return mapper.readValue(json, ClusterNode.class);
- } catch (IOException e) {
- LOG.error("Exception while parsing json : {}\n{}", e , json, e);
- throw e;
- }
- }
-
- /**
- * Build from a protobuf response
- * @param message
- * @return the deserialized node
- */
- public static ClusterNode fromProtobuf(Messages.RoleInstanceState message) {
- ClusterNode node = new ClusterNode();
- node.name = message.getName();
- node.command = message.getCommand();
- node.diagnostics = message.getDiagnostics();
- String[] arr;
- int environmentCount = message.getEnvironmentCount();
- if (environmentCount > 0) {
- arr = new String[environmentCount];
- node.environment = message.getEnvironmentList().toArray(arr);
- }
- node.exitCode = message.getExitCode();
- int outputCount = message.getOutputCount();
- if (outputCount > 0) {
- arr = new String[outputCount];
- node.output = message.getOutputList().toArray(arr);
- }
- node.role = message.getRole();
- node.roleId = message.getRoleId();
- node.state = message.getState();
- node.host = message.getHost();
- node.hostUrl = message.getHostURL();
- node.createTime = message.getCreateTime();
- node.startTime = message.getStartTime();
- node.released = message.getReleased();
- return node;
- }
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
-
- public ClusterNode doClone() {
- try {
- return (ClusterNode)clone();
- } catch (CloneNotSupportedException e) {
- //not going to happen. This is a final class
- return null;
- }
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/OptionKeys.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/OptionKeys.java
deleted file mode 100644
index 988627d..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/OptionKeys.java
+++ /dev/null
@@ -1,85 +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.api;
-
-/**
- * Keys for entries in the options section
- * of a cluster description.
- */
-public interface OptionKeys extends InternalKeys {
-
- /**
- * Time in milliseconds to wait after forking any in-AM
- * process before attempting to start up the containers: {@value}
- *
- * A shorter value brings the cluster up faster, but means that if the
- * in AM process fails (due to a bad configuration), then time
- * is wasted starting containers on a cluster that isn't going to come
- * up
- */
- String APPLICATION_TYPE = "application.type";
-
- String APPLICATION_NAME = "application.name";
-
- /**
- * Prefix for site.xml options: {@value}
- */
- String SITE_XML_PREFIX = "site.";
- /**
- * Prefix for config file options: {@value}
- */
- String CONF_FILE_PREFIX = "conf.";
- /**
- * Prefix for package options: {@value}
- */
- String PKG_FILE_PREFIX = "pkg.";
- /**
- * Prefix for export options: {@value}
- */
- String EXPORT_PREFIX = "export.";
- /**
- * Type suffix for config file and package options: {@value}
- */
- String TYPE_SUFFIX = ".type";
- /**
- * Name suffix for config file and package options: {@value}
- */
- String NAME_SUFFIX = ".name";
- /**
- * Per component suffix for config file options: {@value}
- */
- String PER_COMPONENT = ".per.component";
- /**
- * Per group suffix for config file options: {@value}
- */
- String PER_GROUP = ".per.group";
-
- /**
- * Zookeeper quorum host list: {@value}
- */
- String ZOOKEEPER_QUORUM = "zookeeper.quorum";
- String ZOOKEEPER_HOSTS = "zookeeper.hosts";
- String ZOOKEEPER_PORT = "zookeeper.port";
-
- /**
- * Zookeeper path value (string): {@value}
- */
- String ZOOKEEPER_PATH = "zookeeper.path";
-
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/RoleKeys.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/RoleKeys.java
deleted file mode 100644
index ce413ff..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/RoleKeys.java
+++ /dev/null
@@ -1,121 +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.api;
-
-/**
- * Standard options for roles
- */
-public interface RoleKeys {
-
-
- /**
- * The name of a role: {@value}
- */
- String ROLE_NAME = "role.name";
-
- /**
- * The group of a role: {@value}
- */
- String ROLE_GROUP = "role.group";
-
- /**
- * The prefix of a role: {@value}
- */
- String ROLE_PREFIX = "role.prefix";
-
- /**
- * Status report: number actually granted : {@value}
- */
- String ROLE_ACTUAL_INSTANCES = "role.actual.instances";
-
- /**
- * Status report: number currently requested: {@value}
- */
- String ROLE_REQUESTED_INSTANCES = "role.requested.instances";
-
- /**
- * Status report: number currently being released: {@value}
- */
- String ROLE_RELEASING_INSTANCES = "role.releasing.instances";
-
- /**
- * Status report: total number that have failed: {@value}
- */
- String ROLE_FAILED_INSTANCES = "role.failed.instances";
-
- /**
- * Status report: number that have failed recently: {@value}
- */
- String ROLE_FAILED_RECENTLY_INSTANCES = "role.failed.recently.instances";
-
- /**
- * Status report: number that have failed for node-related issues: {@value}
- */
- String ROLE_NODE_FAILED_INSTANCES = "role.failed.node.instances";
-
- /**
- * Status report: number that been pre-empted: {@value}
- */
- String ROLE_PREEMPTED_INSTANCES = "role.failed.preempted.instances";
-
- /**
- * Number of pending anti-affine instances: {@value}
- */
- String ROLE_PENDING_AA_INSTANCES = "role.pending.aa.instances";
-
- /**
- * Status report: number currently being released: {@value}
- */
- String ROLE_FAILED_STARTING_INSTANCES = "role.failed.starting.instances";
-
- /**
- * Extra arguments (non-JVM) to use when starting this role
- */
- String ROLE_ADDITIONAL_ARGS = "role.additional.args";
-
- /**
- * JVM heap size for Java applications in MB. Only relevant for Java applications.
- * This MUST be less than or equal to the {@link ResourceKeys#YARN_MEMORY} option
- * {@value}
- */
- String JVM_HEAP = "jvm.heapsize";
-
- /*
- * GC options for Java applications.
- */
- String GC_OPTS = "gc.opts";
-
- /**
- * JVM options other than heap size. Only relevant for Java applications.
- * {@value}
- */
- String JVM_OPTS = "jvm.opts";
-
-
- /**
- * All keys w/ env. are converted into env variables and passed down
- */
- String ENV_PREFIX = "env.";
-
- /**
- * Container service record attribute prefix.
- */
- String SERVICE_RECORD_ATTRIBUTE_PREFIX = "service.record.attribute";
-
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/SliderClusterProtocol.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/SliderClusterProtocol.java
deleted file mode 100644
index aaf2f88..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/SliderClusterProtocol.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") throws IOException, YarnException; 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.api;
-
-import org.apache.hadoop.ipc.VersionedProtocol;
-import org.apache.hadoop.security.KerberosInfo;
-import org.apache.hadoop.yarn.exceptions.YarnException;
-import org.apache.slider.api.proto.Messages;
-import org.apache.hadoop.yarn.service.conf.SliderXmlConfKeys;
-
-import java.io.IOException;
-
-/**
- * Cluster protocol. This can currently act as a versioned IPC
- * endpoint or be relayed via protobuf
- */
-@KerberosInfo(serverPrincipal = SliderXmlConfKeys.KEY_KERBEROS_PRINCIPAL)
-public interface SliderClusterProtocol extends VersionedProtocol {
- long versionID = 0x01;
-
- /**
- * Stop the cluster
- */
-
- Messages.StopClusterResponseProto stopCluster(Messages.StopClusterRequestProto request) throws
- IOException, YarnException;
- /**
- * Upgrade the application containers
- *
- * @param request upgrade containers request object
- * @return upgrade containers response object
- * @throws IOException
- * @throws YarnException
- */
- Messages.UpgradeContainersResponseProto upgradeContainers(
- Messages.UpgradeContainersRequestProto request) throws IOException,
- YarnException;
-
-
- Messages.FlexComponentsResponseProto flexComponents(
- Messages.FlexComponentsRequestProto request) throws IOException;
-
- /**
- * Get the current cluster status
- */
- Messages.GetJSONClusterStatusResponseProto getJSONClusterStatus(Messages.GetJSONClusterStatusRequestProto request)
- throws IOException, YarnException;
-
-
- /**
- * List all running nodes in a role
- */
- Messages.ListNodeUUIDsByRoleResponseProto listNodeUUIDsByRole(Messages.ListNodeUUIDsByRoleRequestProto request)
- throws IOException, YarnException;
-
-
- /**
- * Get the details on a node
- */
- Messages.GetNodeResponseProto getNode(Messages.GetNodeRequestProto request)
- throws IOException, YarnException;
-
- /**
- * Get the
- * details on a list of nodes.
- * Unknown nodes are not returned
- * Important: the order of the results are undefined
- */
- Messages.GetClusterNodesResponseProto getClusterNodes(Messages.GetClusterNodesRequestProto request)
- throws IOException, YarnException;
-
- /**
- * Echo back the submitted text (after logging it).
- * Useful for adding information to the log, and for testing round trip
- * operations of the protocol
- * @param request request
- * @return response
- * @throws IOException
- * @throws YarnException
- */
- Messages.EchoResponseProto echo(Messages.EchoRequestProto request) throws IOException, YarnException;
-
- /**
- * Kill an identified container
- * @param request request containing the container to kill
- * @return the response
- * @throws IOException
- * @throws YarnException
- */
- Messages.KillContainerResponseProto killContainer(Messages.KillContainerRequestProto request)
- throws IOException, YarnException;
-
- /**
- * AM to commit suicide. If the Hadoop halt entry point has not been disabled,
- * this will fail rather than return with a response.
- * @param request request
- * @return response (this is not the expected outcome)
- * @throws IOException
- * @throws YarnException
- */
- Messages.AMSuicideResponseProto amSuicide(Messages.AMSuicideRequestProto request)
- throws IOException;
-
- /**
- * Get the application liveness
- * @return current liveness information
- * @throws IOException
- */
- Messages.ApplicationLivenessInformationProto getLivenessInformation(
- Messages.GetApplicationLivenessRequestProto request
- ) throws IOException;
-
- Messages.GetLiveContainersResponseProto getLiveContainers(
- Messages.GetLiveContainersRequestProto request
- ) throws IOException;
-
- Messages.ContainerInformationProto getLiveContainer(
- Messages.GetLiveContainerRequestProto request
- ) throws IOException;
-
- Messages.GetLiveComponentsResponseProto getLiveComponents(
- Messages.GetLiveComponentsRequestProto request
- ) throws IOException;
-
- Messages.ComponentInformationProto getLiveComponent(
- Messages.GetLiveComponentRequestProto request
- ) throws IOException;
-
- Messages.GetLiveNodesResponseProto getLiveNodes(
- Messages.GetLiveNodesRequestProto request
- ) throws IOException;
-
- Messages.NodeInformationProto getLiveNode(
- Messages.GetLiveNodeRequestProto request
- ) throws IOException;
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/StateValues.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/StateValues.java
deleted file mode 100644
index ad66a97..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/StateValues.java
+++ /dev/null
@@ -1,63 +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.api;
-
-/**
- * Enumeration of state values.
- */
-public class StateValues {
-
- private StateValues() {}
-
- /**
- * Specification is incomplete & cannot
- * be used: {@value}.
- */
- public static final int STATE_INCOMPLETE = 0;
-
- /**
- * Spec has been submitted: {@value}
- */
- public static final int STATE_SUBMITTED = 1;
- /**
- * Cluster created: {@value}
- */
- public static final int STATE_CREATED = 2;
- /**
- * Live: {@value}
- */
- public static final int STATE_LIVE = 3;
- /**
- * Not ready.
- */
- public static final int STATE_NOT_READY = 4;
- /**
- * Ready.
- */
- public static final int STATE_READY = 5;
- /**
- * Stopped.
- */
- public static final int STATE_STOPPED = 99;
- /**
- * Destroyed.
- */
- public static final int STATE_DESTROYED = 100;
-
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/StatusKeys.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/StatusKeys.java
deleted file mode 100644
index 8a2c4bb..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/StatusKeys.java
+++ /dev/null
@@ -1,117 +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.api;
-import static org.apache.slider.api.ResourceKeys.COMPONENT_INSTANCES;
-/**
- * Contains status and statistics keys
- */
-public interface StatusKeys {
-
- String STATISTICS_CONTAINERS_ACTIVE_REQUESTS = "containers.active.requests";
- String STATISTICS_CONTAINERS_COMPLETED = "containers.completed";
- String STATISTICS_CONTAINERS_DESIRED = "containers.desired";
- String STATISTICS_CONTAINERS_FAILED = "containers.failed";
- String STATISTICS_CONTAINERS_FAILED_RECENTLY = "containers.failed.recently";
- String STATISTICS_CONTAINERS_FAILED_NODE = "containers.failed.node";
- String STATISTICS_CONTAINERS_PREEMPTED = "containers.failed.preempted";
- String STATISTICS_CONTAINERS_LIVE = "containers.live";
- String STATISTICS_CONTAINERS_REQUESTED = "containers.requested";
- String STATISTICS_CONTAINERS_ANTI_AFFINE_PENDING = "containers.anti-affine.pending";
- String STATISTICS_CONTAINERS_STARTED = "containers.start.started";
- String STATISTICS_CONTAINERS_START_FAILED =
- "containers.start.failed";
- String STATISTICS_CONTAINERS_SURPLUS =
- "containers.surplus";
- String STATISTICS_CONTAINERS_UNKNOWN_COMPLETED =
- "containers.unknown.completed";
- /**
- * No of containers provided on AM restart
- */
- String INFO_CONTAINERS_AM_RESTART = "containers.at.am-restart";
-
- String INFO_CREATE_TIME_MILLIS = "create.time.millis";
- String INFO_CREATE_TIME_HUMAN = "create.time";
- String INFO_LIVE_TIME_MILLIS = "live.time.millis";
- String INFO_LIVE_TIME_HUMAN = "live.time";
- String INFO_FLEX_TIME_MILLIS = "flex.time.millis";
- String INFO_FLEX_TIME_HUMAN = "flex.time";
-
- String INFO_MASTER_ADDRESS = "info.master.address";
-
- /**
- * System time in millis when the status report was generated
- */
- String INFO_STATUS_TIME_MILLIS = "status.time.millis";
-
- /**
- * System time in human form when the status report was generated
- */
- String INFO_STATUS_TIME_HUMAN = "status.time";
-
- String INFO_AM_APP_ID = "info.am.app.id";
- String INFO_AM_ATTEMPT_ID = "info.am.attempt.id";
- String INFO_AM_CONTAINER_ID = "info.am.container.id";
- String INFO_AM_HOSTNAME = "info.am.hostname";
- String INFO_AM_RPC_PORT = "info.am.rpc.port";
- String INFO_AM_WEB_PORT = "info.am.web.port";
- String INFO_AM_WEB_URL = "info.am.web.url";
- String INFO_AM_AGENT_STATUS_PORT = "info.am.agent.status.port";
- String INFO_AM_AGENT_OPS_PORT = "info.am.agent.ops.port";
- String INFO_AM_AGENT_OPS_URL = "info.am.agent.ops.url";
- String INFO_AM_AGENT_STATUS_URL = "info.am.agent.status.url";
-
- /**
- * info: #of instances of a component requested: {@value}
- *
- */
- String COMPONENT_INSTANCES_ACTUAL = COMPONENT_INSTANCES + ".actual";
-
- /**
- * info: #of instances of a component requested: {@value}
- *
- */
- String COMPONENT_INSTANCES_REQUESTING = COMPONENT_INSTANCES + ".requesting";
-
- /**
- * info: #of instances of a component being released: {@value}
- *
- */
- String COMPONENT_INSTANCES_RELEASING = COMPONENT_INSTANCES + ".releasing";
-
- /**
- * info: #of instances of a component failed: {@value}
- *
- */
- String COMPONENT_INSTANCES_FAILED = COMPONENT_INSTANCES + ".failed";
-
- /**
- * info: #of instances of a component started: {@value}
- *
- */
- String COMPONENT_INSTANCES_STARTED = COMPONENT_INSTANCES + ".started";
-
-
- /**
- * info: #of instances of a component completed: {@value}
- *
- */
- String COMPONENT_INSTANCES_COMPLETED = COMPONENT_INSTANCES + ".completed";
-
-
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/types/ApplicationLivenessInformation.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/types/ApplicationLivenessInformation.java
deleted file mode 100644
index 687edd2..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/types/ApplicationLivenessInformation.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.api.types;
-
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-/**
- * Serialized information about liveness
- *
- * If true liveness probes are implemented, this
- * datatype can be extended to publish their details.
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class ApplicationLivenessInformation {
- /** flag set if the cluster is at size */
- public boolean allRequestsSatisfied;
-
- /** number of outstanding requests: those needed to satisfy */
- public int requestsOutstanding;
-
- @Override
- public String toString() {
- final StringBuilder sb =
- new StringBuilder("ApplicationLivenessInformation{");
- sb.append("allRequestsSatisfied=").append(allRequestsSatisfied);
- sb.append(", requestsOutstanding=").append(requestsOutstanding);
- sb.append('}');
- return sb.toString();
- }
-}
-
-
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/types/ComponentInformation.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/types/ComponentInformation.java
deleted file mode 100644
index d2fdd62..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/types/ComponentInformation.java
+++ /dev/null
@@ -1,107 +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.api.types;
-
-import org.apache.slider.api.StatusKeys;
-import org.apache.slider.server.appmaster.state.RoleStatus;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Serializable version of component data.
- *
- * This is sent in REST calls as a JSON object —but is also marshalled into
- * a protobuf structure. Look at {@link RestTypeMarshalling}
- * for the specifics there.
- *
- * This means that if any fields are added here. they must be added to
- * src/main/proto/SliderClusterMessages.proto and
- * the protobuf structures rebuilt via a {@code mvn generate-sources -Pcompile-protobuf}
- *
- * See also {@link RoleStatus#serialize()}
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-
-public class ComponentInformation {
-
- public String name;
- public int priority;
- public int desired, actual, releasing;
- public int placementPolicy;
- public int requested;
- public int failed, started, startFailed, completed, totalRequested;
- public int nodeFailed, failedRecently, preempted;
- public int pendingAntiAffineRequestCount;
- public boolean isAARequestOutstanding;
-
- public String failureMessage;
- public List containers;
-
- /**
- * Build the statistics map from the current data
- * @return a map for use in statistics reports
- */
- public Map buildStatistics() {
- Map stats = new HashMap<>();
- stats.put(StatusKeys.STATISTICS_CONTAINERS_ACTIVE_REQUESTS, requested);
- stats.put(StatusKeys.STATISTICS_CONTAINERS_ANTI_AFFINE_PENDING, pendingAntiAffineRequestCount);
- stats.put(StatusKeys.STATISTICS_CONTAINERS_COMPLETED, completed);
- stats.put(StatusKeys.STATISTICS_CONTAINERS_DESIRED, desired);
- stats.put(StatusKeys.STATISTICS_CONTAINERS_FAILED, failed);
- stats.put(StatusKeys.STATISTICS_CONTAINERS_FAILED_NODE, nodeFailed);
- stats.put(StatusKeys.STATISTICS_CONTAINERS_FAILED_RECENTLY, failedRecently);
- stats.put(StatusKeys.STATISTICS_CONTAINERS_LIVE, actual);
- stats.put(StatusKeys.STATISTICS_CONTAINERS_PREEMPTED, preempted);
- stats.put(StatusKeys.STATISTICS_CONTAINERS_REQUESTED, totalRequested);
- stats.put(StatusKeys.STATISTICS_CONTAINERS_STARTED, started);
- stats.put(StatusKeys.STATISTICS_CONTAINERS_START_FAILED, startFailed);
- return stats;
- }
-
- @Override
- public String toString() {
- final StringBuilder sb =
- new StringBuilder("ComponentInformation{");
- sb.append(", name='").append(name).append('\'');
- sb.append(", actual=").append(actual);
- sb.append(", completed=").append(completed);
- sb.append(", desired=").append(desired);
- sb.append(", failed=").append(failed);
- sb.append(", failureMessage='").append(failureMessage).append('\'');
- sb.append(", placementPolicy=").append(placementPolicy);
- sb.append(", isAARequestOutstanding=").append(isAARequestOutstanding);
- sb.append(", pendingAntiAffineRequestCount=").append(pendingAntiAffineRequestCount);
- sb.append(", priority=").append(priority);
- sb.append(", releasing=").append(releasing);
- sb.append(", requested=").append(requested);
- sb.append(", started=").append(started);
- sb.append(", startFailed=").append(startFailed);
- sb.append(", totalRequested=").append(totalRequested);
- sb.append(", container count='")
- .append(containers == null ? 0 : containers.size())
- .append('\'');
- sb.append('}');
- return sb.toString();
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/types/ContainerInformation.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/types/ContainerInformation.java
deleted file mode 100644
index 6991340..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/types/ContainerInformation.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.api.types;
-
-import org.apache.hadoop.registry.client.binding.JsonSerDeser;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-/**
- * Serializable version of component instance data
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class ContainerInformation {
-
- public String containerId;
- public String component;
- public String appVersion;
- public Boolean released;
- public int state;
- public Integer exitCode;
- public String diagnostics;
- public long createTime;
- public long startTime;
-
- public String host;
- public String hostURL;
- public String placement;
- /**
- * What is the tail output from the executed process (or [] if not started
- * or the log cannot be picked up
- */
- public String[] output;
-
- @Override
- public String toString() {
- JsonSerDeser serDeser =
- new JsonSerDeser<>(
- ContainerInformation.class);
- return serDeser.toString(this);
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/types/NodeEntryInformation.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/types/NodeEntryInformation.java
deleted file mode 100644
index 8424be2..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/types/NodeEntryInformation.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.api.types;
-
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-/**
- * Serialized node entry information. Must be kept in sync with the protobuf equivalent.
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class NodeEntryInformation {
-
- /** incrementing counter of instances that failed */
- public int failed;
-
- /** Counter of "failed recently" events. */
- public int failedRecently;
-
- /** timestamp of last use */
- public long lastUsed;
-
- /** Number of live nodes. */
- public int live;
-
- /** incrementing counter of instances that have been pre-empted. */
- public int preempted;
-
- /** Priority */
- public int priority;
-
- /** instance explicitly requested on this node */
- public int requested;
-
- /** number of containers being released off this node */
- public int releasing;
-
- /** incrementing counter of instances that failed to start */
- public int startFailed;
-
- /** number of starting instances */
- public int starting;
-
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder(
- "NodeEntryInformation{");
- sb.append("priority=").append(priority);
- sb.append(", live=").append(live);
- sb.append(", requested=").append(requested);
- sb.append(", releasing=").append(releasing);
- sb.append(", starting=").append(starting);
- sb.append(", failed=").append(failed);
- sb.append(", failedRecently=").append(failedRecently);
- sb.append(", startFailed=").append(startFailed);
- sb.append(", preempted=").append(preempted);
- sb.append(", lastUsed=").append(lastUsed);
- sb.append('}');
- return sb.toString();
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/types/NodeInformation.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/types/NodeInformation.java
deleted file mode 100644
index 4fe5b4c..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/types/NodeInformation.java
+++ /dev/null
@@ -1,59 +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.api.types;
-
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Serialized node information. Must be kept in sync with the protobuf equivalent.
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class NodeInformation {
-
- public String hostname;
- public String state;
- public String labels;
- public String rackName;
- public String httpAddress;
- public String healthReport;
- public long lastUpdated;
- public Map entries = new HashMap<>();
-
- @Override
- public String toString() {
- final StringBuilder sb = new StringBuilder(
- "NodeInformation{");
- sb.append("hostname='").append(hostname).append('\'');
- sb.append(", state='").append(state).append('\'');
- sb.append(", labels='").append(labels).append('\'');
- sb.append(", rackName='").append(rackName).append('\'');
- sb.append(", httpAddress='").append(httpAddress).append('\'');
- sb.append(", healthReport='").append(healthReport).append('\'');
- sb.append(", lastUpdated=").append(lastUpdated);
- sb.append('}');
- return sb.toString();
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/types/NodeInformationList.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/types/NodeInformationList.java
deleted file mode 100644
index 741523e..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/types/NodeInformationList.java
+++ /dev/null
@@ -1,41 +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.api.types;
-
-import org.apache.slider.core.persist.JsonSerDeser;
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-public class NodeInformationList extends ArrayList {
- public NodeInformationList() {
- }
-
- public NodeInformationList(Collection extends NodeInformation> c) {
- super(c);
- }
-
- public NodeInformationList(int initialCapacity) {
- super(initialCapacity);
- }
-
- public static JsonSerDeser createSerializer() {
- return new JsonSerDeser<>(NodeInformationList.class);
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/types/PingInformation.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/types/PingInformation.java
deleted file mode 100644
index 223edca..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/types/PingInformation.java
+++ /dev/null
@@ -1,47 +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.api.types;
-
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-/**
- * Serialized information to/from Ping operations
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class PingInformation {
- public long time;
- public String text;
- public String verb;
- public String body;
-
- @Override
- public String toString() {
-
- final StringBuilder sb =
- new StringBuilder("PingResource{");
- sb.append("time=").append(time);
- sb.append(", verb=").append(verb);
- sb.append(", text='").append(text).append('\'');
- sb.append(", body='").append(body).append('\'');
- sb.append('}');
- return sb.toString();
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/types/RestTypeMarshalling.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/types/RestTypeMarshalling.java
deleted file mode 100644
index bc3d526..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/types/RestTypeMarshalling.java
+++ /dev/null
@@ -1,257 +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.api.types;
-
-import org.apache.slider.api.proto.Messages;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Class to handle marshalling of REST
- * types to/from Protobuf records.
- */
-public class RestTypeMarshalling {
-
- public static Messages.ApplicationLivenessInformationProto
- marshall(ApplicationLivenessInformation info) {
-
- Messages.ApplicationLivenessInformationProto.Builder builder =
- Messages.ApplicationLivenessInformationProto.newBuilder();
- builder.setAllRequestsSatisfied(info.allRequestsSatisfied);
- builder.setRequestsOutstanding(info.requestsOutstanding);
- return builder.build();
- }
-
- public static ApplicationLivenessInformation
- unmarshall(Messages.ApplicationLivenessInformationProto wire) {
- ApplicationLivenessInformation info = new ApplicationLivenessInformation();
- info.allRequestsSatisfied = wire.getAllRequestsSatisfied();
- info.requestsOutstanding = wire.getRequestsOutstanding();
- return info;
- }
-
- public static ComponentInformation
- unmarshall(Messages.ComponentInformationProto wire) {
- ComponentInformation info = new ComponentInformation();
- info.name = wire.getName();
- info.priority = wire.getPriority();
- info.placementPolicy = wire.getPlacementPolicy();
-
- info.actual = wire.getActual();
- info.completed = wire.getCompleted();
- info.desired = wire.getDesired();
- info.failed = wire.getFailed();
- info.releasing = wire.getReleasing();
- info.requested = wire.getRequested();
- info.started = wire.getStarted();
- info.startFailed = wire.getStartFailed();
- info.totalRequested = wire.getTotalRequested();
- info.containers = new ArrayList<>(wire.getContainersList());
- if (wire.hasFailureMessage()) {
- info.failureMessage = wire.getFailureMessage();
- }
- if (wire.hasPendingAntiAffineRequestCount()) {
- info.pendingAntiAffineRequestCount = wire.getPendingAntiAffineRequestCount();
- }
- if (wire.hasIsAARequestOutstanding()) {
- info.isAARequestOutstanding = wire.getIsAARequestOutstanding();
- }
- return info;
- }
- public static Messages.ComponentInformationProto marshall(ComponentInformation info) {
-
- Messages.ComponentInformationProto.Builder builder =
- Messages.ComponentInformationProto.newBuilder();
- builder.setName(info.name);
- builder.setPriority(info.priority);
- builder.setPlacementPolicy(info.placementPolicy);
-
- builder.setActual(info.actual);
- builder.setCompleted(info.completed);
- builder.setDesired(info.desired);
- builder.setFailed(info.failed);
- builder.setReleasing(info.releasing);
- builder.setRequested(info.requested);
- builder.setStarted(info.started);
- builder.setStartFailed(info.startFailed);
- builder.setTotalRequested(info.totalRequested);
- builder.setNodeFailed(info.nodeFailed);
- builder.setPreempted(info.preempted);
- builder.setFailedRecently(info.failedRecently);
- if (info.failureMessage != null) {
- builder.setFailureMessage(info.failureMessage);
- }
- if (info.containers != null) {
- builder.addAllContainers(info.containers);
- }
- builder.setPendingAntiAffineRequestCount(info.pendingAntiAffineRequestCount);
- builder.setIsAARequestOutstanding(info.isAARequestOutstanding);
- return builder.build();
- }
-
- public static Messages.NodeInformationProto marshall(NodeInformation info) {
-
- Messages.NodeInformationProto.Builder builder =
- Messages.NodeInformationProto.newBuilder();
- builder.setHostname(info.hostname);
- builder.setLastUpdated(info.lastUpdated);
- builder.setState(info.state != null? info.state : "unknown");
- builder.setRackName(info.rackName != null ? info.rackName : "");
- builder.setHealthReport(info.healthReport != null ? info.healthReport : "");
- builder.setHttpAddress(info.httpAddress != null ? info.httpAddress : "");
- builder.setLabels(info.labels != null ? info.labels: "");
-
-
- if (info.entries != null) {
- for (Map.Entry elt : info.entries.entrySet()) {
- NodeEntryInformation entry = elt.getValue();
- Messages.NodeEntryInformationProto.Builder node =
- Messages.NodeEntryInformationProto.newBuilder();
- node.setPriority(entry.priority);
- node.setName(elt.getKey());
- node.setFailed(entry.failed);
- node.setFailedRecently(entry.failedRecently);
- node.setLive(entry.live);
- node.setLastUsed(entry.lastUsed);
- node.setPreempted(entry.preempted);
- node.setRequested(entry.requested);
- node.setReleasing(entry.releasing);
- node.setStartFailed(entry.startFailed);
- node.setStarting(entry.starting);
- builder.addEntries(node.build());
- }
- }
- return builder.build();
- }
-
- public static NodeInformation unmarshall(Messages.NodeInformationProto wire) {
- NodeInformation info = new NodeInformation();
- info.healthReport = wire.getHealthReport();
- info.hostname = wire.getHostname();
- info.httpAddress = wire.getHttpAddress();
- info.labels = wire.getLabels();
- info.lastUpdated = wire.getLastUpdated();
- info.rackName = wire.getRackName();
- info.state = wire.getState();
- List entriesList = wire.getEntriesList();
- if (entriesList != null) {
- info.entries = new HashMap<>(entriesList.size());
- for (Messages.NodeEntryInformationProto entry : entriesList) {
- NodeEntryInformation nei = new NodeEntryInformation();
- nei.failed = entry.getFailed();
- nei.failedRecently = entry.getFailedRecently();
- nei.lastUsed = entry.getLastUsed();
- nei.live = entry.getLive();
- nei.preempted = entry.getPreempted();
- nei.priority = entry.getPriority();
- nei.requested = entry.getRequested();
- nei.releasing = entry.getReleasing();
- nei.startFailed = entry.getStartFailed();
- nei.starting = entry.getStarting();
- info.entries.put(entry.getName(), nei);
- }
- }
- return info;
- }
-
- public static ContainerInformation unmarshall(Messages.ContainerInformationProto wire) {
- ContainerInformation info = new ContainerInformation();
- info.containerId = wire.getContainerId();
- info.component = wire.getComponent();
- info.appVersion = wire.getAppVersion();
- info.state = wire.getState();
- if (wire.hasReleased()) {
- info.released = wire.getReleased();
- }
- if (wire.hasExitCode()) {
- info.exitCode = wire.getExitCode();
- }
- if (wire.hasDiagnostics()) {
- info.diagnostics = wire.getDiagnostics();
- }
- if (wire.hasHost()) {
- info.host = wire.getHost();
- }
- if (wire.hasHostURL()) {
- info.host = wire.getHostURL();
- }
- info.createTime = wire.getCreateTime();
- info.startTime = wire.getStartTime();
- info.output = wire.getOutputList().toArray(
- new String[wire.getOutputCount()]
- );
- if (wire.hasPlacement()) {
- info.placement = wire.getPlacement();
- }
- return info;
- }
-
- public static List unmarshall(Messages.GetLiveContainersResponseProto wire) {
- List infoList = new ArrayList<>(wire.getContainersList().size());
- for (Messages.ContainerInformationProto container : wire.getContainersList()) {
- infoList.add(unmarshall(container));
- }
- return infoList;
- }
-
- public static Messages.ContainerInformationProto marshall(ContainerInformation info) {
-
- Messages.ContainerInformationProto.Builder builder =
- Messages.ContainerInformationProto.newBuilder();
- if (info.containerId != null) {
- builder.setContainerId(info.containerId);
- }
- if (info.component != null) {
- builder.setComponent(info.component);
- }
- if (info.appVersion != null) {
- builder.setAppVersion(info.appVersion);
- }
- builder.setCreateTime(info.createTime);
- if (info.diagnostics != null) {
- builder.setDiagnostics(info.diagnostics);
- }
- if (info.host != null) {
- builder.setHost(info.host);
- }
- if (info.hostURL != null) {
- builder.setHostURL(info.hostURL);
- }
- if (info.output != null) {
- builder.addAllOutput(Arrays.asList(info.output));
- }
- if (info.released != null) {
- builder.setReleased(info.released);
- }
- if (info.placement != null) {
- builder.setPlacement(info.placement);
- }
- builder.setStartTime(info.startTime);
- builder.setState(info.state);
- return builder.build();
- }
-
- public static String unmarshall(Messages.WrappedJsonProto wire) {
- return wire.getJson();
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/types/RoleStatistics.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/types/RoleStatistics.java
deleted file mode 100644
index 25f4d9d..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/types/RoleStatistics.java
+++ /dev/null
@@ -1,60 +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.api.types;
-
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-
-/**
- * Simple role statistics for state views; can be generated by RoleStatus
- * instances, and aggregated for summary information.
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-public class RoleStatistics {
- public long activeAA = 0L;
- public long actual = 0L;
- public long completed = 0L;
- public long desired = 0L;
- public long failed = 0L;
- public long failedRecently = 0L;
- public long limitsExceeded = 0L;
- public long nodeFailed = 0L;
- public long preempted = 0L;
- public long requested = 0L;
- public long started = 0L;
-
- /**
- * Add another statistics instance
- * @param that the other value
- * @return this entry
- */
- public RoleStatistics add(final RoleStatistics that) {
- activeAA += that.activeAA;
- actual += that.actual;
- completed += that.completed;
- desired += that.desired;
- failed += that.failed;
- failedRecently += that.failedRecently;
- limitsExceeded += that.limitsExceeded;
- nodeFailed += that.nodeFailed;
- preempted += that.preempted;
- requested += that.requested;
- started += that.started;
- return this;
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/types/SliderInstanceDescription.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/types/SliderInstanceDescription.java
deleted file mode 100644
index 3b95f80..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/api/types/SliderInstanceDescription.java
+++ /dev/null
@@ -1,54 +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.api.types;
-
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.yarn.api.records.ApplicationReport;
-
-/**
- * Description of a slider instance
- */
-public class SliderInstanceDescription {
-
- public final String name;
- public final Path path;
- public final ApplicationReport applicationReport;
-
- public SliderInstanceDescription(String name,
- Path path,
- ApplicationReport applicationReport) {
- this.name = name;
- this.path = path;
- this.applicationReport = applicationReport;
- }
-
- @Override
- public String toString() {
- final StringBuilder sb =
- new StringBuilder("SliderInstanceDescription{");
- sb.append("name='").append(name).append('\'');
- sb.append(", path=").append(path);
- sb.append(", applicationReport: ")
- .append(applicationReport == null
- ? "null"
- : (" id " + applicationReport.getApplicationId()));
- sb.append('}');
- return sb.toString();
- }
-}
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/ClientUtils.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/ClientUtils.java
deleted file mode 100644
index b28257f..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/ClientUtils.java
+++ /dev/null
@@ -1,111 +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.commons.lang.StringUtils;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.PathNotFoundException;
-import org.apache.hadoop.registry.client.api.RegistryOperations;
-import org.apache.hadoop.registry.client.binding.RegistryPathUtils;
-import org.apache.hadoop.registry.client.exceptions.NoRecordException;
-import org.apache.hadoop.registry.client.types.ServiceRecord;
-import org.apache.hadoop.yarn.service.conf.SliderKeys;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.NotFoundException;
-import org.apache.slider.core.exceptions.SliderException;
-import org.apache.slider.core.registry.docstore.ConfigFormat;
-import org.apache.slider.core.registry.docstore.PublishedConfigSet;
-import org.apache.slider.core.registry.docstore.PublishedConfiguration;
-import org.apache.slider.core.registry.docstore.PublishedConfigurationOutputter;
-import org.apache.slider.core.registry.retrieve.RegistryRetriever;
-
-import java.io.File;
-import java.io.IOException;
-
-import static org.apache.hadoop.registry.client.binding.RegistryUtils.currentUser;
-import static org.apache.hadoop.registry.client.binding.RegistryUtils.servicePath;
-
-public class ClientUtils {
- public static ServiceRecord lookupServiceRecord(RegistryOperations rops,
- String user, String name) throws IOException, SliderException {
- return lookupServiceRecord(rops, user, null, name);
- }
-
- public static ServiceRecord lookupServiceRecord(RegistryOperations rops,
- String user, String type, String name) throws IOException,
- SliderException {
- if (StringUtils.isEmpty(user)) {
- user = currentUser();
- } else {
- user = RegistryPathUtils.encodeForRegistry(user);
- }
- if (StringUtils.isEmpty(type)) {
- type = SliderKeys.APP_TYPE;
- }
-
- String path = servicePath(user, type, name);
- return resolve(rops, path);
- }
-
- public static ServiceRecord resolve(RegistryOperations rops, String path)
- throws IOException, SliderException {
- try {
- return rops.resolve(path);
- } catch (PathNotFoundException | NoRecordException e) {
- throw new NotFoundException(e.getPath().toString(), e);
- }
- }
-
- public static PublishedConfiguration getConfigFromRegistry(
- RegistryOperations rops, Configuration configuration,
- String configName, String appName, String user, boolean external)
- throws IOException, SliderException {
- ServiceRecord instance = lookupServiceRecord(rops, user, appName);
-
- RegistryRetriever retriever = new RegistryRetriever(configuration, instance);
- PublishedConfigSet configurations = retriever.getConfigurations(external);
-
- PublishedConfiguration published = retriever.retrieveConfiguration(
- configurations, configName, external);
- return published;
- }
-
- public static String saveOrReturnConfig(PublishedConfiguration published,
- String format, File destPath, String fileName)
- throws BadCommandArgumentsException, IOException {
- ConfigFormat configFormat = ConfigFormat.resolve(format);
- if (configFormat == null) {
- throw new BadCommandArgumentsException(
- "Unknown/Unsupported format %s ", format);
- }
- PublishedConfigurationOutputter outputter =
- PublishedConfigurationOutputter.createOutputter(configFormat,
- published);
- boolean print = destPath == null;
- if (!print) {
- if (destPath.isDirectory()) {
- // creating it under a directory
- destPath = new File(destPath, fileName);
- }
- outputter.save(destPath);
- return null;
- } else {
- return outputter.asString();
- }
- }
-}
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/SliderClient.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/SliderClient.java
deleted file mode 100644
index 7712191..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/client/SliderClient.java
+++ /dev/null
@@ -1,2783 +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.annotations.VisibleForTesting;
-import org.apache.commons.lang.ArrayUtils;
-import org.apache.commons.lang.StringUtils;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileSystem;
-import org.apache.hadoop.fs.LocatedFileStatus;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.fs.PathNotFoundException;
-import org.apache.hadoop.fs.RemoteIterator;
-import org.apache.hadoop.fs.permission.FsAction;
-import org.apache.hadoop.fs.permission.FsPermission;
-import org.apache.hadoop.yarn.proto.ClientAMProtocol.GetStatusRequestProto;
-import org.apache.hadoop.hdfs.HdfsConfiguration;
-import org.apache.hadoop.net.NetUtils;
-import org.apache.hadoop.registry.client.api.RegistryConstants;
-import org.apache.hadoop.registry.client.api.RegistryOperations;
-import org.apache.hadoop.registry.client.binding.RegistryPathUtils;
-import org.apache.hadoop.registry.client.binding.RegistryUtils;
-import org.apache.hadoop.registry.client.exceptions.NoRecordException;
-import org.apache.hadoop.registry.client.types.Endpoint;
-import org.apache.hadoop.registry.client.types.RegistryPathStatus;
-import org.apache.hadoop.registry.client.types.ServiceRecord;
-import org.apache.hadoop.registry.client.types.yarn.YarnRegistryAttributes;
-import org.apache.hadoop.security.Credentials;
-import org.apache.hadoop.security.KerberosDiags;
-import org.apache.hadoop.security.UserGroupInformation;
-import org.apache.hadoop.util.Shell;
-import org.apache.hadoop.yarn.api.ApplicationConstants;
-import org.apache.hadoop.yarn.api.protocolrecords.UpdateApplicationTimeoutsRequest;
-import org.apache.hadoop.yarn.api.records.ApplicationId;
-import org.apache.hadoop.yarn.api.records.ApplicationReport;
-import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext;
-import org.apache.hadoop.yarn.api.records.ApplicationTimeout;
-import org.apache.hadoop.yarn.api.records.ApplicationTimeoutType;
-import org.apache.hadoop.yarn.api.records.ContainerLaunchContext;
-import org.apache.hadoop.yarn.api.records.LocalResource;
-import org.apache.hadoop.yarn.api.records.LocalResourceType;
-import org.apache.hadoop.yarn.api.records.Resource;
-import org.apache.hadoop.yarn.api.records.YarnApplicationState;
-import org.apache.hadoop.yarn.client.api.YarnClientApplication;
-import org.apache.hadoop.yarn.conf.YarnConfiguration;
-import org.apache.hadoop.yarn.exceptions.ApplicationAttemptNotFoundException;
-import org.apache.hadoop.yarn.exceptions.ApplicationNotFoundException;
-import org.apache.hadoop.yarn.exceptions.YarnException;
-import org.apache.hadoop.yarn.ipc.YarnRPC;
-import org.apache.hadoop.yarn.util.ConverterUtils;
-import org.apache.hadoop.yarn.util.Records;
-import org.apache.hadoop.yarn.util.Times;
-import org.apache.hadoop.yarn.util.resource.ResourceCalculator;
-import org.apache.slider.api.SliderClusterProtocol;
-import org.apache.slider.api.proto.Messages;
-import org.apache.slider.api.resource.Application;
-import org.apache.slider.api.resource.Component;
-import org.apache.slider.api.types.ContainerInformation;
-import org.apache.slider.api.types.NodeInformationList;
-import org.apache.slider.client.ipc.SliderClusterOperations;
-import org.apache.slider.common.Constants;
-import org.apache.hadoop.yarn.service.conf.SliderExitCodes;
-import org.apache.hadoop.yarn.service.conf.SliderKeys;
-import org.apache.hadoop.yarn.service.conf.SliderXmlConfKeys;
-import org.apache.hadoop.yarn.service.client.params.AbstractActionArgs;
-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.slider.common.params.ActionExistsArgs;
-import org.apache.hadoop.yarn.service.client.params.ActionFlexArgs;
-import org.apache.slider.common.params.ActionFreezeArgs;
-import org.apache.slider.common.params.ActionKDiagArgs;
-import org.apache.slider.common.params.ActionKeytabArgs;
-import org.apache.slider.common.params.ActionKillContainerArgs;
-import org.apache.slider.common.params.ActionListArgs;
-import org.apache.slider.common.params.ActionLookupArgs;
-import org.apache.slider.common.params.ActionNodesArgs;
-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.ActionTokensArgs;
-import org.apache.slider.common.params.ActionUpgradeArgs;
-import org.apache.hadoop.yarn.service.client.params.Arguments;
-import org.apache.hadoop.yarn.service.client.params.ClientArgs;
-import org.apache.hadoop.yarn.service.client.params.CommonArgs;
-import org.apache.slider.common.tools.ConfigHelper;
-import org.apache.slider.common.tools.Duration;
-import org.apache.slider.common.tools.SliderFileSystem;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.common.tools.SliderVersionInfo;
-import org.apache.slider.core.exceptions.BadClusterStateException;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.BadConfigException;
-import org.apache.slider.core.exceptions.ErrorStrings;
-import org.apache.slider.core.exceptions.NoSuchNodeException;
-import org.apache.slider.core.exceptions.NotFoundException;
-import org.apache.slider.core.exceptions.SliderException;
-import org.apache.slider.core.exceptions.UnknownApplicationInstanceException;
-import org.apache.slider.core.exceptions.UsageException;
-import org.apache.slider.core.launch.ClasspathConstructor;
-import org.apache.slider.core.launch.CredentialUtils;
-import org.apache.slider.core.launch.JavaCommandLineBuilder;
-import org.apache.slider.core.launch.SerializedApplicationReport;
-import org.apache.slider.core.main.RunService;
-import org.apache.slider.core.persist.ApplicationReportSerDeser;
-import org.apache.slider.core.persist.JsonSerDeser;
-import org.apache.slider.core.registry.SliderRegistryUtils;
-import org.apache.slider.core.registry.YarnAppListClient;
-import org.apache.slider.core.registry.docstore.ConfigFormat;
-import org.apache.slider.core.registry.docstore.PublishedConfigSet;
-import org.apache.slider.core.registry.docstore.PublishedConfiguration;
-import org.apache.slider.core.registry.docstore.PublishedExports;
-import org.apache.slider.core.registry.docstore.PublishedExportsOutputter;
-import org.apache.slider.core.registry.docstore.PublishedExportsSet;
-import org.apache.slider.core.registry.retrieve.RegistryRetriever;
-import org.apache.slider.core.zk.BlockingZKWatcher;
-import org.apache.slider.core.zk.ZKIntegration;
-import org.apache.hadoop.yarn.service.provider.AbstractClientProvider;
-import org.apache.hadoop.yarn.service.provider.ProviderUtils;
-import org.apache.slider.server.appmaster.rpc.RpcBinder;
-import org.apache.hadoop.yarn.service.ClientAMProtocol;
-import org.apache.hadoop.yarn.service.client.ClientAMProxy;
-import org.apache.hadoop.yarn.service.ServiceMaster;
-import org.apache.slider.server.services.utility.AbstractSliderLaunchedService;
-import org.apache.hadoop.yarn.service.utils.ServiceApiUtil;
-import org.apache.zookeeper.CreateMode;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.ZooDefs;
-import org.apache.zookeeper.data.ACL;
-import org.codehaus.jackson.map.PropertyNamingStrategy;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InterruptedIOException;
-import java.io.OutputStreamWriter;
-import java.io.PrintStream;
-import java.io.PrintWriter;
-import java.net.InetSocketAddress;
-import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import static org.apache.hadoop.registry.client.binding.RegistryUtils.*;
-import static org.apache.hadoop.yarn.api.records.YarnApplicationState.*;
-import static org.apache.slider.common.Constants.HADOOP_JAAS_DEBUG;
-import static org.apache.hadoop.yarn.service.client.params.SliderActions.*;
-import static org.apache.slider.common.tools.SliderUtils.*;
-import org.apache.hadoop.yarn.proto.ClientAMProtocol.GetStatusResponseProto;
-
-/**
- * Client service for Slider
- */
-
-public class SliderClient extends AbstractSliderLaunchedService implements RunService,
- SliderExitCodes, SliderKeys, ErrorStrings, SliderClientAPI {
- private static final Logger log = LoggerFactory.getLogger(SliderClient.class);
- public static final String E_MUST_BE_A_VALID_JSON_FILE
- = "Invalid configuration. Must be a valid json file.";
- public static final String E_INVALID_INSTALL_LOCATION
- = "A valid install location must be provided for the client.";
- public static final String E_UNABLE_TO_READ_SUPPLIED_PACKAGE_FILE
- = "Unable to read supplied package file";
- public static final String E_INVALID_APPLICATION_PACKAGE_LOCATION
- = "A valid application package location required.";
- public static final String E_INVALID_INSTALL_PATH = "Install path is not a valid directory";
- public static final String E_INSTALL_PATH_DOES_NOT_EXIST = "Install path does not exist";
- public static final String E_INVALID_APPLICATION_TYPE_NAME
- = "A valid application type name is required (e.g. HBASE).";
- public static final String E_USE_REPLACEPKG_TO_OVERWRITE = "Use --replacepkg to overwrite.";
- public static final String E_PACKAGE_DOES_NOT_EXIST = "Package does not exist";
- public static final String E_NO_ZOOKEEPER_QUORUM = "No Zookeeper quorum defined";
- public static final String E_NO_RESOURCE_MANAGER = "No valid Resource Manager address provided";
- public static final String E_PACKAGE_EXISTS = "Package exists";
- private static PrintStream clientOutputStream = System.out;
- private static final JsonSerDeser jsonSerDeser =
- new JsonSerDeser(Application.class,
- PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES);
-
- // value should not be changed without updating string find in slider.py
- private static final String PASSWORD_PROMPT = "Enter password for";
-
- private ClientArgs serviceArgs;
- public ApplicationId applicationId;
-
- private String deployedClusterName;
- /**
- * Cluster operations against the deployed cluster -will be null
- * if no bonding has yet taken place
- */
- private SliderClusterOperations sliderClusterOperations;
-
- protected SliderFileSystem sliderFileSystem;
- private YarnRPC rpc;
- /**
- * Yarn client service
- */
- private SliderYarnClientImpl yarnClient;
- private YarnAppListClient yarnAppListClient;
- ResourceCalculator calculator;
- /**
- * The YARN registry service
- */
- @SuppressWarnings("FieldAccessedSynchronizedAndUnsynchronized")
- private RegistryOperations registryOperations;
-
- private static EnumSet terminatedStates =
- EnumSet.of(FINISHED, FAILED, KILLED);
- private static EnumSet waitingStates =
- EnumSet.of(NEW, NEW_SAVING, SUBMITTED, RUNNING);
-
- /**
- * Constructor
- */
- public SliderClient() {
- super("Slider Client");
- new HdfsConfiguration();
- new YarnConfiguration();
- }
-
- /**
- * This is called Before serviceInit is called
- * @param config the initial configuration build up by the
- * service launcher.
- * @param args argument list list of arguments passed to the command line
- * after any launcher-specific commands have been stripped.
- * @return the post-binding configuration to pass to the init()
- * operation.
- * @throws Exception
- */
- @Override
- public Configuration bindArgs(Configuration config, String... args) throws Exception {
- config = super.bindArgs(config, args);
- serviceArgs = new ClientArgs(args);
- serviceArgs.parse();
- // yarn-ify
- YarnConfiguration yarnConfiguration = new YarnConfiguration(config);
- return patchConfiguration(yarnConfiguration);
- }
-
- @Override
- protected void serviceInit(Configuration conf) throws Exception {
- Configuration clientConf = loadSliderClientXML();
- ConfigHelper.mergeConfigurations(conf, clientConf, SLIDER_CLIENT_XML, true);
- serviceArgs.applyDefinitions(conf);
- serviceArgs.applyFileSystemBinding(conf);
- AbstractActionArgs coreAction = serviceArgs.getCoreAction();
- // init security with our conf
- if (!coreAction.disableSecureLogin() && isHadoopClusterSecure(conf)) {
- forceLogin();
- initProcessSecurity(conf);
- }
- if (coreAction.getHadoopServicesRequired()) {
- initHadoopBinding();
- }
- rpc = YarnRPC.create(conf);
- super.serviceInit(conf);
- }
-
- @Override
- protected void serviceStart() throws Exception {
- super.serviceStart();
- }
-
- @Override
- protected void serviceStop() throws Exception {
- super.serviceStop();
- }
-
- /**
- * Launched service execution. This runs {@link #exec()}
- * then catches some exceptions and converts them to exit codes
- * @return an exit code
- * @throws Throwable
- */
- @Override
- public int runService() throws Throwable {
- try {
- return exec();
- } catch (FileNotFoundException | PathNotFoundException nfe) {
- throw new NotFoundException(nfe, nfe.toString());
- }
- }
-
- /**
- * Execute the command line
- * @return an exit code
- * @throws Throwable on a failure
- */
- public int exec() throws Throwable {
-
- // choose the action
- String action = serviceArgs.getAction();
- if (isUnset(action)) {
- throw new SliderException(EXIT_USAGE, serviceArgs.usage());
- }
-
- int exitCode = EXIT_SUCCESS;
- String clusterName = serviceArgs.getClusterName();
- // actions
-
- switch (action) {
- case ACTION_AM_SUICIDE:
- exitCode = actionAmSuicide(clusterName,
- serviceArgs.getActionAMSuicideArgs());
- break;
-
- case ACTION_BUILD:
- exitCode = actionBuild(getApplicationFromArgs(clusterName,
- serviceArgs.getActionBuildArgs()));
- break;
-
- case ACTION_CLIENT:
- exitCode = actionClient(serviceArgs.getActionClientArgs());
- break;
-
- case ACTION_CREATE:
- actionCreate(getApplicationFromArgs(clusterName,
- serviceArgs.getActionCreateArgs()));
- break;
-
- case ACTION_DEPENDENCY:
- exitCode = actionDependency(serviceArgs.getActionDependencyArgs());
- break;
-
- case ACTION_DESTROY:
- actionDestroy(clusterName);
- break;
-
- case ACTION_DIAGNOSTICS:
- exitCode = actionDiagnostic(serviceArgs.getActionDiagnosticArgs());
- break;
-
- case ACTION_EXISTS:
- exitCode = actionExists(clusterName,
- serviceArgs.getActionExistsArgs());
- break;
-
- case ACTION_FLEX:
- actionFlex(clusterName, serviceArgs.getActionFlexArgs());
- break;
-
- case ACTION_STOP:
- actionStop(clusterName, serviceArgs.getActionFreezeArgs());
- break;
-
- case ACTION_HELP:
- log.info(serviceArgs.usage());
- break;
-
- case ACTION_KDIAG:
- exitCode = actionKDiag(serviceArgs.getActionKDiagArgs());
- break;
-
- case ACTION_KILL_CONTAINER:
- exitCode = actionKillContainer(clusterName,
- serviceArgs.getActionKillContainerArgs());
- break;
-
- case ACTION_KEYTAB:
- exitCode = actionKeytab(serviceArgs.getActionKeytabArgs());
- break;
-
- case ACTION_LIST:
- exitCode = actionList(clusterName, serviceArgs.getActionListArgs());
- break;
-
- case ACTION_LOOKUP:
- exitCode = actionLookup(serviceArgs.getActionLookupArgs());
- break;
-
- case ACTION_NODES:
- exitCode = actionNodes("", serviceArgs.getActionNodesArgs());
- break;
-
- case ACTION_REGISTRY:
- exitCode = actionRegistry(serviceArgs.getActionRegistryArgs());
- break;
-
- case ACTION_RESOLVE:
- exitCode = actionResolve(serviceArgs.getActionResolveArgs());
- break;
-
- case ACTION_RESOURCE:
- exitCode = actionResource(serviceArgs.getActionResourceArgs());
- break;
-
- case ACTION_STATUS:
- exitCode = actionStatus(clusterName, serviceArgs.getActionStatusArgs());
- break;
-
- case ACTION_START:
- exitCode = actionStart(clusterName, serviceArgs.getActionThawArgs());
- break;
-
- case ACTION_TOKENS:
- exitCode = actionTokens(serviceArgs.getActionTokenArgs());
- break;
-
- case ACTION_UPDATE:
- exitCode = actionUpdate(clusterName, serviceArgs.getActionUpdateArgs());
- break;
-
- case ACTION_UPGRADE:
- exitCode = actionUpgrade(clusterName, serviceArgs.getActionUpgradeArgs());
- break;
-
- case ACTION_VERSION:
- exitCode = actionVersion();
- break;
-
- default:
- throw new SliderException(EXIT_UNIMPLEMENTED,
- "Unimplemented: " + action);
- }
-
- return exitCode;
- }
-
- /**
- * Perform everything needed to init the hadoop binding.
- * This assumes that the service is already in inited or started state
- * @throws IOException
- * @throws SliderException
- */
- protected void initHadoopBinding() throws IOException, SliderException {
- // validate the client
- validateSliderClientEnvironment(null);
- //create the YARN client
- yarnClient = new SliderYarnClientImpl();
- yarnClient.init(getConfig());
- if (getServiceState() == STATE.STARTED) {
- yarnClient.start();
- }
- addService(yarnClient);
- yarnAppListClient =
- new YarnAppListClient(yarnClient, getUsername(), getConfig());
- // create the filesystem
- sliderFileSystem = new SliderFileSystem(getConfig());
- }
-
- /**
- * Delete the zookeeper node associated with the calling user and the cluster
- * TODO: YARN registry operations
- **/
- @VisibleForTesting
- public boolean deleteZookeeperNode(String clusterName) throws YarnException, IOException {
- String user = getUsername();
- String zkPath = ZKIntegration.mkClusterPath(user, clusterName);
- Exception e = null;
- try {
- ZKIntegration client = getZkClient(clusterName, user);
- if (client != null) {
- if (client.exists(zkPath)) {
- log.info("Deleting zookeeper path {}", zkPath);
- }
- client.deleteRecursive(zkPath);
- return true;
- }
- } catch (InterruptedException | BadConfigException | KeeperException ex) {
- e = ex;
- }
- if (e != null) {
- log.warn("Unable to recursively delete zk node {}", zkPath, e);
- }
-
- return false;
- }
-
- /**
- * Create the zookeeper node associated with the calling user and the cluster
- *
- * @param clusterName slider application name
- * @param nameOnly should the name only be created (i.e. don't create ZK node)
- * @return the path, using the policy implemented in
- * {@link ZKIntegration#mkClusterPath(String, String)}
- * @throws YarnException
- * @throws IOException
- */
- @VisibleForTesting
- public String createZookeeperNode(String clusterName, Boolean nameOnly) throws YarnException, IOException {
- try {
- return createZookeeperNodeInner(clusterName, nameOnly);
- } catch (KeeperException.NodeExistsException e) {
- return null;
- } catch (KeeperException e) {
- return null;
- } catch (InterruptedException e) {
- throw new InterruptedIOException(e.toString());
- }
- }
-
- /**
- * Create the zookeeper node associated with the calling user and the cluster
- * -throwing exceptions on any failure
- * @param clusterName cluster name
- * @param nameOnly create the path, not the node
- * @return the path, using the policy implemented in
- * {@link ZKIntegration#mkClusterPath(String, String)}
- * @throws YarnException
- * @throws IOException
- * @throws KeeperException
- * @throws InterruptedException
- */
- @VisibleForTesting
- public String createZookeeperNodeInner(String clusterName, Boolean nameOnly)
- throws YarnException, IOException, KeeperException, InterruptedException {
- String user = getUsername();
- String zkPath = ZKIntegration.mkClusterPath(user, clusterName);
- if (nameOnly) {
- return zkPath;
- }
- ZKIntegration client = getZkClient(clusterName, user);
- if (client != null) {
- // set up the permissions. This must be done differently on a secure cluster from an insecure
- // one
- List zkperms = new ArrayList<>();
- if (UserGroupInformation.isSecurityEnabled()) {
- zkperms.add(new ACL(ZooDefs.Perms.ALL, ZooDefs.Ids.AUTH_IDS));
- zkperms.add(new ACL(ZooDefs.Perms.READ, ZooDefs.Ids.ANYONE_ID_UNSAFE));
- } else {
- zkperms.add(new ACL(ZooDefs.Perms.ALL, ZooDefs.Ids.ANYONE_ID_UNSAFE));
- }
- client.createPath(zkPath, "",
- zkperms,
- CreateMode.PERSISTENT);
- return zkPath;
- } else {
- return null;
- }
- }
-
- /**
- * Gets a zookeeper client, returns null if it cannot connect to zookeeper
- **/
- protected ZKIntegration getZkClient(String clusterName, String user) throws YarnException {
- String registryQuorum = lookupZKQuorum();
- ZKIntegration client = null;
- try {
- BlockingZKWatcher watcher = new BlockingZKWatcher();
- client = ZKIntegration.newInstance(registryQuorum, user, clusterName, true, false, watcher,
- ZKIntegration.SESSION_TIMEOUT);
- boolean fromCache = client.init();
- if (!fromCache) {
- watcher.waitForZKConnection(2 * 1000);
- }
- } catch (InterruptedException e) {
- client = null;
- log.warn("Interrupted - unable to connect to zookeeper quorum {}",
- registryQuorum, e);
- } catch (IOException e) {
- log.warn("Unable to connect to zookeeper quorum {}", registryQuorum, e);
- }
- return client;
- }
-
- /**
- * Keep this signature for backward compatibility with
- * force=true by default.
- */
- @Override
- public int actionDestroy(String appName)
- throws YarnException, IOException {
- validateClusterName(appName);
- verifyNoLiveApp(appName, "Destroy");
- Path appDir = sliderFileSystem.buildClusterDirPath(appName);
- FileSystem fs = sliderFileSystem.getFileSystem();
- if (fs.exists(appDir)) {
- if (fs.delete(appDir, true)) {
- log.info("Successfully deleted application dir for " + appName);
- } else {
- String message =
- "Failed to delete application + " + appName + " at: " + appDir;
- log.info(message);
- throw new YarnException(message);
- }
- }
- if (!deleteZookeeperNode(appName)) {
- String message =
- "Failed to cleanup cleanup application " + appName + " in zookeeper";
- log.warn(message);
- throw new YarnException(message);
- }
-
- //TODO clean registry?
- String registryPath = SliderRegistryUtils.registryPathForInstance(
- appName);
- try {
- getRegistryOperations().delete(registryPath, true);
- } catch (IOException e) {
- log.warn("Error deleting registry entry {}: {} ", registryPath, e, e);
- } catch (SliderException e) {
- log.warn("Error binding to registry {} ", e, e);
- }
-
- log.info("Destroyed cluster {}", appName);
- return EXIT_SUCCESS;
- }
-
-
- @Override
- public int actionAmSuicide(String clustername,
- ActionAMSuicideArgs args) throws YarnException, IOException {
- SliderClusterOperations clusterOperations =
- createClusterOperations(clustername);
- clusterOperations.amSuicide(args.message, args.exitcode, args.waittime);
- return EXIT_SUCCESS;
- }
-
- private Application getApplicationFromArgs(String clusterName,
- AbstractClusterBuildingActionArgs args) throws IOException {
- File file = args.getAppDef();
- Path filePath = new Path(file.getAbsolutePath());
- log.info("Loading app definition from: " + filePath);
- Application application =
- jsonSerDeser.load(FileSystem.getLocal(getConfig()), filePath);
- if(args.lifetime > 0) {
- application.setLifetime(args.lifetime);
- }
- application.setName(clusterName);
- return application;
- }
-
- public int actionBuild(Application application) throws YarnException,
- IOException {
- Path appDir = checkAppNotExistOnHdfs(application);
- ServiceApiUtil.validateAndResolveApplication(application,
- sliderFileSystem, getConfig());
- persistApp(appDir, application);
- deployedClusterName = application.getName();
- return EXIT_SUCCESS;
- }
-
- public ApplicationId actionCreate(Application application)
- throws IOException, YarnException {
- String appName = application.getName();
- validateClusterName(appName);
- ServiceApiUtil.validateAndResolveApplication(application,
- sliderFileSystem, getConfig());
- verifyNoLiveApp(appName, "Create");
- Path appDir = checkAppNotExistOnHdfs(application);
-
- ApplicationId appId = submitApp(application);
- application.setId(appId.toString());
- // write app definition on to hdfs
- persistApp(appDir, application);
- return appId;
- //TODO deal with registry
- }
-
- private ApplicationId submitApp(Application app)
- throws IOException, YarnException {
- String appName = app.getName();
- Configuration conf = getConfig();
- Path appRootDir = sliderFileSystem.buildClusterDirPath(app.getName());
- deployedClusterName = appName;
-
- YarnClientApplication yarnApp = yarnClient.createApplication();
- ApplicationSubmissionContext submissionContext =
- yarnApp.getApplicationSubmissionContext();
- ServiceApiUtil.validateCompResourceSize(
- yarnApp.getNewApplicationResponse().getMaximumResourceCapability(),
- app);
-
- applicationId = submissionContext.getApplicationId();
- submissionContext.setKeepContainersAcrossApplicationAttempts(true);
- if (app.getLifetime() > 0) {
- Map appTimeout = new HashMap<>();
- appTimeout.put(ApplicationTimeoutType.LIFETIME, app.getLifetime());
- submissionContext.setApplicationTimeouts(appTimeout);
- }
- submissionContext.setMaxAppAttempts(conf.getInt(KEY_AM_RESTART_LIMIT, 2));
-
- Map localResources = new HashMap<>();
-
- // copy local slideram-log4j.properties to hdfs and add to localResources
- boolean hasSliderAMLog4j =
- addAMLog4jResource(appName, conf, localResources);
- // copy jars to hdfs and add to localResources
- addJarResource(appName, localResources);
- // add keytab if in secure env
- addKeytabResourceIfSecure(sliderFileSystem, localResources, conf, appName);
- printLocalResources(localResources);
-
- //TODO SliderAMClientProvider#copyEnvVars
- //TODO localResource putEnv
-
- Map env = addAMEnv(conf);
-
- // create AM CLI
- String cmdStr =
- buildCommandLine(appName, conf, appRootDir, hasSliderAMLog4j);
-
- //TODO set log aggregation context
- //TODO set retry window
- submissionContext.setResource(Resource.newInstance(
- conf.getLong(KEY_AM_RESOURCE_MEM, DEFAULT_KEY_AM_RESOURCE_MEM), 1));
- submissionContext.setQueue(conf.get(KEY_YARN_QUEUE, app.getQueue()));
- submissionContext.setApplicationName(appName);
- submissionContext.setApplicationType(SliderKeys.APP_TYPE);
- Set appTags =
- AbstractClientProvider.createApplicationTags(appName, null, null);
- if (!appTags.isEmpty()) {
- submissionContext.setApplicationTags(appTags);
- }
- ContainerLaunchContext amLaunchContext =
- Records.newRecord(ContainerLaunchContext.class);
- amLaunchContext.setCommands(Collections.singletonList(cmdStr));
- amLaunchContext.setEnvironment(env);
- amLaunchContext.setLocalResources(localResources);
- addCredentialsIfSecure(conf, amLaunchContext);
- submissionContext.setAMContainerSpec(amLaunchContext);
- submitApplication(submissionContext);
- return submissionContext.getApplicationId();
- }
-
- @VisibleForTesting
- public ApplicationId submitApplication(ApplicationSubmissionContext context)
- throws IOException, YarnException {
- return yarnClient.submitApplication(context);
- }
-
- private void printLocalResources(Map map) {
- log.info("Added LocalResource for localization: ");
- StringBuilder builder = new StringBuilder();
- for (Map.Entry entry : map.entrySet()) {
- builder.append(entry.getKey()).append(" -> ")
- .append(entry.getValue().getResource().getFile())
- .append(System.lineSeparator());
- }
- log.info(builder.toString());
- }
-
- private void addCredentialsIfSecure(Configuration conf,
- ContainerLaunchContext amLaunchContext) throws IOException {
- if (UserGroupInformation.isSecurityEnabled()) {
- // pick up oozie credentials
- Credentials credentials =
- CredentialUtils.loadTokensFromEnvironment(System.getenv(), conf);
- if (credentials == null) {
- // nothing from oozie, so build up directly
- credentials = new Credentials(
- UserGroupInformation.getCurrentUser().getCredentials());
- CredentialUtils.addRMRenewableFSDelegationTokens(conf,
- sliderFileSystem.getFileSystem(), credentials);
- } else {
- log.info("Using externally supplied credentials to launch AM");
- }
- amLaunchContext.setTokens(CredentialUtils.marshallCredentials(credentials));
- }
- }
-
- private String buildCommandLine(String appName, Configuration conf,
- Path appRootDir, boolean hasSliderAMLog4j) throws BadConfigException {
- JavaCommandLineBuilder CLI = new JavaCommandLineBuilder();
- CLI.forceIPv4().headless();
- //TODO CLI.setJVMHeap
- //TODO CLI.addJVMOPTS
- if (hasSliderAMLog4j) {
- CLI.sysprop(SYSPROP_LOG4J_CONFIGURATION, LOG4J_SERVER_PROP_FILENAME);
- CLI.sysprop(SYSPROP_LOG_DIR, ApplicationConstants.LOG_DIR_EXPANSION_VAR);
- }
- CLI.add(ServiceMaster.class.getCanonicalName());
- CLI.add(ACTION_CREATE, appName);
- //TODO debugAM CLI.add(Arguments.ARG_DEBUG)
- CLI.add(Arguments.ARG_CLUSTER_URI, new Path(appRootDir, appName + ".json"));
- // InetSocketAddress rmSchedulerAddress = getRmSchedulerAddress(conf);
-// String rmAddr = NetUtils.getHostPortString(rmSchedulerAddress);
-// CLI.add(Arguments.ARG_RM_ADDR, rmAddr);
- // pass the registry binding
- CLI.addConfOptionToCLI(conf, RegistryConstants.KEY_REGISTRY_ZK_ROOT,
- RegistryConstants.DEFAULT_ZK_REGISTRY_ROOT);
- CLI.addMandatoryConfOption(conf, RegistryConstants.KEY_REGISTRY_ZK_QUORUM);
- if(isHadoopClusterSecure(conf)) {
- //TODO Is this required ??
- // if the cluster is secure, make sure that
- // the relevant security settings go over
- CLI.addConfOption(conf, DFS_NAMENODE_KERBEROS_PRINCIPAL_KEY);
- }
-// // copy over any/all YARN RM client values, in case the server-side XML conf file
-// // has the 0.0.0.0 address
-// CLI.addConfOptions(conf, YarnConfiguration.RM_ADDRESS,
-// YarnConfiguration.RM_CLUSTER_ID, YarnConfiguration.RM_HOSTNAME,
-// YarnConfiguration.RM_PRINCIPAL);
-
- // write out the path output
- CLI.addOutAndErrFiles(STDOUT_AM, STDERR_AM);
- String cmdStr = CLI.build();
- log.info("Completed setting up app master command: {}", cmdStr);
- return cmdStr;
- }
-
- private Map addAMEnv(Configuration conf)
- throws IOException {
- Map env = new HashMap<>();
- ClasspathConstructor classpath =
- buildClasspath(SliderKeys.SUBMITTED_CONF_DIR, "lib",
- sliderFileSystem, getUsingMiniMRCluster());
- env.put("CLASSPATH", classpath.buildClasspath());
- env.put("LANG", "en_US.UTF-8");
- env.put("LC_ALL", "en_US.UTF-8");
- env.put("LANGUAGE", "en_US.UTF-8");
- String jaas = System.getenv(HADOOP_JAAS_DEBUG);
- if (jaas != null) {
- env.put(HADOOP_JAAS_DEBUG, jaas);
- }
- if (!UserGroupInformation.isSecurityEnabled()) {
- String userName = UserGroupInformation.getCurrentUser().getUserName();
- log.info("Run as user " + userName);
- // HADOOP_USER_NAME env is used by UserGroupInformation when log in
- // This env makes AM run as this user
- env.put("HADOOP_USER_NAME", userName);
- }
- env.putAll(getAmLaunchEnv(conf));
- log.info("AM env: \n{}", stringifyMap(env));
- return env;
- }
-
- protected Path addJarResource(String appName,
- Map localResources)
- throws IOException, SliderException {
- Path libPath = sliderFileSystem.buildClusterDirPath(appName);
- ProviderUtils
- .addProviderJar(localResources, ServiceMaster.class, SLIDER_JAR,
- sliderFileSystem, libPath, "lib", false);
- Path dependencyLibTarGzip = sliderFileSystem.getDependencyTarGzip();
- if (sliderFileSystem.isFile(dependencyLibTarGzip)) {
- log.info("Loading lib tar from " + sliderFileSystem.getFileSystem()
- .getScheme() + ": " + dependencyLibTarGzip);
- SliderUtils.putAmTarGzipAndUpdate(localResources, sliderFileSystem);
- } else {
- String[] libs = SliderUtils.getLibDirs();
- log.info("Loading dependencies from local file system: " + Arrays
- .toString(libs));
- for (String libDirProp : libs) {
- ProviderUtils
- .addAllDependencyJars(localResources, sliderFileSystem, libPath,
- "lib", libDirProp);
- }
- }
- return libPath;
- }
-
- private boolean addAMLog4jResource(String appName, Configuration conf,
- Map localResources)
- throws IOException, BadClusterStateException {
- boolean hasSliderAMLog4j = false;
- String hadoopConfDir =
- System.getenv(ApplicationConstants.Environment.HADOOP_CONF_DIR.name());
- if (hadoopConfDir != null) {
- File localFile =
- new File(hadoopConfDir, SliderKeys.LOG4J_SERVER_PROP_FILENAME);
- if (localFile.exists()) {
- Path localFilePath = createLocalPath(localFile);
- Path appDirPath = sliderFileSystem.buildClusterDirPath(appName);
- Path remoteConfPath =
- new Path(appDirPath, SliderKeys.SUBMITTED_CONF_DIR);
- Path remoteFilePath =
- new Path(remoteConfPath, SliderKeys.LOG4J_SERVER_PROP_FILENAME);
- copy(conf, localFilePath, remoteFilePath);
- LocalResource localResource = sliderFileSystem
- .createAmResource(remoteConfPath, LocalResourceType.FILE);
- localResources.put(localFilePath.getName(), localResource);
- hasSliderAMLog4j = true;
- }
- }
- return hasSliderAMLog4j;
- }
-
- private Path checkAppNotExistOnHdfs(Application application)
- throws IOException, SliderException {
- Path appDir = sliderFileSystem.buildClusterDirPath(application.getName());
- sliderFileSystem.verifyDirectoryNonexistent(
- new Path(appDir, application.getName() + ".json"));
- return appDir;
- }
-
- private Path checkAppExistOnHdfs(String appName)
- throws IOException, SliderException {
- Path appDir = sliderFileSystem.buildClusterDirPath(appName);
- sliderFileSystem.verifyPathExists(
- new Path(appDir, appName + ".json"));
- return appDir;
- }
-
- private void persistApp(Path appDir, Application application)
- throws IOException, SliderException {
- FsPermission appDirPermission = new FsPermission("750");
- sliderFileSystem.createWithPermissions(appDir, appDirPermission);
- Path appJson = new Path(appDir, application.getName() + ".json");
- jsonSerDeser
- .save(sliderFileSystem.getFileSystem(), appJson, application, true);
- log.info(
- "Persisted application " + application.getName() + " at " + appJson);
- }
-
- private void addKeytabResourceIfSecure(SliderFileSystem fileSystem,
- Map localResource, Configuration conf,
- String appName) throws IOException, BadConfigException {
- if (!UserGroupInformation.isSecurityEnabled()) {
- return;
- }
- String keytabPreInstalledOnHost =
- conf.get(SliderXmlConfKeys.KEY_AM_KEYTAB_LOCAL_PATH);
- if (StringUtils.isEmpty(keytabPreInstalledOnHost)) {
- String amKeytabName =
- conf.get(SliderXmlConfKeys.KEY_AM_LOGIN_KEYTAB_NAME);
- String keytabDir = conf.get(SliderXmlConfKeys.KEY_HDFS_KEYTAB_DIR);
- Path keytabPath =
- fileSystem.buildKeytabPath(keytabDir, amKeytabName, appName);
- if (fileSystem.getFileSystem().exists(keytabPath)) {
- LocalResource keytabRes =
- fileSystem.createAmResource(keytabPath, LocalResourceType.FILE);
- localResource
- .put(SliderKeys.KEYTAB_DIR + "/" + amKeytabName, keytabRes);
- log.info("Adding AM keytab on hdfs: " + keytabPath);
- } else {
- log.warn("No keytab file was found at {}.", keytabPath);
- if (conf.getBoolean(KEY_AM_LOGIN_KEYTAB_REQUIRED, false)) {
- throw new BadConfigException("No keytab file was found at %s.",
- keytabPath);
- } else {
- log.warn("The AM will be "
- + "started without a kerberos authenticated identity. "
- + "The application is therefore not guaranteed to remain "
- + "operational beyond 24 hours.");
- }
- }
- }
- }
-
- @Override
- public int actionUpgrade(String clustername, ActionUpgradeArgs upgradeArgs)
- throws YarnException, IOException {
- //TODO
- return 0;
- }
-
- @Override
- public int actionKeytab(ActionKeytabArgs keytabInfo)
- throws YarnException, IOException {
- if (keytabInfo.install) {
- return actionInstallKeytab(keytabInfo);
- } else if (keytabInfo.delete) {
- return actionDeleteKeytab(keytabInfo);
- } else if (keytabInfo.list) {
- return actionListKeytab(keytabInfo);
- } else {
- throw new BadCommandArgumentsException(
- "Keytab option specified not found.\n"
- + CommonArgs.usage(serviceArgs, ACTION_KEYTAB));
- }
- }
-
- private int actionListKeytab(ActionKeytabArgs keytabInfo) throws IOException {
- String folder = keytabInfo.folder != null ? keytabInfo.folder : StringUtils.EMPTY;
- Path keytabPath = sliderFileSystem.buildKeytabInstallationDirPath(folder);
- RemoteIterator files =
- sliderFileSystem.getFileSystem().listFiles(keytabPath, true);
- log.info("Keytabs:");
- while (files.hasNext()) {
- log.info("\t" + files.next().getPath().toString());
- }
-
- return EXIT_SUCCESS;
- }
-
- private int actionDeleteKeytab(ActionKeytabArgs keytabInfo)
- throws BadCommandArgumentsException, IOException {
- if (StringUtils.isEmpty(keytabInfo.folder)) {
- throw new BadCommandArgumentsException(
- "A valid destination keytab sub-folder name is required (e.g. 'security').\n"
- + CommonArgs.usage(serviceArgs, ACTION_KEYTAB));
- }
-
- if (StringUtils.isEmpty(keytabInfo.keytab)) {
- throw new BadCommandArgumentsException("A keytab name is required.");
- }
-
- Path pkgPath = sliderFileSystem.buildKeytabInstallationDirPath(keytabInfo.folder);
-
- Path fileInFs = new Path(pkgPath, keytabInfo.keytab );
- log.info("Deleting keytab {}", fileInFs);
- FileSystem sfs = sliderFileSystem.getFileSystem();
- require(sfs.exists(fileInFs), "No keytab to delete found at %s",
- fileInFs.toUri());
- sfs.delete(fileInFs, false);
-
- return EXIT_SUCCESS;
- }
-
- private int actionInstallKeytab(ActionKeytabArgs keytabInfo)
- throws BadCommandArgumentsException, IOException {
- Path srcFile = null;
- require(isSet(keytabInfo.folder),
- "A valid destination keytab sub-folder name is required (e.g. 'security').\n"
- + CommonArgs.usage(serviceArgs, ACTION_KEYTAB));
-
- requireArgumentSet(Arguments.ARG_KEYTAB, keytabInfo.keytab);
- File keytabFile = new File(keytabInfo.keytab);
- require(keytabFile.isFile(),
- "Unable to access supplied keytab file at %s", keytabFile.getAbsolutePath());
- srcFile = new Path(keytabFile.toURI());
-
- Path pkgPath = sliderFileSystem.buildKeytabInstallationDirPath(keytabInfo.folder);
- FileSystem sfs = sliderFileSystem.getFileSystem();
- sfs.mkdirs(pkgPath);
- sfs.setPermission(pkgPath, new FsPermission(
- FsAction.ALL, FsAction.NONE, FsAction.NONE));
-
- Path fileInFs = new Path(pkgPath, srcFile.getName());
- log.info("Installing keytab {} at {} and overwrite is {}.",
- srcFile, fileInFs, keytabInfo.overwrite);
- require(!(sfs.exists(fileInFs) && !keytabInfo.overwrite),
- "Keytab exists at %s. Use --overwrite to overwrite.", fileInFs.toUri());
-
- sfs.copyFromLocalFile(false, keytabInfo.overwrite, srcFile, fileInFs);
- sfs.setPermission(fileInFs,
- new FsPermission(FsAction.READ_WRITE, FsAction.NONE, FsAction.NONE));
-
- return EXIT_SUCCESS;
- }
-
- @Override
- public int actionResource(ActionResourceArgs resourceInfo)
- throws YarnException, IOException {
- if (resourceInfo.help) {
- actionHelp(ACTION_RESOURCE);
- return EXIT_SUCCESS;
- } else if (resourceInfo.install) {
- return actionInstallResource(resourceInfo);
- } else if (resourceInfo.delete) {
- return actionDeleteResource(resourceInfo);
- } else if (resourceInfo.list) {
- return actionListResource(resourceInfo);
- } else {
- throw new BadCommandArgumentsException(
- "Resource option specified not found.\n"
- + CommonArgs.usage(serviceArgs, ACTION_RESOURCE));
- }
- }
-
- private int actionListResource(ActionResourceArgs resourceInfo) throws IOException {
- String folder = resourceInfo.folder != null ? resourceInfo.folder : StringUtils.EMPTY;
- Path path = sliderFileSystem.buildResourcePath(folder);
- RemoteIterator files =
- sliderFileSystem.getFileSystem().listFiles(path, true);
- log.info("Resources:");
- while (files.hasNext()) {
- log.info("\t" + files.next().getPath().toString());
- }
-
- return EXIT_SUCCESS;
- }
-
- private int actionDeleteResource(ActionResourceArgs resourceInfo)
- throws BadCommandArgumentsException, IOException {
- if (StringUtils.isEmpty(resourceInfo.resource)) {
- throw new BadCommandArgumentsException("A file name is required.");
- }
-
- Path fileInFs;
- if (resourceInfo.folder == null) {
- fileInFs = sliderFileSystem.buildResourcePath(resourceInfo.resource);
- } else {
- fileInFs = sliderFileSystem.buildResourcePath(resourceInfo.folder,
- resourceInfo.resource);
- }
-
- log.info("Deleting resource {}", fileInFs);
- FileSystem sfs = sliderFileSystem.getFileSystem();
- require(sfs.exists(fileInFs), "No resource to delete found at %s", fileInFs.toUri());
- sfs.delete(fileInFs, true);
-
- return EXIT_SUCCESS;
- }
-
- private int actionInstallResource(ActionResourceArgs resourceInfo)
- throws BadCommandArgumentsException, IOException {
- Path srcFile = null;
- String folder = resourceInfo.folder != null ? resourceInfo.folder : StringUtils.EMPTY;
-
- requireArgumentSet(Arguments.ARG_RESOURCE, resourceInfo.resource);
- File file = new File(resourceInfo.resource);
- require(file.isFile() || file.isDirectory(),
- "Unable to access supplied file at %s", file.getAbsolutePath());
-
- File[] files;
- if (file.isDirectory()) {
- files = file.listFiles();
- } else {
- files = new File[] { file };
- }
-
- Path pkgPath = sliderFileSystem.buildResourcePath(folder);
- FileSystem sfs = sliderFileSystem.getFileSystem();
-
- if (!sfs.exists(pkgPath)) {
- sfs.mkdirs(pkgPath);
- sfs.setPermission(pkgPath, new FsPermission(
- FsAction.ALL, FsAction.NONE, FsAction.NONE));
- } else {
- require(sfs.isDirectory(pkgPath), "Specified folder %s exists and is " +
- "not a directory", folder);
- }
-
- if (files != null) {
- for (File f : files) {
- srcFile = new Path(f.toURI());
-
- Path fileInFs = new Path(pkgPath, srcFile.getName());
- log.info("Installing file {} at {} and overwrite is {}.",
- srcFile, fileInFs, resourceInfo.overwrite);
- require(!(sfs.exists(fileInFs) && !resourceInfo.overwrite),
- "File exists at %s. Use --overwrite to overwrite.", fileInFs.toUri());
-
- sfs.copyFromLocalFile(false, resourceInfo.overwrite, srcFile, fileInFs);
- sfs.setPermission(fileInFs,
- new FsPermission(FsAction.READ_WRITE, FsAction.NONE, FsAction.NONE));
- }
- }
-
- return EXIT_SUCCESS;
- }
-
- @Override
- public int actionClient(ActionClientArgs clientInfo) throws
- YarnException,
- IOException {
- if (clientInfo.install) {
- // TODO implement client install
- throw new UnsupportedOperationException("Client install not yet " +
- "supported");
- } else {
- throw new BadCommandArgumentsException(
- "Only install, keystore, and truststore commands are supported for the client.\n"
- + CommonArgs.usage(serviceArgs, ACTION_CLIENT));
-
- }
- }
-
- @Override
- public int actionUpdate(String clustername,
- AbstractClusterBuildingActionArgs buildInfo) throws
- YarnException, IOException {
- if (buildInfo.lifetime > 0) {
- updateLifetime(clustername, buildInfo.lifetime);
- } else {
- //TODO upgrade
- }
- return EXIT_SUCCESS;
- }
-
- public String updateLifetime(String appName, long lifetime)
- throws YarnException, IOException {
- EnumSet appStates = EnumSet.range(NEW, RUNNING);
- ApplicationReport report = findInstance(appName, appStates);
- if (report == null) {
- throw new YarnException("Application not found for " + appName);
- }
- ApplicationId appId = report.getApplicationId();
- log.info("Updating lifetime of an application: appName = " + appName
- + ", appId = " + appId+ ", lifetime = " + lifetime);
- Map map = new HashMap<>();
- String newTimeout =
- Times.formatISO8601(System.currentTimeMillis() + lifetime * 1000);
- map.put(ApplicationTimeoutType.LIFETIME, newTimeout);
- UpdateApplicationTimeoutsRequest request =
- UpdateApplicationTimeoutsRequest.newInstance(appId, map);
- yarnClient.updateApplicationTimeouts(request);
- log.info("Successfully updated lifetime for an application: appName = "
- + appName + ", appId = " + appId
- + ". New expiry time in ISO8601 format is " + newTimeout);
- return newTimeout;
- }
-
- protected Map getAmLaunchEnv(Configuration config) {
- String sliderAmLaunchEnv = config.get(KEY_AM_LAUNCH_ENV);
- log.debug("{} = {}", KEY_AM_LAUNCH_ENV, sliderAmLaunchEnv);
- // Multiple env variables can be specified with a comma (,) separator
- String[] envs = StringUtils.isEmpty(sliderAmLaunchEnv) ? null
- : sliderAmLaunchEnv.split(",");
- if (ArrayUtils.isEmpty(envs)) {
- return Collections.emptyMap();
- }
- Map amLaunchEnv = new HashMap<>();
- for (String env : envs) {
- if (StringUtils.isNotEmpty(env)) {
- // Each env name/value is separated by equals sign (=)
- String[] tokens = env.split("=");
- if (tokens != null && tokens.length == 2) {
- String envKey = tokens[0];
- String envValue = tokens[1];
- for (Map.Entry placeholder : generatePlaceholderKeyValueMap(
- env).entrySet()) {
- if (StringUtils.isNotEmpty(placeholder.getValue())) {
- envValue = envValue.replaceAll(
- Pattern.quote(placeholder.getKey()), placeholder.getValue());
- }
- }
- if (Shell.WINDOWS) {
- envValue = "%" + envKey + "%;" + envValue;
- } else {
- envValue = "$" + envKey + ":" + envValue;
- }
- log.info("Setting AM launch env {}={}", envKey, envValue);
- amLaunchEnv.put(envKey, envValue);
- }
- }
- }
- return amLaunchEnv;
- }
-
- protected Map generatePlaceholderKeyValueMap(String env) {
- String PLACEHOLDER_PATTERN = "\\$\\{[^{]+\\}";
- Pattern placeholderPattern = Pattern.compile(PLACEHOLDER_PATTERN);
- Matcher placeholderMatcher = placeholderPattern.matcher(env);
- Map placeholderKeyValueMap = new HashMap<>();
- if (placeholderMatcher.find()) {
- String placeholderKey = placeholderMatcher.group();
- String systemKey = placeholderKey
- .substring(2, placeholderKey.length() - 1).toUpperCase(Locale.ENGLISH)
- .replaceAll("\\.", "_");
- String placeholderValue = getSystemEnv(systemKey);
- log.debug("Placeholder {}={}", placeholderKey, placeholderValue);
- placeholderKeyValueMap.put(placeholderKey, placeholderValue);
- }
- return placeholderKeyValueMap;
- }
-
- /**
- * verify that a live cluster isn't there
- * @param clustername cluster name
- * @param action
- * @throws SliderException with exit code EXIT_CLUSTER_LIVE
- * if a cluster of that name is either live or starting up.
- */
- public void verifyNoLiveApp(String clustername, String action) throws
- IOException,
- YarnException {
- List existing = findAllLiveInstances(clustername);
-
- if (!existing.isEmpty()) {
- throw new SliderException(EXIT_APPLICATION_IN_USE,
- action +" failed for "
- + clustername
- + ": "
- + E_CLUSTER_RUNNING + " :" +
- existing.get(0));
- }
- }
-
- public String getUsername() throws IOException {
- return RegistryUtils.currentUser();
- }
-
- /**
- * Get the name of any deployed cluster
- * @return the cluster name
- */
- public String getDeployedClusterName() {
- return deployedClusterName;
- }
-
- /**
- * ask if the client is using a mini MR cluster
- * @return true if they are
- */
- private boolean getUsingMiniMRCluster() {
- return getConfig().getBoolean(YarnConfiguration.IS_MINI_YARN_CLUSTER,
- false);
- }
-
-
- /**
- * List Slider instances belonging to a specific user with a specific app
- * name and within a set of app states.
- * @param user user: "" means all users, null means "default"
- * @param appName name of the application set as a tag
- * @param appStates a set of states the applications should be in
- * @return a possibly empty list of Slider AMs
- */
- public List listSliderInstances(String user,
- String appName, EnumSet appStates)
- throws YarnException, IOException {
- return yarnAppListClient.listInstances(user, appName, appStates);
- }
-
- /**
- * A basic list action to list live instances
- * @param clustername cluster name
- * @return success if the listing was considered successful
- * @throws IOException
- * @throws YarnException
- */
- public int actionList(String clustername) throws IOException, YarnException {
- ActionListArgs args = new ActionListArgs();
- args.live = true;
- return actionList(clustername, args);
- }
-
- /**
- * Implement the list action.
- * @param clustername List out specific instance name
- * @param args Action list arguments
- * @return 0 if one or more entries were listed
- * @throws IOException
- * @throws YarnException
- * @throws UnknownApplicationInstanceException if a specific instance
- * was named but it was not found
- */
- @Override
- public int actionList(String clustername, ActionListArgs args)
- throws IOException, YarnException {
- Set appInstances = getApplicationList(clustername, args);
- if (!appInstances.isEmpty()) {
- return EXIT_SUCCESS;
- } else {
- return EXIT_FALSE;
- }
- }
-
- /**
- * Retrieve a list of application instances satisfying the query criteria.
- *
- * @param clustername
- * List out specific instance name (set null for all)
- * @param args
- * Action list arguments
- * @return the list of application names which satisfies the list criteria
- * @throws IOException
- * @throws YarnException
- * @throws UnknownApplicationInstanceException
- * if a specific instance was named but it was not found
- */
- public Set getApplicationList(String clustername,
- ActionListArgs args) throws IOException, YarnException {
- if (args.help) {
- actionHelp(ACTION_LIST);
- // the above call throws an exception so the return is not really required
- return Collections.emptySet();
- }
- boolean live = args.live;
- String state = args.state;
- boolean listContainers = args.containers;
- boolean verbose = args.verbose;
- String version = args.version;
- Set components = args.components;
-
- if (live && !state.isEmpty()) {
- throw new BadCommandArgumentsException(
- Arguments.ARG_LIVE + " and " + Arguments.ARG_STATE + " are exclusive");
- }
- if (listContainers && isUnset(clustername)) {
- throw new BadCommandArgumentsException(
- "Should specify an application instance with "
- + Arguments.ARG_CONTAINERS);
- }
- // specifying both --version and --components with --containers is okay
- if (StringUtils.isNotEmpty(version) && !listContainers) {
- throw new BadCommandArgumentsException(Arguments.ARG_VERSION
- + " can be specified only with " + Arguments.ARG_CONTAINERS);
- }
- if (!components.isEmpty() && !listContainers) {
- throw new BadCommandArgumentsException(Arguments.ARG_COMPONENTS
- + " can be specified only with " + Arguments.ARG_CONTAINERS);
- }
-
- // flag to indicate only services in a specific state are to be listed
- boolean listOnlyInState = live || !state.isEmpty();
-
- YarnApplicationState min, max;
- if (live) {
- min = NEW;
- max = RUNNING;
- } else if (!state.isEmpty()) {
- YarnApplicationState stateVal = extractYarnApplicationState(state);
- min = max = stateVal;
- } else {
- min = NEW;
- max = KILLED;
- }
- // get the complete list of persistent instances
- Map persistentInstances = sliderFileSystem.listPersistentInstances();
-
- if (persistentInstances.isEmpty() && isUnset(clustername)) {
- // an empty listing is a success if no cluster was named
- log.debug("No application instances found");
- return Collections.emptySet();
- }
-
- // and those the RM knows about
- EnumSet appStates = EnumSet.range(min, max);
- List instances = listSliderInstances(null, clustername,
- appStates);
- sortApplicationsByMostRecent(instances);
- Map reportMap =
- buildApplicationReportMap(instances, min, max);
- log.debug("Persisted {} deployed {} filtered[{}-{}] & de-duped to {}",
- persistentInstances.size(),
- instances.size(),
- min, max,
- reportMap.size() );
-
- List containers = null;
- if (isSet(clustername)) {
- // only one instance is expected
- // resolve the persistent value
- Path persistent = persistentInstances.get(clustername);
- if (persistent == null) {
- throw unknownClusterException(clustername);
- }
- // create a new map with only that instance in it.
- // this restricts the output of results to this instance
- persistentInstances = new HashMap<>();
- persistentInstances.put(clustername, persistent);
- if (listContainers) {
- containers = getContainers(clustername);
- }
- }
-
- // at this point there is either the entire list or a stripped down instance
- Set listedInstances = new HashSet();
- for (String name : persistentInstances.keySet()) {
- ApplicationReport report = reportMap.get(name);
- if (!listOnlyInState || report != null) {
- // list the details if all were requested, or the filtering contained
- // a report
- listedInstances.add(report);
- // containers will be non-null when only one instance is requested
- String details = instanceDetailsToString(name, report,
- containers, version, components, verbose);
- print(details);
- }
- }
-
- return listedInstances;
- }
-
- public List getContainers(String name)
- throws YarnException, IOException {
- SliderClusterOperations clusterOps = new SliderClusterOperations(
- bondToCluster(name));
- try {
- return clusterOps.getContainers();
- } catch (NoSuchNodeException e) {
- throw new BadClusterStateException(
- "Containers not found for application instance %s", name);
- }
- }
-
-
- /**
- * Extract the state of a Yarn application --state argument
- * @param state state argument
- * @return the application state
- * @throws BadCommandArgumentsException if the argument did not match
- * any known state
- */
- private YarnApplicationState extractYarnApplicationState(String state) throws
- BadCommandArgumentsException {
- YarnApplicationState stateVal;
- try {
- stateVal = YarnApplicationState.valueOf(state.toUpperCase(Locale.ENGLISH));
- } catch (IllegalArgumentException e) {
- throw new BadCommandArgumentsException("Unknown state: " + state);
-
- }
- return stateVal;
- }
-
- /**
- * Is an application active: accepted or running
- * @param report the application report
- * @return true if it is running or scheduled to run.
- */
- public boolean isApplicationActive(ApplicationReport report) {
- return report.getYarnApplicationState() == RUNNING
- || report.getYarnApplicationState() == YarnApplicationState.ACCEPTED;
- }
-
- /**
- * Implement the islive action: probe for a cluster of the given name existing
- * @return exit code
- */
-
- @Override
- @VisibleForTesting
- public int actionFlex(String appName, ActionFlexArgs args)
- throws YarnException, IOException {
- Map componentCounts = new HashMap<>(args.getComponentMap()
- .size());
- for (Entry entry : args.getComponentMap().entrySet()) {
- long numberOfContainers = Long.parseLong(entry.getValue());
- componentCounts.put(entry.getKey(), numberOfContainers);
- }
- // throw usage exception if no changes proposed
- if (componentCounts.size() == 0) {
- actionHelp(ACTION_FLEX);
- }
- flex(appName, componentCounts);
- return EXIT_SUCCESS;
- }
-
- @Override
- public int actionExists(String name, boolean checkLive) throws YarnException, IOException {
- ActionExistsArgs args = new ActionExistsArgs();
- args.live = checkLive;
- return actionExists(name, args);
- }
-
- public int actionExists(String name, ActionExistsArgs args) throws YarnException, IOException {
- validateClusterName(name);
- boolean checkLive = args.live;
- log.debug("actionExists({}, {}, {})", name, checkLive, args.state);
-
- //initial probe for a cluster in the filesystem
- Path clusterDirectory = sliderFileSystem.buildClusterDirPath(name);
- if (!sliderFileSystem.getFileSystem().exists(clusterDirectory)) {
- throw unknownClusterException(name);
- }
- String state = args.state;
- if (!checkLive && isUnset(state)) {
- log.info("Application {} exists", name);
- return EXIT_SUCCESS;
- }
-
- //test for liveness/state
- boolean inDesiredState = false;
- ApplicationReport instance;
- instance = findInstance(name);
- if (instance == null) {
- log.info("Application {} not running", name);
- return EXIT_FALSE;
- }
- if (checkLive) {
- // the app exists, check that it is not in any terminated state
- YarnApplicationState appstate = instance.getYarnApplicationState();
- log.debug(" current app state = {}", appstate);
- inDesiredState = appstate.ordinal() < FINISHED.ordinal();
- } else {
- // scan for instance in single --state state
- state = state.toUpperCase(Locale.ENGLISH);
- YarnApplicationState desiredState = extractYarnApplicationState(state);
- List userInstances = yarnClient
- .listDeployedInstances("", EnumSet.of(desiredState), name);
- ApplicationReport foundInstance =
- yarnClient.findAppInInstanceList(userInstances, name, desiredState);
- if (foundInstance != null) {
- // found in selected state: success
- inDesiredState = true;
- // mark this as the instance to report
- instance = foundInstance;
- }
- }
-
- OnDemandReportStringifier report =
- new OnDemandReportStringifier(instance);
- if (!inDesiredState) {
- //cluster in the list of apps but not running
- log.info("Application {} found but is in wrong state {}", name,
- instance.getYarnApplicationState());
- log.debug("State {}", report);
- return EXIT_FALSE;
- } else {
- log.debug("Application instance is in desired state");
- log.info("Application {} is {}\n{}", name,
- instance.getYarnApplicationState(), report);
- return EXIT_SUCCESS;
- }
- }
-
-
- @Override
- public int actionKillContainer(String name,
- ActionKillContainerArgs args) throws YarnException, IOException {
- String id = args.id;
- if (isUnset(id)) {
- throw new BadCommandArgumentsException("Missing container id");
- }
- log.info("killingContainer {}:{}", name, id);
- SliderClusterOperations clusterOps =
- new SliderClusterOperations(bondToCluster(name));
- try {
- clusterOps.killContainer(id);
- } catch (NoSuchNodeException e) {
- throw new BadClusterStateException("Container %s not found in cluster %s",
- id, name);
- }
- return EXIT_SUCCESS;
- }
-
- /**
- * Find an instance of an application belonging to the current user.
- * @param appname application name
- * @return the app report or null if none is found
- * @throws YarnException YARN issues
- * @throws IOException IO problems
- */
- public ApplicationReport findInstance(String appname)
- throws YarnException, IOException {
- return findInstance(appname, null);
- }
-
- /**
- * Find an instance of an application belonging to the current user and in
- * specific app states.
- * @param appname application name
- * @param appStates app states in which the application should be in
- * @return the app report or null if none is found
- * @throws YarnException YARN issues
- * @throws IOException IO problems
- */
- public ApplicationReport findInstance(String appname,
- EnumSet appStates)
- throws YarnException, IOException {
- return yarnAppListClient.findInstance(appname, appStates);
- }
-
- /**
- * 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 appname application name
- * @return the list of all matching application instances
- */
- private List findAllLiveInstances(String appname)
- throws YarnException, IOException {
-
- return yarnAppListClient.findAllLiveInstances(appname);
- }
-
- /**
- * Connect to a Slider AM
- * @param app application report providing the details on the application
- * @return an instance
- * @throws YarnException
- * @throws IOException
- */
- private SliderClusterProtocol connect(ApplicationReport app)
- throws YarnException, IOException {
-
- try {
- return RpcBinder.getProxy(getConfig(),
- yarnClient.getRmClient(),
- app,
- Constants.CONNECT_TIMEOUT,
- Constants.RPC_TIMEOUT);
- } catch (InterruptedException e) {
- throw new SliderException(SliderExitCodes.EXIT_TIMED_OUT,
- e,
- "Interrupted waiting for communications with the Slider AM");
- }
- }
-
- @Override
- @VisibleForTesting
- public int actionStatus(String clustername, ActionStatusArgs statusArgs)
- throws YarnException, IOException {
- if (statusArgs.lifetime) {
- queryAndPrintLifetime(clustername);
- return EXIT_SUCCESS;
- }
-
- Application application = getApplication(clustername);
- String outfile = statusArgs.getOutput();
- if (outfile == null) {
- log.info(application.toString());
- } else {
- jsonSerDeser.save(application, new File(statusArgs.getOutput()));
- }
- return EXIT_SUCCESS;
- }
-
- @Override
- public Application actionStatus(String clustername)
- throws YarnException, IOException {
- return getApplication(clustername);
- }
-
- private void queryAndPrintLifetime(String appName)
- throws YarnException, IOException {
- ApplicationReport appReport = findInstance(appName);
- if (appReport == null) {
- throw new YarnException("No application found for " + appName);
- }
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- PrintWriter timeoutStr =
- new PrintWriter(new OutputStreamWriter(baos, Charset.forName("UTF-8")));
- try {
- ApplicationTimeout lifetime = appReport.getApplicationTimeouts()
- .get(ApplicationTimeoutType.LIFETIME);
- if (lifetime.getRemainingTime() == -1L) {
- timeoutStr.append(appName + " has no lifetime configured.");
- } else {
- timeoutStr.append("\t" + ApplicationTimeoutType.LIFETIME);
- timeoutStr.print(" expires at : " + lifetime.getExpiryTime());
- timeoutStr.println(
- ".\tRemaining Time : " + lifetime.getRemainingTime() + " seconds");
- }
- System.out.println(baos.toString("UTF-8"));
- } finally {
- timeoutStr.close();
- }
- }
-
- @Override
- public int actionVersion() {
- SliderVersionInfo.loadAndPrintVersionInfo(log);
- return EXIT_SUCCESS;
- }
-
- @Override
- public int actionStop(String appName, ActionFreezeArgs freezeArgs)
- throws YarnException, IOException {
- validateClusterName(appName);
- ApplicationReport app = findInstance(appName);
- if (app == null) {
- throw new ApplicationNotFoundException(
- "Application " + appName + " doesn't exist in RM.");
- }
-
- if (terminatedStates.contains(app.getYarnApplicationState())) {
- log.info("Application {} is already in a terminated state {}", appName,
- app.getYarnApplicationState());
- return EXIT_SUCCESS;
- }
-
- try {
- SliderClusterProtocol appMaster = connect(app);
- Messages.StopClusterRequestProto r =
- Messages.StopClusterRequestProto.newBuilder()
- .setMessage(freezeArgs.message).build();
- appMaster.stopCluster(r);
- log.info("Application " + appName + " is being gracefully stopped...");
- long startTime = System.currentTimeMillis();
- int pollCount = 0;
- while (true) {
- Thread.sleep(200);
- ApplicationReport report =
- yarnClient.getApplicationReport(app.getApplicationId());
- if (terminatedStates.contains(report.getYarnApplicationState())) {
- log.info("Application " + appName + " is stopped.");
- break;
- }
- // kill after 10 seconds.
- if ((System.currentTimeMillis() - startTime) > 10000) {
- log.info("Stop operation timeout stopping, forcefully kill the app "
- + appName);
- yarnClient
- .killApplication(app.getApplicationId(), freezeArgs.message);
- break;
- }
- if (++pollCount % 10 == 0) {
- log.info("Waiting for application " + appName + " to be stopped.");
- }
- }
- } catch (IOException | YarnException | InterruptedException e) {
- log.info("Failed to stop " + appName
- + " gracefully, forcefully kill the app.");
- yarnClient.killApplication(app.getApplicationId(), freezeArgs.message);
- }
- return EXIT_SUCCESS;
- }
-
- @Override
- public int actionStart(String appName, ActionThawArgs thaw)
- throws YarnException, IOException {
- validateClusterName(appName);
- Path appDir = checkAppExistOnHdfs(appName);
- Application application = ServiceApiUtil.loadApplication(sliderFileSystem,
- appName);
- ServiceApiUtil.validateAndResolveApplication(application,
- sliderFileSystem, getConfig());
- // see if it is actually running and bail out;
- verifyNoLiveApp(appName, "Thaw");
- ApplicationId appId = submitApp(application);
- application.setId(appId.toString());
- // write app definition on to hdfs
- persistApp(appDir, application);
- return 0;
- }
-
- public Map flex(String appName, Map
- componentCounts) throws YarnException, IOException {
- validateClusterName(appName);
- Application persistedApp = ServiceApiUtil.loadApplication(sliderFileSystem,
- appName);
- Map original = new HashMap<>(componentCounts.size());
- for (Component persistedComp : persistedApp.getComponents()) {
- String name = persistedComp.getName();
- if (componentCounts.containsKey(persistedComp.getName())) {
- original.put(name, persistedComp.getNumberOfContainers());
- persistedComp.setNumberOfContainers(componentCounts.get(name));
- }
- }
- if (original.size() < componentCounts.size()) {
- componentCounts.keySet().removeAll(original.keySet());
- throw new YarnException("Components " + componentCounts.keySet()
- + " do not exist in app definition.");
- }
- jsonSerDeser
- .save(sliderFileSystem.getFileSystem(), ServiceApiUtil.getAppJsonPath(
- sliderFileSystem, appName), persistedApp, true);
- log.info("Updated app definition file for components " + componentCounts
- .keySet());
-
- ApplicationReport instance = findInstance(appName);
- if (instance != null) {
- log.info("Flexing running app " + appName);
- SliderClusterProtocol appMaster = connect(instance);
- SliderClusterOperations clusterOps =
- new SliderClusterOperations(appMaster);
- clusterOps.flex(componentCounts);
- for (Entry componentCount : componentCounts.entrySet()) {
- log.info(
- "Application name = " + appName + ", Component name = " +
- componentCount.getKey() + ", number of containers updated " +
- "from " + original.get(componentCount.getKey()) + " to " +
- componentCount.getValue());
- }
- } else {
- String message = "Application " + appName + "does not exist in RM. ";
- throw new YarnException(message);
- }
- return original;
- }
-
- /**
- * Connect to a live cluster and get its current state
- *
- * @param appName the cluster name
- * @return its description
- */
- @VisibleForTesting
- public Application getApplication(String appName)
- throws YarnException, IOException {
- validateClusterName(appName);
- SliderClusterOperations clusterOperations =
- createClusterOperations(appName);
- return clusterOperations.getApplication();
- }
-
- private ClientAMProtocol connectToAM(String appName)
- throws IOException, YarnException {
- if (applicationId == null) {
- Application persistedApp = ServiceApiUtil.loadApplication(sliderFileSystem,
- appName);
- if (persistedApp == null) {
- throw new YarnException("Application " + appName
- + " doesn't exist on hdfs. Please check if the app exists in RM");
- }
- applicationId = ApplicationId.fromString(persistedApp.getId());
- }
- // Wait until app becomes running.
- long startTime = System.currentTimeMillis();
- int pollCount = 0;
- ApplicationReport appReport = null;
- while (true) {
- appReport = yarnClient.getApplicationReport(applicationId);
- YarnApplicationState state = appReport.getYarnApplicationState();
- if (state == RUNNING) {
- break;
- }
- if (terminatedStates.contains(state)) {
- throw new YarnException(
- "Failed to getStatus " + applicationId + ": " + appReport
- .getDiagnostics());
- }
- long elapsedMillis = System.currentTimeMillis() - startTime;
- // if over 5 min, quit
- if (elapsedMillis >= 300000) {
- throw new YarnException(
- "Timed out while waiting for application " + applicationId
- + " to be running");
- }
-
- if (++pollCount % 10 == 0) {
- log.info("Waiting for application {} to be running, current state is {}",
- applicationId, state);
- }
- try {
- Thread.sleep(3000);
- } catch (InterruptedException ie) {
- String msg =
- "Interrupted while waiting for application " + applicationId
- + " to be running.";
- throw new YarnException(msg, ie);
- }
- }
-
- // Make the connection
- InetSocketAddress address = NetUtils
- .createSocketAddrForHost(appReport.getHost(), appReport.getRpcPort());
- return ClientAMProxy
- .createProxy(getConfig(), ClientAMProtocol.class,
- UserGroupInformation.getCurrentUser(), rpc, address);
- }
-
- public Application getStatus(String appName)
- throws IOException, YarnException {
- ClientAMProtocol proxy = connectToAM(appName);
- GetStatusResponseProto response =
- proxy.getStatus(GetStatusRequestProto.newBuilder().build());
- Application app = jsonSerDeser.fromJson(response.getStatus());
- return app;
- }
-
-
- /**
- * Bond to a running cluster
- * @param clustername cluster name
- * @return the AM RPC client
- * @throws SliderException if the cluster is unkown
- */
- private SliderClusterProtocol bondToCluster(String clustername) throws
- YarnException,
- IOException {
- if (clustername == null) {
- throw unknownClusterException("(undefined)");
- }
- ApplicationReport instance = findInstance(clustername,
- SliderUtils.getAllLiveAppStates());
- if (null == instance) {
- throw unknownClusterException(clustername);
- }
- return connect(instance);
- }
-
- /**
- * Create a cluster operations instance against a given cluster
- * @param clustername cluster name
- * @return a bonded cluster operations instance
- * @throws YarnException YARN issues
- * @throws IOException IO problems
- */
- private SliderClusterOperations createClusterOperations(String clustername) throws
- YarnException,
- IOException {
- SliderClusterProtocol sliderAM = bondToCluster(clustername);
- return new SliderClusterOperations(sliderAM);
- }
-
- /**
- * Generate an exception for an unknown cluster
- * @param clustername cluster name
- * @return an exception with text and a relevant exit code
- */
- public UnknownApplicationInstanceException unknownClusterException(String clustername) {
- return UnknownApplicationInstanceException.unknownInstance(clustername);
- }
-
- @Override
- public String toString() {
- return "Slider Client in state " + getServiceState()
- + " and Slider Application Instance " + deployedClusterName;
- }
-
- /**
- * Get all YARN applications
- * @return a possibly empty list
- * @throws YarnException
- * @throws IOException
- */
- @VisibleForTesting
- public List getApplications()
- throws YarnException, IOException {
- return yarnClient.getApplications();
- }
-
- @Override
- public int actionResolve(ActionResolveArgs args)
- throws YarnException, IOException {
- // as this is an API entry point, validate
- // the arguments
- args.validate();
- String path = SliderRegistryUtils.resolvePath(args.path);
- ServiceRecordMarshal serviceRecordMarshal = new ServiceRecordMarshal();
- try {
- if (args.list) {
- File destDir = args.destdir;
- if (destDir != null && !destDir.exists() && !destDir.mkdirs()) {
- throw new IOException("Failed to create directory: " + destDir);
- }
-
-
- Map recordMap;
- Map znodes;
- try {
- znodes = statChildren(registryOperations, path);
- recordMap = extractServiceRecords(registryOperations,
- path,
- znodes.values());
- } catch (PathNotFoundException e) {
- // treat the root directory as if if is always there
-
- if ("/".equals(path)) {
- znodes = new HashMap<>(0);
- recordMap = new HashMap<>(0);
- } else {
- throw e;
- }
- }
- // subtract all records from the znodes map to get pure directories
- log.info("Entries: {}", znodes.size());
-
- for (String name : znodes.keySet()) {
- println(" " + name);
- }
- println("");
-
- log.info("Service records: {}", recordMap.size());
- for (Entry recordEntry : recordMap.entrySet()) {
- String name = recordEntry.getKey();
- ServiceRecord instance = recordEntry.getValue();
- String json = serviceRecordMarshal.toJson(instance);
- if (destDir == null) {
- println(name);
- println(json);
- } else {
- String filename = RegistryPathUtils.lastPathEntry(name) + ".json";
- File jsonFile = new File(destDir, filename);
- write(jsonFile, serviceRecordMarshal.toBytes(instance));
- }
- }
- } else {
- // resolve single entry
- ServiceRecord instance = resolve(path);
- File outFile = args.out;
- if (args.destdir != null) {
- outFile = new File(args.destdir, RegistryPathUtils.lastPathEntry(path));
- }
- if (outFile != null) {
- write(outFile, serviceRecordMarshal.toBytes(instance));
- } else {
- println(serviceRecordMarshal.toJson(instance));
- }
- }
- } catch (PathNotFoundException | NoRecordException e) {
- // no record at this path
- throw new NotFoundException(e, path);
- }
- return EXIT_SUCCESS;
- }
-
- @Override
- public int actionRegistry(ActionRegistryArgs registryArgs) throws
- YarnException,
- IOException {
- // as this is also a test entry point, validate
- // the arguments
- registryArgs.validate();
- try {
- if (registryArgs.list) {
- actionRegistryList(registryArgs);
- } else if (registryArgs.listConf) {
- // list the configurations
- actionRegistryListConfigsYarn(registryArgs);
- } else if (registryArgs.listExports) {
- // list the exports
- actionRegistryListExports(registryArgs);
- } else if (isSet(registryArgs.getConf)) {
- // get a configuration
- PublishedConfiguration publishedConfiguration =
- actionRegistryGetConfig(registryArgs);
- outputConfig(publishedConfiguration, registryArgs);
- } else if (isSet(registryArgs.getExport)) {
- // get a export group
- PublishedExports publishedExports =
- actionRegistryGetExport(registryArgs);
- outputExport(publishedExports, registryArgs);
- } else {
- // it's an unknown command
- log.info(CommonArgs.usage(serviceArgs, ACTION_DIAGNOSTICS));
- return EXIT_USAGE;
- }
-// JDK7
- } catch (FileNotFoundException e) {
- log.info("{}", e.toString());
- log.debug("{}", e, e);
- return EXIT_NOT_FOUND;
- } catch (PathNotFoundException e) {
- log.info("{}", e.toString());
- log.debug("{}", e, e);
- return EXIT_NOT_FOUND;
- }
- return EXIT_SUCCESS;
- }
-
- /**
- * Registry operation
- *
- * @param registryArgs registry Arguments
- * @return the instances (for tests)
- * @throws YarnException YARN problems
- * @throws IOException Network or other problems
- */
- @VisibleForTesting
- public Collection actionRegistryList(
- ActionRegistryArgs registryArgs)
- throws YarnException, IOException {
- String serviceType = registryArgs.serviceType;
- String name = registryArgs.name;
- RegistryOperations operations = getRegistryOperations();
- Collection serviceRecords;
- if (StringUtils.isEmpty(name)) {
- String path = serviceclassPath(currentUser(), serviceType);
-
- try {
- Map recordMap =
- listServiceRecords(operations, path);
- if (recordMap.isEmpty()) {
- throw new UnknownApplicationInstanceException(
- "No applications registered under " + path);
- }
- serviceRecords = recordMap.values();
- } catch (PathNotFoundException e) {
- throw new NotFoundException(path, e);
- }
- } else {
- ServiceRecord instance = lookupServiceRecord(registryArgs);
- serviceRecords = new ArrayList<>(1);
- serviceRecords.add(instance);
- }
-
- for (ServiceRecord serviceRecord : serviceRecords) {
- logInstance(serviceRecord, registryArgs.verbose);
- }
- return serviceRecords;
- }
-
- @Override
- public int actionDiagnostic(ActionDiagnosticArgs diagnosticArgs) {
- try {
- if (diagnosticArgs.client) {
- actionDiagnosticClient(diagnosticArgs);
- } else if (diagnosticArgs.application) {
- // TODO print configs of application - get from AM
- } else if (diagnosticArgs.yarn) {
- // This method prints yarn nodes info and yarn configs.
- // We can just use yarn node CLI instead which is much more richful
- // for yarn configs, this method reads local config which is only client
- // config not cluster configs.
-// actionDiagnosticYarn(diagnosticArgs);
- } else if (diagnosticArgs.credentials) {
- // actionDiagnosticCredentials internall only runs a bare 'klist' command...
- // IMHO, the user can just run klist on their own with extra options supported, don't
- // actually see the point of this method.
-// actionDiagnosticCredentials();
- } else if (diagnosticArgs.all) {
- actionDiagnosticAll(diagnosticArgs);
- } else if (diagnosticArgs.level) {
- // agent is removed
- } else {
- // it's an unknown option
- log.info(CommonArgs.usage(serviceArgs, ACTION_DIAGNOSTICS));
- return EXIT_USAGE;
- }
- } catch (Exception e) {
- log.error(e.toString());
- return EXIT_FALSE;
- }
- return EXIT_SUCCESS;
- }
-
- private void actionDiagnosticAll(ActionDiagnosticArgs diagnosticArgs)
- throws IOException, YarnException {
- // assign application name from param to each sub diagnostic function
- actionDiagnosticClient(diagnosticArgs);
- // actionDiagnosticSlider only prints the agent location on hdfs,
- // which is invalid now.
- // actionDiagnosticCredentials only runs 'klist' command, IMHO, the user
- // can just run klist on its own with extra options supported, don't
- // actually see the point of this method.
- }
-
- private void actionDiagnosticClient(ActionDiagnosticArgs diagnosticArgs)
- throws SliderException, IOException {
- try {
- String currentCommandPath = getCurrentCommandPath();
- SliderVersionInfo.loadAndPrintVersionInfo(log);
- String clientConfigPath = getClientConfigPath();
- String jdkInfo = getJDKInfo();
- println("The slider command path: %s", currentCommandPath);
- println("The slider-client.xml used by current running command path: %s",
- clientConfigPath);
- println(jdkInfo);
-
- // security info
- Configuration config = getConfig();
- if (isHadoopClusterSecure(config)) {
- println("Hadoop Cluster is secure");
- println("Login user is %s", UserGroupInformation.getLoginUser());
- println("Current user is %s", UserGroupInformation.getCurrentUser());
-
- } else {
- println("Hadoop Cluster is insecure");
- }
-
- // verbose?
- if (diagnosticArgs.verbose) {
- // do the environment
- Map env = getSystemEnv();
- Set envList = ConfigHelper.sortedConfigKeys(env.entrySet());
- StringBuilder builder = new StringBuilder("Environment variables:\n");
- for (String key : envList) {
- builder.append(key).append("=").append(env.get(key)).append("\n");
- }
- println(builder.toString());
-
- // Java properties
- builder = new StringBuilder("JVM Properties\n");
- Map props =
- sortedMap(toMap(System.getProperties()));
- for (Entry entry : props.entrySet()) {
- builder.append(entry.getKey()).append("=")
- .append(entry.getValue()).append("\n");
- }
-
- println(builder.toString());
-
- // then the config
- println("Slider client configuration:\n" + ConfigHelper.dumpConfigToString(config));
- }
-
- validateSliderClientEnvironment(log);
- } catch (SliderException | IOException e) {
- log.error(e.toString());
- throw e;
- }
-
- }
-
- /**
- * Kerberos Diagnostics
- * @param args CLI arguments
- * @return exit code
- * @throws SliderException
- * @throws IOException
- */
- @SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
- private int actionKDiag(ActionKDiagArgs args)
- throws Exception {
- PrintStream out;
- boolean closeStream = false;
- if (args.out != null) {
- out = new PrintStream(args.out, "UTF-8");
- closeStream = true;
- } else {
- out = System.err;
- }
- try {
- KerberosDiags kdiags = new KerberosDiags(getConfig(),
- out,
- args.services,
- args.keytab,
- args.principal,
- args.keylen,
- args.secure);
- kdiags.execute();
- } catch (KerberosDiags.KerberosDiagsFailure e) {
- log.error(e.toString());
- log.debug(e.toString(), e);
- throw e;
- } catch (Exception e) {
- log.error("Kerberos Diagnostics", e);
- throw e;
- } finally {
- if (closeStream) {
- out.flush();
- out.close();
- }
- }
- return 0;
- }
-
- /**
- * Log a service record instance
- * @param instance record
- * @param verbose verbose logging of all external endpoints
- */
- private void logInstance(ServiceRecord instance,
- boolean verbose) {
- if (!verbose) {
- log.info("{}", instance.get(YarnRegistryAttributes.YARN_ID, ""));
- } else {
- log.info("{}: ", instance.get(YarnRegistryAttributes.YARN_ID, ""));
- logEndpoints(instance);
- }
- }
-
- /**
- * Log the external endpoints of a service record
- * @param instance service record instance
- */
- private void logEndpoints(ServiceRecord instance) {
- List endpoints = instance.external;
- for (Endpoint endpoint : endpoints) {
- log.info(endpoint.toString());
- }
- }
-
- /**
- * list configs available for an instance
- *
- * @param registryArgs registry Arguments
- * @throws YarnException YARN problems
- * @throws IOException Network or other problems
- */
- public void actionRegistryListConfigsYarn(ActionRegistryArgs registryArgs)
- throws YarnException, IOException {
-
- ServiceRecord instance = lookupServiceRecord(registryArgs);
-
- RegistryRetriever retriever = new RegistryRetriever(getConfig(), instance);
- PublishedConfigSet configurations =
- retriever.getConfigurations(!registryArgs.internal);
- PrintStream out = null;
- try {
- if (registryArgs.out != null) {
- out = new PrintStream(registryArgs.out, "UTF-8");
- } else {
- out = System.out;
- }
- for (String configName : configurations.keys()) {
- if (!registryArgs.verbose) {
- out.println(configName);
- } else {
- PublishedConfiguration published = configurations.get(configName);
- out.printf("%s: %s%n", configName, published.description);
- }
- }
- } finally {
- if (registryArgs.out != null && out != null) {
- out.flush();
- out.close();
- }
- }
- }
-
- /**
- * list exports available for an instance
- *
- * @param registryArgs registry Arguments
- * @throws YarnException YARN problems
- * @throws IOException Network or other problems
- */
- public void actionRegistryListExports(ActionRegistryArgs registryArgs)
- throws YarnException, IOException {
- ServiceRecord instance = lookupServiceRecord(registryArgs);
-
- RegistryRetriever retriever = new RegistryRetriever(getConfig(), instance);
- PublishedExportsSet exports =
- retriever.getExports(!registryArgs.internal);
- PrintStream out = null;
- boolean streaming = false;
- try {
- if (registryArgs.out != null) {
- out = new PrintStream(registryArgs.out, "UTF-8");
- streaming = true;
- log.debug("Saving output to {}", registryArgs.out);
- } else {
- out = System.out;
- }
- log.debug("Number of exports: {}", exports.keys().size());
- for (String exportName : exports.keys()) {
- if (streaming) {
- log.debug(exportName);
- }
- if (!registryArgs.verbose) {
- out.println(exportName);
- } else {
- PublishedExports published = exports.get(exportName);
- out.printf("%s: %s%n", exportName, published.description);
- }
- }
- } finally {
- if (streaming) {
- out.flush();
- out.close();
- }
- }
- }
-
- /**
- * list configs available for an instance
- *
- * @param registryArgs registry Arguments
- * @throws YarnException YARN problems
- * @throws IOException Network or other problems
- * @throws FileNotFoundException if the config is not found
- */
- @VisibleForTesting
- public PublishedConfiguration actionRegistryGetConfig(ActionRegistryArgs registryArgs)
- throws YarnException, IOException {
- return ClientUtils.getConfigFromRegistry(getRegistryOperations(),
- getConfig(), registryArgs.getConf, registryArgs.name, registryArgs.user,
- !registryArgs.internal);
- }
-
- /**
- * get a specific export group
- *
- * @param registryArgs registry Arguments
- *
- * @throws YarnException YARN problems
- * @throws IOException Network or other problems
- * @throws FileNotFoundException if the config is not found
- */
- @VisibleForTesting
- public PublishedExports actionRegistryGetExport(ActionRegistryArgs registryArgs)
- throws YarnException, IOException {
- ServiceRecord instance = lookupServiceRecord(registryArgs);
-
- RegistryRetriever retriever = new RegistryRetriever(getConfig(), instance);
- boolean external = !registryArgs.internal;
- PublishedExportsSet exports = retriever.getExports(external);
-
- PublishedExports published = retriever.retrieveExports(exports,
- registryArgs.getExport,
- external);
- return published;
- }
-
- /**
- * write out the config. If a destination is provided and that dir is a
- * directory, the entry is written to it with the name provided + extension,
- * else it is printed to standard out.
- * @param published published config
- * @param registryArgs registry Arguments
- * @throws BadCommandArgumentsException
- * @throws IOException
- */
- private void outputConfig(PublishedConfiguration published,
- ActionRegistryArgs registryArgs) throws
- BadCommandArgumentsException,
- IOException {
- // decide whether or not to print
- String entry = registryArgs.getConf;
- String format = registryArgs.format;
- String output = ClientUtils.saveOrReturnConfig(published,
- registryArgs.format, registryArgs.out, entry + "." + format);
- if (output != null) {
- print(output);
- }
- }
-
- /**
- * write out the config
- * @param published
- * @param registryArgs
- * @throws BadCommandArgumentsException
- * @throws IOException
- */
- private void outputExport(PublishedExports published,
- ActionRegistryArgs registryArgs) throws
- BadCommandArgumentsException,
- IOException {
- // decide whether or not to print
- String entry = registryArgs.getExport;
- String format = ConfigFormat.JSON.toString();
- ConfigFormat configFormat = ConfigFormat.resolve(format);
- if (configFormat == null || configFormat != ConfigFormat.JSON) {
- throw new BadCommandArgumentsException(
- "Unknown/Unsupported format %s . Only JSON is supported.", format);
- }
-
- PublishedExportsOutputter outputter =
- PublishedExportsOutputter.createOutputter(configFormat,
- published);
- boolean print = registryArgs.out == null;
- if (!print) {
- File destFile;
- destFile = registryArgs.out;
- if (destFile.isDirectory()) {
- // creating it under a directory
- destFile = new File(destFile, entry + "." + format);
- }
- log.info("Destination path: {}", destFile);
- outputter.save(destFile);
- } else {
- print(outputter.asString());
- }
- }
-
- /**
- * Look up an instance
- * @return instance data
- * @throws SliderException other failures
- * @throws IOException IO problems or wrapped exceptions
- */
- private ServiceRecord lookupServiceRecord(ActionRegistryArgs registryArgs) throws
- SliderException,
- IOException {
- return ClientUtils.lookupServiceRecord(getRegistryOperations(),
- registryArgs.user, registryArgs.serviceType, registryArgs.name);
- }
-
- /**
- *
- * Look up an instance
- * @param path path
- * @return instance data
- * @throws NotFoundException no path/no service record
- * at the end of the path
- * @throws SliderException other failures
- * @throws IOException IO problems or wrapped exceptions
- */
- public ServiceRecord resolve(String path)
- throws IOException, SliderException {
- return ClientUtils.resolve(getRegistryOperations(), path);
- }
-
- /**
- * List instances in the registry for the current user
- * @return a list of slider registry instances
- * @throws IOException Any IO problem ... including no path in the registry
- * to slider service classes for this user
- * @throws SliderException other failures
- */
-
- public Map listRegistryInstances()
- throws IOException, SliderException {
- Map recordMap = listServiceRecords(
- getRegistryOperations(),
- serviceclassPath(currentUser(), SliderKeys.APP_TYPE));
- return recordMap;
- }
-
- /**
- * List instances in the registry
- * @return the instance IDs
- * @throws IOException
- * @throws YarnException
- */
- public List listRegisteredSliderInstances() throws
- IOException,
- YarnException {
- try {
- Map recordMap = listServiceRecords(
- getRegistryOperations(),
- serviceclassPath(currentUser(), SliderKeys.APP_TYPE));
- return new ArrayList<>(recordMap.keySet());
- } catch (PathNotFoundException e) {
- log.debug("No registry path for slider instances for current user: {}", e, e);
- // no entries: return an empty list
- return new ArrayList<>(0);
- } catch (IOException | YarnException e) {
- throw e;
- } catch (Exception e) {
- throw new IOException(e);
- }
- }
-
- /**
- * Start the registry if it is not there yet
- * @return the registry service
- * @throws SliderException
- * @throws IOException
- */
- private synchronized RegistryOperations maybeStartYarnRegistry()
- throws SliderException, IOException {
-
- if (registryOperations == null) {
- registryOperations = startRegistryOperationsService();
- }
- return registryOperations;
- }
-
- @Override
- public RegistryOperations getRegistryOperations()
- throws SliderException, IOException {
- return maybeStartYarnRegistry();
- }
-
- /**
- * Output to standard out/stderr (implementation specific detail)
- * @param src source
- */
- private static void print(CharSequence src) {
- clientOutputStream.print(src);
- }
-
- /**
- * Output to standard out/stderr with a newline after
- * @param message message
- */
- private static void println(String message) {
- clientOutputStream.println(message);
- }
- /**
- * Output to standard out/stderr with a newline after, formatted
- * @param message message
- * @param args arguments for string formatting
- */
- private static void println(String message, Object ... args) {
- clientOutputStream.println(String.format(message, args));
- }
-
- /**
- * Implement the lookup action.
- * @param args Action arguments
- * @return 0 if the entry was found
- * @throws IOException
- * @throws YarnException
- * @throws UnknownApplicationInstanceException if a specific instance
- * was named but it was not found
- */
- @VisibleForTesting
- public int actionLookup(ActionLookupArgs args)
- throws IOException, YarnException {
- try {
- ApplicationId id = ConverterUtils.toApplicationId(args.id);
- ApplicationReport report = yarnClient.getApplicationReport(id);
- SerializedApplicationReport sar = new SerializedApplicationReport(report);
- ApplicationReportSerDeser serDeser = new ApplicationReportSerDeser();
- if (args.outputFile != null) {
- serDeser.save(sar, args.outputFile);
- } else {
- println(serDeser.toJson(sar));
- }
- } catch (IllegalArgumentException e) {
- throw new BadCommandArgumentsException(e, "%s : %s", args, e);
- } catch (ApplicationAttemptNotFoundException | ApplicationNotFoundException notFound) {
- throw new NotFoundException(notFound, notFound.toString());
- }
- return EXIT_SUCCESS;
- }
-
- @Override
- public int actionDependency(ActionDependencyArgs args) throws IOException,
- YarnException {
- String currentUser = getUsername();
- log.info("Running command as user {}", currentUser);
-
- String version = getSliderVersion();
- Path dependencyLibTarGzip = sliderFileSystem.getDependencyTarGzip();
-
- // Check if dependency has already been uploaded, in which case log
- // appropriately and exit success (unless overwrite has been requested)
- if (sliderFileSystem.isFile(dependencyLibTarGzip) && !args.overwrite) {
- println(String.format(
- "Dependency libs are already uploaded to %s. Use %s "
- + "if you want to re-upload", dependencyLibTarGzip.toUri(),
- Arguments.ARG_OVERWRITE));
- return EXIT_SUCCESS;
- }
-
- String[] libDirs = SliderUtils.getLibDirs();
- if (libDirs.length > 0) {
- File tempLibTarGzipFile = File.createTempFile(
- SliderKeys.SLIDER_DEPENDENCY_TAR_GZ_FILE_NAME + "_",
- SliderKeys.SLIDER_DEPENDENCY_TAR_GZ_FILE_EXT);
- // copy all jars
- tarGzipFolder(libDirs, tempLibTarGzipFile, createJarFilter());
-
- log.info("Uploading dependency for AM (version {}) from {} to {}",
- version, tempLibTarGzipFile.toURI(), dependencyLibTarGzip.toUri());
- sliderFileSystem.copyLocalFileToHdfs(tempLibTarGzipFile,
- dependencyLibTarGzip, new FsPermission(
- SliderKeys.SLIDER_DEPENDENCY_DIR_PERMISSIONS));
- return EXIT_SUCCESS;
- } else {
- return EXIT_FALSE;
- }
- }
-
- private int actionHelp(String actionName) throws YarnException, IOException {
- throw new UsageException(CommonArgs.usage(serviceArgs, actionName));
- }
-
- /**
- * List the nodes in the cluster, possibly filtering by node state or label.
- *
- * @param args argument list
- * @return a possibly empty list of nodes in the cluster
- * @throws IOException IO problems
- * @throws YarnException YARN problems
- */
- @Override
- public NodeInformationList listYarnClusterNodes(ActionNodesArgs args)
- throws YarnException, IOException {
- return yarnClient.listNodes(args.label, args.healthy);
- }
-
- /**
- * List the nodes in the cluster, possibly filtering by node state or label.
- *
- * @param args argument list
- * @return a possibly empty list of nodes in the cluster
- * @throws IOException IO problems
- * @throws YarnException YARN problems
- */
- public NodeInformationList listInstanceNodes(String instance, ActionNodesArgs args)
- throws YarnException, IOException {
- // TODO
- log.info("listInstanceNodes {}", instance);
- SliderClusterOperations clusterOps =
- new SliderClusterOperations(bondToCluster(instance));
- return clusterOps.getLiveNodes();
- }
-
- /**
- * List the nodes in the cluster, possibly filtering by node state or label.
- * Prints them to stdout unless the args names a file instead.
- * @param args argument list
- * @throws IOException IO problems
- * @throws YarnException YARN problems
- */
- public int actionNodes(String instance, ActionNodesArgs args) throws YarnException, IOException {
-
- args.instance = instance;
- NodeInformationList nodes;
- if (SliderUtils.isUnset(instance)) {
- nodes = listYarnClusterNodes(args);
- } else {
- nodes = listInstanceNodes(instance, args);
- }
- log.debug("Node listing for {} has {} nodes", args, nodes.size());
- JsonSerDeser serDeser = NodeInformationList.createSerializer();
- if (args.outputFile != null) {
- serDeser.save(nodes, args.outputFile);
- } else {
- println(serDeser.toJson(nodes));
- }
- return 0;
- }
-
- /**
- * Save/list tokens. This is for testing oozie integration
- * @param args commands
- * @return status
- */
- private int actionTokens(ActionTokensArgs args)
- throws IOException, YarnException {
- return new TokensOperation().actionTokens(args,
- sliderFileSystem.getFileSystem(),
- getConfig(),
- yarnClient);
- }
-
- @VisibleForTesting
- public ApplicationReport monitorAppToRunning(Duration duration)
- throws YarnException, IOException {
- return yarnClient.monitorAppToState(applicationId, RUNNING, duration);
- }
-}
-
-
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.
- *
- * 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;
-}
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 deployedinstances belonging to a specific user in a
- * given set of states and filtered by an application name tag.
- *
- * 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 listDeployedInstances(String user,
- EnumSet appStates, String appname)
- throws YarnException, IOException {
- Preconditions.checkArgument(user != null, "Null User");
- Set types = new HashSet<>(1);
- types.add(SliderKeys.APP_TYPE);
- Set tags = null;
- if (appname != null) {
- tags = Collections.singleton(SliderUtils.createNameTag(appname));
- }
- List allApps = getApplications(types, appStates, tags);
- List 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 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 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 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 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();
- }
- }
-}
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;
- }
-
-}
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 jsonSerDeser =
- new JsonSerDeser(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 convertNodeWireToClusterNodes(List nodes)
- throws IOException {
- List 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 uuidList = innerListNodeUUIDSByRole(role);
- String[] uuids = new String[uuidList.size()];
- return uuidList.toArray(uuids);
- }
-
- public List 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 listClusterNodesInRole(String role)
- throws IOException, YarnException {
-
- Collection 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 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 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 componentCounts) throws IOException{
- Messages.FlexComponentsRequestProto.Builder builder =
- Messages.FlexComponentsRequestProto.newBuilder();
- for (Entry 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 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);
- }
-}
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";
-}
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";
-
-}
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;
-}
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;
-
-}
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/ActionLookupArgs.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/ActionLookupArgs.java
deleted file mode 100644
index 0888812..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/ActionLookupArgs.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.common.params;
-
-import com.beust.jcommander.Parameter;
-import com.beust.jcommander.Parameters;
-import org.apache.commons.lang.StringUtils;
-import org.apache.hadoop.yarn.service.client.params.AbstractActionArgs;
-import org.apache.hadoop.yarn.service.client.params.SliderActions;
-import org.apache.slider.core.exceptions.BadCommandArgumentsException;
-import org.apache.slider.core.exceptions.UsageException;
-
-import java.io.File;
-
-@Parameters(commandNames = { SliderActions.ACTION_LOOKUP},
- commandDescription = SliderActions.DESCRIBE_ACTION_LOOKUP)
-
-public class ActionLookupArgs extends AbstractActionArgs {
- @Override
- public String getActionName() {
- return SliderActions.ACTION_LOOKUP;
- }
-
- public int getMinParams() {
- return 0;
- }
- public int getMaxParams() {
- return 0;
- }
-
- @Parameter(names = {ARG_ID},
- description = "ID of the application")
- public String id;
-
- @Parameter(names = {ARG_OUTPUT, ARG_OUTPUT_SHORT},
- description = "output file for any application report")
- public File outputFile;
-
- @Override
- public void validate() throws BadCommandArgumentsException, UsageException {
- super.validate();
- if (StringUtils.isEmpty(id)) {
- throw new BadCommandArgumentsException("Missing mandatory argument "
- + ARG_ID);
- }
- }
-
- @Override
- public String toString() {
- final StringBuilder sb =
- new StringBuilder(SliderActions.ACTION_LOOKUP);
- if (id!=null) {
- sb.append(" ");
- sb.append(ARG_ID).append(" ").append(id);
- }
- if (outputFile != null) {
- sb.append(" ");
- sb.append(ARG_OUTPUT).append(" ").append(outputFile.getAbsolutePath());
- }
- return sb.toString();
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionUpgradeArgs.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/params/ActionUpgradeArgs.java
deleted file mode 100644
index b909cdd..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/ActionUpgradeArgs.java
+++ /dev/null
@@ -1,45 +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.SliderActions;
-
-@Parameters(commandNames = { SliderActions.ACTION_UPGRADE },
- commandDescription = SliderActions.DESCRIBE_ACTION_UPGRADE)
-public class ActionUpgradeArgs extends AbstractClusterBuildingActionArgs {
-
- @Override
- public String getActionName() {
- return SliderActions.ACTION_UPGRADE;
- }
-
-// TODO upgrade container
-// @Parameter(names={ARG_CONTAINERS}, variableArity = true,
-// description = "stop specific containers")
-// public List containers = new ArrayList<>(0);
-//
-// @Parameter(names={ARG_COMPONENTS}, variableArity = true,
-// description = "stop all containers of specific components")
-// public List components = new ArrayList<>(0);
-//
-// @Parameter(names = {ARG_FORCE},
-// description = "force spec upgrade operation")
-// public boolean force;
-}
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/ActionVersionArgs.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/ActionVersionArgs.java
deleted file mode 100644
index b0f17d0..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/ActionVersionArgs.java
+++ /dev/null
@@ -1,48 +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 version command
- */
-@Parameters(commandNames = { SliderActions.ACTION_VERSION},
- commandDescription = SliderActions.DESCRIBE_ACTION_VERSION)
-public class ActionVersionArgs extends AbstractActionArgs {
- @Override
- public String getActionName() {
- return SliderActions.ACTION_VERSION;
- }
-
- public int getMinParams() {
- return 0;
- }
-
- /**
- * This action does not need hadoop services
- * @return false
- */
- @Override
- public boolean getHadoopServicesRequired() {
- return false;
- }
-}
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/AddonArgsDelegate.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/AddonArgsDelegate.java
deleted file mode 100644
index 3ef8e19..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/AddonArgsDelegate.java
+++ /dev/null
@@ -1,54 +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 org.apache.slider.core.exceptions.BadCommandArgumentsException;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-public class AddonArgsDelegate extends AbstractArgsDelegate {
-
- /**
- * This is a listing of addon packages
- */
- @Parameter(names = {ARG_ADDON},
- arity = 2,
- description = "--addon ",
- splitter = DontSplitArguments.class)
- public List addonTuples = new ArrayList<>(0);
-
-
- /**
- * Get the list of addons (may be empty, but never null)
- *
- * @return map of named addons
- *
- * @throws BadCommandArgumentsException parse problem
- */
- public Map getAddonMap() throws BadCommandArgumentsException {
- return convertTupleListToMap("addon", addonTuples);
- }
-
- public List getAddonTuples() {
- return addonTuples;
- }
-}
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/URIArgumentConverter.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/URIArgumentConverter.java
deleted file mode 100644
index b0d1ebf..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/URIArgumentConverter.java
+++ /dev/null
@@ -1,40 +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.converters.BaseConverter;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-
-public class URIArgumentConverter extends BaseConverter {
-
- public URIArgumentConverter(String optionName) {
- super(optionName);
- }
-
- @Override
- public URI convert(String value) {
- try {
- return new URI(value);
- } catch (URISyntaxException e) {
- throw new RuntimeException("Cannot make a URI from " + value);
- }
- }
-}
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/URLArgumentConverter.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/URLArgumentConverter.java
deleted file mode 100644
index 8894309..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/URLArgumentConverter.java
+++ /dev/null
@@ -1,40 +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.converters.BaseConverter;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-public class URLArgumentConverter extends BaseConverter {
- public URLArgumentConverter(String optionName) {
- super(optionName);
- }
-
- @Override
- public URL convert(String value) {
- try {
- return new URL(value);
- } catch (MalformedURLException e) {
- throw new RuntimeException("Cannot make a URL from " + value);
- }
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/SliderVersionInfo.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/SliderVersionInfo.java
deleted file mode 100644
index 86025ee..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/common/tools/SliderVersionInfo.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.common.tools;
-
-import org.apache.hadoop.util.VersionInfo;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Locale;
-import java.util.Properties;
-
-/**
- * Extract the version properties, which will look something like
- *
- * application.name=${pom.name}
- * application.version=${pom.version}
- * application.build=${buildNumber}
- * application.build.java.version=${java.version}
- * application.build.info=${pom.name}-${pom.version} Built against ${buildNumber} on ${java.version} by ${user.name}
- *
- *
- * the mvn process-resources target will expand the properties
- * and add the resources to target/classes, which will then look something like
- *
- * application.name=Slider Core
- * application.version=0.7.1-SNAPSHOT
- * application.build=1dd69
- * application.build.java.version=1.7.0_45
- * application.build.user=stevel
- * application.build.info=Slider Core-0.7.1-SNAPSHOT Built against 1dd69 on 1.7.0_45 by stevel
- *
- *
- * Note: the values will change and more properties added.
- */
-public class SliderVersionInfo {
- private static final Logger log = LoggerFactory.getLogger(SliderVersionInfo.class);
-
- /**
- * Name of the resource containing the filled-in-at-runtime props
- */
- public static final String VERSION_RESOURCE =
- "org/apache/slider/providers/dynamic/application.properties";
-
- public static final String APP_NAME = "application.name";
- public static final String APP_VERSION = "application.version";
- public static final String APP_BUILD = "application.build";
- public static final String APP_BUILD_JAVA_VERSION = "application.build.java.version";
- public static final String APP_BUILD_USER = "application.build.user";
- public static final String APP_BUILD_INFO = "application.build.info";
- public static final String HADOOP_BUILD_INFO = "hadoop.build.info";
- public static final String HADOOP_DEPLOYED_INFO = "hadoop.deployed.info";
-
-
- public static Properties loadVersionProperties() {
- Properties props = new Properties();
- URL resURL = SliderVersionInfo.class.getClassLoader()
- .getResource(VERSION_RESOURCE);
- assert resURL != null : "Null resource " + VERSION_RESOURCE;
-
- try {
- InputStream inStream = resURL.openStream();
- assert inStream != null : "Null input stream from " + VERSION_RESOURCE;
- props.load(inStream);
- } catch (IOException e) {
- log.warn("IOE loading " + VERSION_RESOURCE, e);
- }
- return props;
- }
-
- /**
- * Load the version info and print it
- * @param logger logger
- */
- public static void loadAndPrintVersionInfo(Logger logger) {
- Properties props = loadVersionProperties();
- logger.info(props.getProperty(APP_BUILD_INFO));
- logger.info("Compiled against Hadoop {}",
- props.getProperty(HADOOP_BUILD_INFO));
- logger.info(getHadoopVersionString());
- }
-
- public static String getHadoopVersionString() {
- return String.format(Locale.ENGLISH,
- "Hadoop runtime version %s with source checksum %s and build date %s",
- VersionInfo.getBranch(),
- VersionInfo.getSrcChecksum(),
- VersionInfo.getDate());
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/buildutils/BuildHelper.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/buildutils/BuildHelper.java
deleted file mode 100644
index 80f165f..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/buildutils/BuildHelper.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.buildutils;
-
-import org.apache.hadoop.util.VersionInfo;
-import org.apache.slider.common.tools.SliderVersionInfo;
-
-import java.util.Map;
-import java.util.Properties;
-
-/**
- * classes to help with the build
- */
-public class BuildHelper {
- /**
- * Add the cluster build information; this will include Hadoop details too
- * @param dest map to insert this too
- * @param prefix prefix for the build info
- */
- public static void addBuildMetadata(Map dest, String prefix) {
-
- Properties props = SliderVersionInfo.loadVersionProperties();
- dest.put(prefix + "." + SliderVersionInfo.APP_BUILD_INFO,
- props.getProperty(
- SliderVersionInfo.APP_BUILD_INFO));
- dest.put(prefix + "." + SliderVersionInfo.HADOOP_BUILD_INFO,
- props.getProperty(SliderVersionInfo.HADOOP_BUILD_INFO));
-
- dest.put(prefix + "." + SliderVersionInfo.HADOOP_DEPLOYED_INFO,
- VersionInfo.getBranch() + " @" + VersionInfo.getSrcChecksum());
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/conf/MapOperations.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/conf/MapOperations.java
deleted file mode 100644
index 9714a0f..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/conf/MapOperations.java
+++ /dev/null
@@ -1,344 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.conf;
-
-import com.google.common.base.Preconditions;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.exceptions.BadConfigException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Standard map operations.
- *
- * This delegates the standard map interface to the map passed in,
- * so it can be used to add more actions to the map.
- */
-public class MapOperations implements Map {
- private static final Logger log =
- LoggerFactory.getLogger(MapOperations.class);
- public static final String DAYS = ".days";
- public static final String HOURS = ".hours";
- public static final String MINUTES = ".minutes";
- public static final String SECONDS = ".seconds";
-
- /**
- * Global options
- */
- public final Map options;
-
- public final String name;
-
- public MapOperations() {
- options = new HashMap();
- name = "";
- }
-
- /**
- * Create an instance
- * @param name name
- * @param options source of options
- */
- public MapOperations(String name, Map options) {
- Preconditions.checkArgument(options != null, "null map");
- this.options = options;
- this.name = name;
- }
-
- /**
- * Create an instance from an iterative map entry
- * @param entry entry to work with
- */
- public MapOperations(Map.Entry> entry) {
- Preconditions.checkArgument(entry != null, "null entry");
- this.name = entry.getKey();
- this.options = entry.getValue();
- }
-
- /**
- * Get an option value
- *
- * @param key key
- * @param defVal default value
- * @return option in map or the default
- */
- public String getOption(String key, String defVal) {
- String val = options.get(key);
- return val != null ? val : defVal;
- }
-
- /**
- * Get a boolean option
- *
- * @param key option key
- * @param defVal default value
- * @return option true if the option equals "true", or the default value
- * if the option was not defined at all.
- */
- public Boolean getOptionBool(String key, boolean defVal) {
- String val = getOption(key, Boolean.toString(defVal));
- return Boolean.valueOf(val);
- }
-
- /**
- * Get a cluster option or value
- *
- * @param key option key
- * @return the value
- * @throws BadConfigException if the option is missing
- */
-
- public String getMandatoryOption(String key) throws BadConfigException {
- String val = options.get(key);
- if (val == null) {
- if (log.isDebugEnabled()) {
- log.debug("Missing key {} from config containing {}",
- key, this);
- }
- String text = "Missing option " + key;
- if (SliderUtils.isSet(name)) {
- text += " from set " + name;
- }
- throw new BadConfigException(text);
- }
- return val;
- }
-
- /**
- * Get an integer option; use {@link Integer#decode(String)} so as to take hex
- * oct and bin values too.
- *
- * @param option option name
- * @param defVal default value
- * @return parsed value
- * @throws NumberFormatException if the role could not be parsed.
- */
- public int getOptionInt(String option, int defVal) {
- String val = getOption(option, Integer.toString(defVal));
- return Integer.decode(val);
- }
-
- /**
- * Get a long option; use {@link Long#decode(String)} so as to take hex
- * oct and bin values too.
- *
- * @param option option name
- * @param defVal default value
- * @return parsed value
- * @throws NumberFormatException
- */
- public long getOptionLong(String option, long defVal) {
- String val = getOption(option, Long.toString(defVal));
- return Long.decode(val);
- }
-
- /**
- * Get a mandatory integer option; use {@link Integer#decode(String)} so as to take hex
- * oct and bin values too.
- *
- * @param option option name
- * @return parsed value
- * @throws NumberFormatException if the option could not be parsed.
- * @throws BadConfigException if the option could not be found
- */
- public int getMandatoryOptionInt(String option) throws BadConfigException {
- getMandatoryOption(option);
- return getOptionInt(option, 0);
- }
-
- /**
- * Verify that an option is set: that is defined AND non-empty
- * @param key
- * @throws BadConfigException
- */
- public void verifyOptionSet(String key) throws BadConfigException {
- if (SliderUtils.isUnset(getOption(key, null))) {
- throw new BadConfigException("Unset option %s", key);
- }
- }
-
- public void mergeWithoutOverwrite(Map that) {
- SliderUtils.mergeMapsIgnoreDuplicateKeys(options, that);
- }
-
- /**
- * Merge a map by prefixed keys
- * @param that the map to merge in
- * @param prefix prefix to match on
- * @param overwrite flag to enable overwrite
- */
- public void mergeMapPrefixedKeys(Map that,
- String prefix,
- boolean overwrite) {
- for (Map.Entry entry : that.entrySet()) {
- String key = entry.getKey();
- if (key.startsWith(prefix)) {
- if (overwrite || get(key) == null) {
- put(key, entry.getValue());
- }
- }
- }
- }
-
- /**
- * Set a property if it is not already set
- * @param key key
- * @param value value
- */
- public void putIfUnset(String key, String value) {
- if (get(key) == null) {
- put(key, value);
- }
- }
-
- public void set(String key, Object value) {
- assert value != null;
- put(key, value.toString());
- }
-
- public int size() {
- return options.size();
- }
-
- public boolean isEmpty() {
- return options.isEmpty();
- }
-
- public boolean containsValue(Object value) {
- return options.containsValue(value);
- }
-
- public boolean containsKey(Object key) {
- return options.containsKey(key);
- }
-
- public String get(Object key) {
- return options.get(key);
- }
-
- public String put(String key, String value) {
- return options.put(key, value);
- }
-
- public String remove(Object key) {
- return options.remove(key);
- }
-
- public void putAll(Map extends String, ? extends String> m) {
- options.putAll(m);
- }
-
- public void clear() {
- options.clear();
- }
-
- public Set keySet() {
- return options.keySet();
- }
-
- public Collection values() {
- return options.values();
- }
-
- public Set> entrySet() {
- return options.entrySet();
- }
-
- @SuppressWarnings("EqualsWhichDoesntCheckParameterClass")
- public boolean equals(Object o) {
- return options.equals(o);
- }
-
- @Override
- public int hashCode() {
- return options.hashCode();
- }
-
- public boolean isSet(String key) {
- return SliderUtils.isSet(get(key));
- }
-
- @Override
- public String toString() {
- StringBuilder builder = new StringBuilder();
- builder.append(name).append("=\n");
-
- for (Entry entry : options.entrySet()) {
- builder.append(" ")
- .append(entry.getKey())
- .append('=')
- .append(entry.getValue())
- .append('\n');
- }
- return builder.toString();
- }
-
- /**
- * Get the time range of a set of keys
- * @param basekey base key to which suffix gets applied
- * @param defDays
- * @param defHours
- * @param defMins
- * @param defSecs
- * @return the aggregate time range in seconds
- */
- public long getTimeRange(String basekey,
- int defDays,
- int defHours,
- int defMins,
- int defSecs) {
- Preconditions.checkArgument(basekey != null);
- int days = getOptionInt(basekey + DAYS, defDays);
- int hours = getOptionInt(basekey + HOURS, defHours);
-
- int minutes = getOptionInt(basekey + MINUTES, defMins);
- int seconds = getOptionInt(basekey + SECONDS, defSecs);
- // range check
- Preconditions.checkState(days >= 0 && hours >= 0 && minutes >= 0
- && seconds >= 0,
- "Time range for %s has negative time component %s:%s:%s:%s",
- basekey, days, hours, minutes, seconds);
-
- // calculate total time, schedule the reset if expected
- long totalMinutes = (long) days * 24 * 60 + (long) hours * 24 + minutes;
- return totalMinutes * 60 + seconds;
- }
-
- /**
- * Get all entries with a specific prefix
- * @param prefix prefix
- * @return a prefixed map, possibly empty
- */
- public Map prefixedWith(String prefix) {
-
- Map prefixed = new HashMap<>(size());
- for (Entry entry: entrySet()) {
- if (entry.getKey().startsWith(prefix)) {
- prefixed.put(entry.getKey(), entry.getValue());
- }
- }
- return prefixed;
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/NoSuchNodeException.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/NoSuchNodeException.java
deleted file mode 100644
index ad2f1a4..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/NoSuchNodeException.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.exceptions;
-
-import java.io.IOException;
-
-/**
- * Exception raised when a node cannot be found in the structure
- * that is being examined.
- */
-public class NoSuchNodeException extends IOException {
-
- public NoSuchNodeException(String uuid) {
- super(uuid);
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/NotFoundException.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/NotFoundException.java
deleted file mode 100644
index 40cb94d..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/NotFoundException.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.core.exceptions;
-
-
-/**
- * Whatever was being resolved: it was not found
- */
-public class NotFoundException extends SliderException {
- public NotFoundException(String message,
- Object... args) {
- super(EXIT_NOT_FOUND, message, args);
- }
-
- public NotFoundException(Throwable throwable,
- String message, Object... args) {
- super(EXIT_NOT_FOUND, throwable, message, args);
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/ServiceNotReadyException.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/ServiceNotReadyException.java
deleted file mode 100644
index 435bc1a..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/ServiceNotReadyException.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.exceptions;
-
-import java.io.IOException;
-
-/**
- * This is an exception raised when the service does not consider itself
- * live (yet)
- */
-public class ServiceNotReadyException extends IOException {
-
- public static final String E_NOT_READY =
- "Service not ready for access: please retry";
-
- public ServiceNotReadyException(String message) {
- super(message);
- }
-
- public ServiceNotReadyException(String message, Throwable cause) {
- super(message, cause);
- }
-
- public ServiceNotReadyException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/SliderInternalStateException.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/SliderInternalStateException.java
deleted file mode 100644
index deddbbc..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/SliderInternalStateException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.exceptions;
-
-public class SliderInternalStateException extends SliderException {
- public SliderInternalStateException(String s) {
- super(EXIT_INTERNAL_ERROR, s);
- }
-
- public SliderInternalStateException(String s, Throwable throwable) {
- super(EXIT_INTERNAL_ERROR, throwable, s);
- }
-
- public SliderInternalStateException(String message,
- Object... args) {
- super(EXIT_INTERNAL_ERROR, message, args);
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/TriggerClusterTeardownException.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/TriggerClusterTeardownException.java
deleted file mode 100644
index bb9f430..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/TriggerClusterTeardownException.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.exceptions;
-
-import org.apache.hadoop.yarn.api.records.FinalApplicationStatus;
-
-/**
- * An Exception to be thrown for an explicit "shut down the cluster" operation
- * raised by the application state or other parts of the AM
- */
-public class TriggerClusterTeardownException extends SliderException {
-
- private final FinalApplicationStatus finalApplicationStatus;
-
- public TriggerClusterTeardownException(int code,
- FinalApplicationStatus finalApplicationStatus, String message,
- Object... args) {
- super(code, message, args);
- this.finalApplicationStatus = finalApplicationStatus;
- }
-
- public FinalApplicationStatus getFinalApplicationStatus() {
- return finalApplicationStatus;
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/UnknownApplicationInstanceException.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/UnknownApplicationInstanceException.java
deleted file mode 100644
index a1f8ae9..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/UnknownApplicationInstanceException.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.exceptions;
-
-public class UnknownApplicationInstanceException extends SliderException {
- public UnknownApplicationInstanceException(String s) {
- super(EXIT_UNKNOWN_INSTANCE, s);
- }
-
- public UnknownApplicationInstanceException(String s, Throwable throwable) {
- super(EXIT_UNKNOWN_INSTANCE, throwable, s);
- }
-
- public UnknownApplicationInstanceException(String message,
- Object... args) {
- super(EXIT_UNKNOWN_INSTANCE, message, args);
- }
-
- /**
- * Create an instance with the standard exception name
- * @param name name
- * @return an instance to throw
- */
- public static UnknownApplicationInstanceException unknownInstance(String name) {
- return new UnknownApplicationInstanceException(ErrorStrings.E_UNKNOWN_INSTANCE
- + ": " + name);
- }
- public static UnknownApplicationInstanceException unknownInstance(String name,
- Throwable throwable) {
- UnknownApplicationInstanceException exception =
- unknownInstance(name);
- exception.initCause(throwable);
- return exception;
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/WaitTimeoutException.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/WaitTimeoutException.java
deleted file mode 100644
index 5ad3fdc..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/exceptions/WaitTimeoutException.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.exceptions;
-
-import java.io.IOException;
-
-/**
- * Called when some spinning operation timed out
- */
-public class WaitTimeoutException extends IOException {
- public WaitTimeoutException(String message) {
- super(message);
- }
-
- public WaitTimeoutException(String message, Throwable cause) {
- super(message, cause);
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/ContainerLauncher.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/ContainerLauncher.java
deleted file mode 100644
index 7e164e4..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/launch/ContainerLauncher.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.launch;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.net.NetUtils;
-import org.apache.hadoop.security.Credentials;
-import org.apache.hadoop.security.UserGroupInformation;
-import org.apache.hadoop.security.token.Token;
-import org.apache.hadoop.yarn.api.records.Container;
-import org.apache.hadoop.yarn.security.ContainerTokenIdentifier;
-import org.apache.hadoop.yarn.util.ConverterUtils;
-import org.apache.slider.common.tools.CoreFileSystem;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.net.InetSocketAddress;
-
-/**
- * Code to ease launching of any container
- */
-public class ContainerLauncher extends AbstractLauncher {
- private static final Logger log =
- LoggerFactory.getLogger(ContainerLauncher.class);
-
- public ContainerLauncher(Configuration conf,
- CoreFileSystem coreFileSystem,
- Container container,
- Credentials credentials) {
- super(coreFileSystem, credentials);
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/main/IrqHandler.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/main/IrqHandler.java
deleted file mode 100644
index 42442d1..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/main/IrqHandler.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.main;
-
-import sun.misc.Signal;
-import sun.misc.SignalHandler;
-
-import java.io.IOException;
-
-/**
- * This class bundles up all the compiler warnings about abuse of sun.misc
- * interrupt handling code
- * into one place.
- */
-@SuppressWarnings("UseOfSunClasses")
-public final class IrqHandler implements SignalHandler {
-
- public static final String CONTROL_C = "INT";
- public static final String SIGTERM = "TERM";
-
- private final String name;
- private final Interrupted handler;
-
- /**
- * Create an IRQ handler bound to the specific interrupt
- * @param name signal name
- * @param handler handler
- * @throws IOException
- */
- public IrqHandler(String name, Interrupted handler) throws IOException {
- this.handler = handler;
- this.name = name;
- try {
- Signal.handle(new Signal(name), this);
- } catch (IllegalArgumentException e) {
- throw new IOException(
- "Could not set handler for signal \"" + name + "\"."
- + "This can happen if the JVM has the -Xrs set.",
- e);
- }
- }
-
- @Override
- public String toString() {
- return "IrqHandler for signal " + name ;
- }
-
- /**
- * Handler for the JVM API for signal handling
- * @param signal signal raised
- */
-// @Override
- public void handle(Signal signal) {
- InterruptData data = new InterruptData(signal.getName(), signal.getNumber());
- handler.interrupted(data);
- }
-
- /**
- * Interrupt data to pass on.
- */
- public static class InterruptData {
- public final String name;
- public final int number;
-
- public InterruptData(String name, int number) {
- this.name = name;
- this.number = number;
- }
-
- @Override
- public String toString() {
- return "signal " + name + '(' + number + ')';
- }
- }
-
- /**
- * Callback on interruption
- */
- public interface Interrupted {
-
- /**
- * Handle an interrupt
- * @param interruptData data
- */
- void interrupted(InterruptData interruptData);
- }
-}
\ No newline at end of file
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/main/RunService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/main/RunService.java
deleted file mode 100644
index c3a1d0e..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/main/RunService.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.main;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.service.Service;
-
-/**
- * An interface which services can implement to have their
- * execution managed by the ServiceLauncher.
- * The command line options will be passed down before the
- * {@link Service#init(Configuration)} operation is invoked via an
- * invocation of {@link RunService#bindArgs(Configuration, String...)}
- * After the service has been successfully started via {@link Service#start()}
- * the {@link RunService#runService()} method is called to execute the
- * service. When this method returns, the service launcher will exit, using
- * the return code from the method as its exit option.
- */
-public interface RunService extends Service {
-
- /**
- * Propagate the command line arguments.
- * This method is called before {@link Service#init(Configuration)};
- * the configuration that is returned from this operation
- * is the one that is passed on to the init operation.
- * This permits implemenations to change the configuration before
- * the init operation.n
- *
- *
- * @param config the initial configuration build up by the
- * service launcher.
- * @param args argument list list of arguments passed to the command line
- * after any launcher-specific commands have been stripped.
- * @return the configuration to init the service with. This MUST NOT be null.
- * Recommended: pass down the config parameter with any changes
- * @throws Exception any problem
- */
- Configuration bindArgs(Configuration config, String... args) throws Exception;
-
- /**
- * Run a service. This called after {@link Service#start()}
- * @return the exit code
- * @throws Throwable any exception to report
- */
- int runService() throws Throwable ;
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/main/ServiceLauncher.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/main/ServiceLauncher.java
deleted file mode 100644
index f192ec8..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/main/ServiceLauncher.java
+++ /dev/null
@@ -1,642 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.main;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.net.NetUtils;
-import org.apache.hadoop.service.Service;
-import org.apache.hadoop.util.ExitUtil;
-import org.apache.hadoop.util.ShutdownHookManager;
-import org.apache.hadoop.util.VersionInfo;
-import org.apache.hadoop.yarn.YarnUncaughtExceptionHandler;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.net.MalformedURLException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.ListIterator;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-/**
- * A class to launch any service by name.
- *
- * It's designed to be subclassed for custom entry points.
- *
- *
- * Workflow
- *
- *
An instance of the class is created
- *
If it implements RunService, it is given the binding args off the CLI
- *
Its service.init() and service.start() methods are called.
- *
If it implements RunService, runService() is called and its return
- * code used as the exit code.
- *
Otherwise: it waits for the service to stop, assuming in its start() method
- * it begins work
- *
If an exception returned an exit code, that becomes the exit code of the
- * command.
- *
- * Error and warning messages are logged to stderr. Why? If the classpath
- * is wrong & logger configurations not on it, then no error messages by
- * the started app will be seen and the caller is left trying to debug
- * using exit codes.
- *
- */
-@SuppressWarnings("UseOfSystemOutOrSystemErr")
-public class ServiceLauncher
- implements LauncherExitCodes, IrqHandler.Interrupted,
- Thread.UncaughtExceptionHandler {
- private static final Logger LOG = LoggerFactory.getLogger(
- ServiceLauncher.class);
-
- protected static final int PRIORITY = 30;
-
- public static final String NAME = "ServiceLauncher";
-
- /**
- * Name of the "--conf" argument.
- */
- public static final String ARG_CONF = "--conf";
-
- public static final String USAGE_MESSAGE =
- "Usage: " + NAME + " classname [" + ARG_CONF +
- "] | ";
- static final int SHUTDOWN_TIME_ON_INTERRUPT = 30 * 1000;
-
- private volatile S service;
- private int serviceExitCode;
- @SuppressWarnings("MismatchedQueryAndUpdateOfCollection")
- private final List interruptHandlers = new ArrayList<>(1);
- private Configuration configuration;
- private String serviceClassName;
- private static AtomicBoolean signalAlreadyReceived = new AtomicBoolean(false);
-
-
- /**
- * Create an instance of the launcher
- * @param serviceClassName classname of the service
- */
- public ServiceLauncher(String serviceClassName) {
- this.serviceClassName = serviceClassName;
- }
-
- /**
- * Get the service. Null until and unless
- * {@link #launchService(Configuration, String[], boolean)} has completed
- * @return the service
- */
- public S getService() {
- return service;
- }
-
- /**
- * Get the configuration constructed from the command line arguments
- * @return the configuration used to create the service
- */
- public Configuration getConfiguration() {
- return configuration;
- }
-
- /**
- * The exit code from a successful service execution
- * @return the exit code.
- */
- public int getServiceExitCode() {
- return serviceExitCode;
- }
-
- @Override
- public String toString() {
- return "ServiceLauncher for " + serviceClassName;
- }
-
- /**
- * Launch the service, by creating it, initing it, starting it and then
- * maybe running it. {@link RunService#bindArgs(Configuration, String...)} is invoked
- * on the service between creation and init.
- *
- * All exceptions that occur are propagated upwards.
- *
- * If the method returns a status code, it means that it got as far starting
- * the service, and if it implements {@link RunService}, that the
- * method {@link RunService#runService()} has completed.
- *
- * At this point, the service is returned by {@link #getService()}.
- *
- * @param conf configuration
- * @param processedArgs arguments after the configuration parameters
- * have been stripped out.
- * @param addProcessHooks should process failure handlers be added to
- * terminate this service on shutdown. Tests should set this to false.
- * @throws ClassNotFoundException classname not on the classpath
- * @throws IllegalAccessException not allowed at the class
- * @throws InstantiationException not allowed to instantiate it
- * @throws InterruptedException thread interrupted
- * @throws Throwable any other failure
- */
- public int launchService(Configuration conf,
- String[] processedArgs,
- boolean addProcessHooks)
- throws Throwable {
-
- instantiateService(conf);
-
- // add any process shutdown hooks
- if (addProcessHooks) {
- ServiceShutdownHook shutdownHook = new ServiceShutdownHook(service);
- ShutdownHookManager.get().addShutdownHook(shutdownHook, PRIORITY);
- }
- RunService runService = null;
-
- if (service instanceof RunService) {
- //if its a runService, pass in the conf and arguments before init)
- runService = (RunService) service;
- configuration = runService.bindArgs(configuration, processedArgs);
- Preconditions.checkNotNull(configuration,
- "null configuration returned by bindArgs()");
- }
-
- //some class constructors init; here this is picked up on.
- if (!service.isInState(Service.STATE.INITED)) {
- service.init(configuration);
- }
- service.start();
- int exitCode = EXIT_SUCCESS;
- if (runService != null) {
- //assume that runnable services are meant to run from here
- exitCode = runService.runService();
- LOG.debug("Service exited with exit code {}", exitCode);
-
- } else {
- //run the service until it stops or an interrupt happens on a different thread.
- LOG.debug("waiting for service threads to terminate");
- service.waitForServiceToStop(0);
- }
- //exit
- serviceExitCode = exitCode;
- return serviceExitCode;
- }
-
- /**
- * Instantiate the service defined in serviceClassName
- * . Sets the configuration field
- * to the configuration, and service to the service.
- *
- * @param conf configuration to use
- * @throws ClassNotFoundException classname not on the classpath
- * @throws IllegalAccessException not allowed at the class
- * @throws InstantiationException not allowed to instantiate it
- */
- @SuppressWarnings("unchecked")
- public Service instantiateService(Configuration conf)
- throws ClassNotFoundException, InstantiationException, IllegalAccessException,
- ExitUtil.ExitException, NoSuchMethodException, InvocationTargetException {
- Preconditions.checkArgument(conf != null, "null conf");
- configuration = conf;
-
- //Instantiate the class -this requires the service to have a public
- // zero-argument constructor
- Class> serviceClass =
- this.getClass().getClassLoader().loadClass(serviceClassName);
- Object instance = serviceClass.getConstructor().newInstance();
- if (!(instance instanceof Service)) {
- //not a service
- throw new ExitUtil.ExitException(EXIT_COMMAND_ARGUMENT_ERROR,
- "Not a Service class: " + serviceClassName);
- }
-
- service = (S) instance;
- return service;
- }
-
- /**
- * Register this class as the handler for the control-C interrupt.
- * Can be overridden for testing.
- */
- protected void registerInterruptHandler() {
- try {
- interruptHandlers.add(new IrqHandler(IrqHandler.CONTROL_C, this));
- interruptHandlers.add(new IrqHandler(IrqHandler.SIGTERM, this));
- } catch (IOException e) {
- error("Signal handler setup failed : {}" + e, e);
- }
- }
-
- /**
- * The service has been interrupted -try to shut down the service.
- * Give the service time to do this before the exit operation is called
- * @param interruptData the interrupted data.
- */
- @Override
- public void interrupted(IrqHandler.InterruptData interruptData) {
- String message = "Service interrupted by " + interruptData.toString();
- warn(message);
- if (!signalAlreadyReceived.compareAndSet(false, true)) {
- warn("Repeated interrupt: escalating to a JVM halt");
- // signal already received. On a second request to a hard JVM
- // halt and so bypass any blocking shutdown hooks.
- ExitUtil.halt(EXIT_INTERRUPTED, message);
- }
- int shutdownTimeMillis = SHUTDOWN_TIME_ON_INTERRUPT;
- //start an async shutdown thread with a timeout
- ServiceForcedShutdown forcedShutdown =
- new ServiceForcedShutdown(shutdownTimeMillis);
- Thread thread = new Thread(forcedShutdown);
- thread.setDaemon(true);
- thread.start();
- //wait for that thread to finish
- try {
- thread.join(shutdownTimeMillis);
- } catch (InterruptedException ignored) {
- //ignored
- }
- if (!forcedShutdown.isServiceStopped()) {
- warn("Service did not shut down in time");
- }
- exit(EXIT_INTERRUPTED, message);
- }
-
- /**
- * Uncaught exception handler.
- * If an error is raised: shutdown
- * The state of the system is unknown at this point -attempting
- * a clean shutdown is dangerous. Instead: exit
- * @param thread thread that failed
- * @param exception exception
- */
- @Override
- public void uncaughtException(Thread thread, Throwable exception) {
- if (ShutdownHookManager.get().isShutdownInProgress()) {
- LOG.error("Thread {} threw an error during shutdown: {}.",
- thread.toString(),
- exception,
- exception);
- } else if (exception instanceof Error) {
- try {
- LOG.error("Thread {} threw an error: {}. Shutting down",
- thread.toString(),
- exception,
- exception);
- } catch (Throwable err) {
- // We don't want to not exit because of an issue with logging
- }
- if (exception instanceof OutOfMemoryError) {
- // After catching an OOM java says it is undefined behavior, so don't
- // even try to clean up or we can get stuck on shutdown.
- try {
- System.err.println("Halting due to Out Of Memory Error...");
- } catch (Throwable err) {
- // Again we don't want to exit because of logging issues.
- }
- ExitUtil.halt(EXIT_EXCEPTION_THROWN);
- } else {
- // error other than OutOfMemory
- exit(convertToExitException(exception));
- }
- } else {
- // simple exception in a thread. There's a policy decision here:
- // terminate the service vs. keep going after a thread has failed
- LOG.error("Thread {} threw an exception: {}",
- thread.toString(),
- exception,
- exception);
- }
- }
-
- /**
- * Print a warning: currently this goes to stderr
- * @param text
- */
- protected void warn(String text) {
- System.err.println(text);
- }
-
- /**
- * Report an error. The message is printed to stderr; the exception
- * is logged via the current logger.
- * @param message message for the user
- * @param thrown the exception thrown
- */
- protected void error(String message, Throwable thrown) {
- String text = "Exception: " + message;
- warn(text);
- LOG.error(text, thrown);
- }
-
- /**
- * Exit the code.
- * This is method can be overridden for testing, throwing an
- * exception instead. Any subclassed method MUST raise an
- * ExitUtil.ExitException instance.
- * The service launcher code assumes that after this method is invoked,
- * no other code in the same method is called.
- * @param exitCode code to exit
- */
- protected void exit(int exitCode, String message) {
- ExitUtil.terminate(exitCode, message);
- }
-
- /**
- * Exit off an exception. This can be subclassed for testing
- * @param ee exit exception
- */
- protected void exit(ExitUtil.ExitException ee) {
- ExitUtil.terminate(ee.status, ee);
- }
-
- /**
- * Get the service name via {@link Service#getName()}.
- * If the service is not instantiated, the classname is returned instead.
- * @return the service name
- */
- public String getServiceName() {
- Service s = service;
- String name = null;
- if (s != null) {
- try {
- name = s.getName();
- } catch (Exception ignored) {
- // ignored
- }
- }
- if (name != null) {
- return "service " + name;
- } else {
- return "service classname " + serviceClassName;
- }
- }
-
- /**
- * Parse the command line, building a configuration from it, then
- * launch the service and wait for it to finish. finally, exit
- * passing the status code to the #exit(int) method.
- * @param args arguments to the service. arg[0] is
- * assumed to be the service classname and is automatically
- */
- public void launchServiceAndExit(List args) {
-
- registerInterruptHandler();
- //Currently the config just the default
- Configuration conf = new Configuration();
- String[] processedArgs = extractConfigurationArgs(conf, args);
- ExitUtil.ExitException ee = launchServiceRobustly(conf, processedArgs);
- System.out.flush();
- System.err.flush();
- exit(ee);
- }
-
- /**
- * Extract the configuration arguments and apply them to the configuration,
- * building an array of processed arguments to hand down to the service.
- *
- * @param conf configuration to update
- * @param args main arguments. args[0] is assumed to be the service
- * classname and is skipped
- * @return the processed list.
- */
- public static String[] extractConfigurationArgs(Configuration conf,
- List args) {
-
- //convert args to a list
- int argCount = args.size();
- if (argCount <= 1 ) {
- return new String[0];
- }
- List argsList = new ArrayList(argCount);
- ListIterator arguments = args.listIterator();
- //skip that first entry
- arguments.next();
- while (arguments.hasNext()) {
- String arg = arguments.next();
- if (arg.equals(ARG_CONF)) {
- //the argument is a --conf file tuple: extract the path and load
- //it in as a configuration resource.
-
- //increment the loop iterator
- if (!arguments.hasNext()) {
- //overshot the end of the file
- exitWithMessage(EXIT_COMMAND_ARGUMENT_ERROR,
- ARG_CONF + ": missing configuration file after ");
- }
- File file = new File(arguments.next());
- if (!file.exists()) {
- exitWithMessage(EXIT_COMMAND_ARGUMENT_ERROR,
- ARG_CONF + ": configuration file not found: " + file);
- }
- try {
- conf.addResource(file.toURI().toURL());
- } catch (MalformedURLException e) {
- LOG.debug("File {} cannot be converted to URL", file, e);
- exitWithMessage(EXIT_COMMAND_ARGUMENT_ERROR,
- ARG_CONF + ": configuration file path invalid: " + file);
- }
- } else {
- argsList.add(arg);
- }
- }
- String[] processedArgs = new String[argsList.size()];
- argsList.toArray(processedArgs);
- return processedArgs;
- }
-
- /**
- * Launch a service catching all exceptions and downgrading them to exit codes
- * after logging.
- * @param conf configuration to use
- * @param processedArgs command line after the launcher-specific arguments have
- * been stripped out
- * @return an exit exception, which will have a status code of 0 if it worked
- */
- public ExitUtil.ExitException launchServiceRobustly(Configuration conf,
- String[] processedArgs) {
- ExitUtil.ExitException exitException;
- try {
- int exitCode = launchService(conf, processedArgs, true);
- if (service != null) {
- Throwable failure = service.getFailureCause();
- if (failure != null) {
- //the service exited with a failure.
- //check what state it is in
- Service.STATE failureState = service.getFailureState();
- if (failureState == Service.STATE.STOPPED) {
- //the failure occurred during shutdown, not important enough to bother
- //the user as it may just scare them
- LOG.debug("Failure during shutdown:{} ", failure, failure);
- } else {
- //throw it for the catch handlers to deal with
- throw failure;
- }
- }
- }
- exitException = new ExitUtil.ExitException(exitCode,
- "In " + serviceClassName);
- // either the service succeeded, or an error raised during shutdown,
- // which we don't worry that much about
- } catch (ExitUtil.ExitException ee) {
- exitException = ee;
- } catch (Throwable thrown) {
- exitException = convertToExitException(thrown);
- }
- return exitException;
- }
-
- /**
- * Convert the exception to one that can be handed off to ExitUtils;
- * if it is of the write type it is passed throw as is. If not, a
- * new exception with the exit code {@link #EXIT_EXCEPTION_THROWN}
- * is created, with the argument thrown as the inner cause
- * @param thrown the exception thrown
- * @return an exception to terminate the process with
- */
- protected ExitUtil.ExitException convertToExitException(Throwable thrown) {
- ExitUtil.ExitException exitException;
- int exitCode;
- String message = thrown.getMessage();
- if (message == null) {
- message = thrown.toString();
- }
- if (thrown instanceof ExitCodeProvider) {
- exitCode = ((ExitCodeProvider) thrown).getExitCode();
- if (LOG.isDebugEnabled()) {
- LOG.debug("While running {}: {}", getServiceName(), message, thrown);
- }
- LOG.error(message);
- } else {
- // not any of the service launcher exceptions -assume something worse
- error(message, thrown);
- exitCode = EXIT_EXCEPTION_THROWN;
- }
- exitException = new ExitUtil.ExitException(exitCode, message);
- exitException.initCause(thrown);
- return exitException;
- }
-
-
- /**
- * Build a log message for starting up and shutting down.
- * This was grabbed from the ToolRunner code.
- * @param classname the class of the server
- * @param args arguments
- */
- public static String startupShutdownMessage(String classname,
- List args) {
- final String hostname = NetUtils.getHostname();
-
- return toStartupShutdownString("STARTUP_MSG: ", new String[]{
- "Starting " + classname,
- " host = " + hostname,
- " args = " + args,
- " version = " + VersionInfo.getVersion(),
- " classpath = " + System.getProperty("java.class.path"),
- " build = " + VersionInfo.getUrl() + " -r "
- + VersionInfo.getRevision()
- + "; compiled by '" + VersionInfo.getUser()
- + "' on " + VersionInfo.getDate(),
- " java = " + System.getProperty("java.version")
- });
- }
-
- /**
- * Exit with a printed message
- * @param status status code
- * @param message message
- */
- private static void exitWithMessage(int status, String message) {
- System.err.println(message);
- ExitUtil.terminate(status);
- }
-
- private static String toStartupShutdownString(String prefix, String[] msg) {
- StringBuilder b = new StringBuilder(prefix);
- b.append("\n/************************************************************");
- for (String s : msg) {
- b.append("\n").append(prefix).append(s);
- }
- b.append("\n************************************************************/");
- return b.toString();
- }
-
- /**
- * forced shutdown runnable.
- */
- protected class ServiceForcedShutdown implements Runnable {
-
- private final int shutdownTimeMillis;
- private boolean serviceStopped;
-
- public ServiceForcedShutdown(int shutdownTimeoutMillis) {
- this.shutdownTimeMillis = shutdownTimeoutMillis;
- }
-
- @Override
- public void run() {
- if (service != null) {
- service.stop();
- serviceStopped = service.waitForServiceToStop(shutdownTimeMillis);
- } else {
- serviceStopped = true;
- }
- }
-
- private boolean isServiceStopped() {
- return serviceStopped;
- }
- }
-
- /**
- * The real main function, which takes the arguments as a list
- * arg 0 must be the service classname
- * @param argsList the list of arguments
- */
- public static void serviceMain(List argsList) {
- if (argsList.isEmpty()) {
- exitWithMessage(EXIT_USAGE, USAGE_MESSAGE);
- } else {
- String serviceClassName = argsList.get(0);
-
- if (LOG.isDebugEnabled()) {
- LOG.debug(startupShutdownMessage(serviceClassName, argsList));
- StringBuilder builder = new StringBuilder();
- for (String arg : argsList) {
- builder.append('"').append(arg).append("\" ");
- }
- LOG.debug(builder.toString());
- }
- Thread.setDefaultUncaughtExceptionHandler(
- new YarnUncaughtExceptionHandler());
-
- ServiceLauncher serviceLauncher = new ServiceLauncher<>(serviceClassName);
- serviceLauncher.launchServiceAndExit(argsList);
- }
- }
-
- /**
- * This is the main entry point for the service launcher.
- * @param args command line arguments.
- */
- public static void main(String[] args) {
- List argsList = Arrays.asList(args);
- serviceMain(argsList);
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/main/ServiceShutdownHook.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/main/ServiceShutdownHook.java
deleted file mode 100644
index de55789..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/main/ServiceShutdownHook.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.main;
-
-import org.apache.hadoop.service.Service;
-import org.apache.hadoop.util.ShutdownHookManager;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.lang.ref.WeakReference;
-
-/**
- * JVM Shutdown hook for Service which will stop the
- * Service gracefully in case of JVM shutdown.
- * This hook uses a weak reference to the service, so
- * does not cause services to be retained after they have
- * been stopped and deferenced elsewhere.
- */
-public class ServiceShutdownHook implements Runnable {
- private static final Logger LOG = LoggerFactory.getLogger(
- ServiceShutdownHook.class);
-
- private final WeakReference serviceRef;
- private Runnable hook;
-
- public ServiceShutdownHook(Service service) {
- serviceRef = new WeakReference<>(service);
- }
-
- public void register(int priority) {
- unregister();
- hook = this;
- ShutdownHookManager.get().addShutdownHook(hook, priority);
- }
-
- public synchronized void unregister() {
- if (hook != null) {
- try {
- ShutdownHookManager.get().removeShutdownHook(hook);
- } catch (IllegalStateException e) {
- LOG.info("Failed to unregister shutdown hook: {}", e, e);
- }
- hook = null;
- }
- }
-
- @Override
- public void run() {
- Service service;
- synchronized (this) {
- service = serviceRef.get();
- serviceRef.clear();
- }
- if (service == null) {
- return;
- }
- try {
- // Stop the Service
- service.stop();
- } catch (Throwable t) {
- LOG.info("Error stopping {}", service.getName(), t);
- }
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/persist/Filenames.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/persist/Filenames.java
deleted file mode 100644
index 06ecc51..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/persist/Filenames.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.core.persist;
-
-public interface Filenames {
-
- String RESOURCES = "resources.json";
- String APPCONF = "app_config.json";
- String INTERNAL = "internal.json";
- String WRITELOCK = "writelock";
- String READLOCK = "readlock";
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/persist/LockHeldAction.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/persist/LockHeldAction.java
deleted file mode 100644
index 6659687..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/persist/LockHeldAction.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.persist;
-
-import org.apache.slider.core.exceptions.SliderException;
-
-import java.io.IOException;
-
-/**
- * Optional action to add while the lock is held; this is needed to execute
- * some other persistent operations within the scope at the same lock
- * without inserting too much code into the persister
- */
-public interface LockHeldAction {
-
- /**
- * Execute the action
- * @throws IOException on any failure
- */
- public void execute() throws IOException, SliderException;
-
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/persist/PersistKeys.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/persist/PersistKeys.java
deleted file mode 100644
index 1964459..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/persist/PersistKeys.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.persist;
-
-public class PersistKeys {
-
- public static final String SCHEMA =
- "http://example.org/specification/v2.0.0";
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/YarnAppListClient.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/YarnAppListClient.java
deleted file mode 100644
index d311fee..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/YarnAppListClient.java
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.registry;
-
-import com.google.common.base.Preconditions;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.yarn.api.records.ApplicationReport;
-import org.apache.hadoop.yarn.api.records.YarnApplicationState;
-import org.apache.hadoop.yarn.exceptions.YarnException;
-import org.apache.slider.client.SliderYarnClientImpl;
-import org.apache.slider.api.types.SliderInstanceDescription;
-import org.apache.slider.common.tools.CoreFileSystem;
-import org.apache.slider.common.tools.SliderUtils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.EnumSet;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Client code for interacting with a list of service instances.
- * The initial logic just enumerates service instances in the YARN RM
- */
-public class YarnAppListClient {
-
- private final SliderYarnClientImpl yarnClient;
- private final String username;
- private final Configuration conf;
- private static final Logger log =
- LoggerFactory.getLogger(YarnAppListClient.class);
-
- public YarnAppListClient(SliderYarnClientImpl yarnClient,
- String username,
- Configuration conf) {
-
- Preconditions.checkArgument(yarnClient != null,
- "yarn client is null: is app inited?");
- Preconditions.checkArgument(username != null,
- "username is null");
- Preconditions.checkArgument(conf != null,
- "conf parameter is null");
- this.yarnClient = yarnClient;
- this.username = username;
- this.conf = conf;
- }
-
- /**
- * find all live instances of a specific app -if there is more than one
- * in the cluster, this returns them all. State should be running or earlier
- * in the lifecycle
- * @param appname application name
- * @return the list of all matching application instances
- */
- public List findAllLiveInstances(String appname)
- throws YarnException, IOException {
- return yarnClient.findAllLiveInstances(username, appname);
- }
-
-
- /**
- * Find an instance of a application belong to the current user.
- * @param appname application name
- * @return the app report or null if none is found
- * @throws YarnException YARN issues
- * @throws IOException IO problems
- */
- public ApplicationReport findInstance(String appname) throws
- YarnException,
- IOException {
- return findInstance(appname, null);
- }
-
- /**
- * Find an instance of a application belong to the current user in specific
- * app states.
- * @param appname application name
- * @param appStates list of states in which application should be in
- * @return the app report or null if none is found
- * @throws YarnException YARN issues
- * @throws IOException IO problems
- */
- public ApplicationReport findInstance(String appname,
- EnumSet appStates)
- throws YarnException, IOException {
- List instances = listInstances(null, appname, appStates);
- return yarnClient.findClusterInInstanceList(instances, appname);
- }
-
- /**
- * List instances belonging to the specific user
- * @return a possibly empty list of AMs
- */
- public List listInstances()
- throws YarnException, IOException {
- return listInstances(null);
- }
-
- /**
- * List instances belonging to a specific user
- * @return a possibly empty list of AMs
- * @param user user if not the default. null means default, "" means all users,
- * otherwise it is the name of a user
- */
- public List listInstances(String user)
- throws YarnException, IOException {
- return listInstances(user, null);
- }
-
- /**
- * List all instances belonging to a specific user with a specific app name.
- *
- * @param user
- * user if not the default. null means default, "" means all users,
- * otherwise it is the name of a user
- * @param appName
- * application name set as an application tag
- * @return a possibly empty list of AMs
- * @throws YarnException
- * @throws IOException
- */
- public List listInstances(String user, String appName)
- throws YarnException, IOException {
- return listInstances(user, appName, null);
- }
-
- /**
- * List all instances belonging to a specific user, with a specific app name
- * and in specific app states.
- *
- * @param user
- * user if not the default. null means default, "" means all users,
- * otherwise it is the name of a user
- * @param appName
- * application name set as an application tag
- * @param appStates
- * a set of application states within which the app should be in
- * @return a possibly empty list of AMs
- * @throws YarnException
- * @throws IOException
- */
- public List listInstances(String user, String appName,
- EnumSet appStates)
- throws YarnException, IOException {
- log.debug("listInstances called with user: {}, appName: {}, appStates: {}",
- user, appName, appStates);
- String listUser = user == null ? username : user;
- return yarnClient.listDeployedInstances(listUser, appStates, appName);
- }
-
- /**
- * Enumerate slider instances for the current user, and the
- * most recent app report, where available.
- * @param listOnlyInState boolean to indicate that the instances should
- * only include those in a YARN state
- * minAppState <= currentState <= maxAppState
- *
- * @param minAppState minimum application state to include in enumeration.
- * @param maxAppState maximum application state to include
- * @return a map of application instance name to description
- * @throws IOException Any IO problem
- * @throws YarnException YARN problems
- */
- public Map enumSliderInstances(
- boolean listOnlyInState,
- YarnApplicationState minAppState,
- YarnApplicationState maxAppState)
- throws IOException, YarnException {
-
- CoreFileSystem sliderFileSystem = new CoreFileSystem(conf);
- Preconditions.checkArgument(!listOnlyInState || minAppState != null,
- "null minAppState when listOnlyInState set");
- Preconditions.checkArgument(!listOnlyInState || maxAppState != null,
- "null maxAppState when listOnlyInState set");
- if (!listOnlyInState) {
- // if there's not filtering, ask for the entire range of states
- minAppState = YarnApplicationState.NEW;
- maxAppState = YarnApplicationState.KILLED;
- }
- // get the complete list of persistent instances
- Map persistentInstances =
- sliderFileSystem.listPersistentInstances();
- Map descriptions =
- new HashMap(persistentInstances.size());
-
- if (persistentInstances.isEmpty()) {
- // an empty listing is a success if no cluster was named
- log.debug("No application instances found");
- return descriptions;
- }
-
- // enum those the RM knows about
- List rmInstances = listInstances();
- SliderUtils.sortApplicationsByMostRecent(rmInstances);
- Map reportMap =
- SliderUtils.buildApplicationReportMap(rmInstances, minAppState,
- maxAppState);
- log.debug("Persisted {} deployed {} filtered[{}-{}] & de-duped to {}",
- persistentInstances.size(),
- rmInstances.size(),
- minAppState, maxAppState,
- reportMap.size());
-
- // at this point there is a list of all persistent instances, and
- // a (possibly filtered) list of application reports
-
- for (Map.Entry entry : persistentInstances.entrySet()) {
- // loop through the persistent values
- String name = entry.getKey();
-
- // look up any report from the (possibly filtered) report set
- ApplicationReport report = reportMap.get(name);
- if (!listOnlyInState || report != null) {
- // if the enum wants to filter in state, only add it if there is
- // a report in that range. Otherwise: include all values
- SliderInstanceDescription sid = new SliderInstanceDescription(
- name, entry.getValue(), report);
- descriptions.put(name, sid);
- }
- }
-
- return descriptions;
-
- }
-
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/docstore/ExportEntry.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/docstore/ExportEntry.java
deleted file mode 100644
index dd6e034..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/docstore/ExportEntry.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.registry.docstore;
-
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-/**
- * JSON-serializable description of a published key-val configuration.
- *
- * The values themselves are not serialized in the external view; they have to be served up by the far end
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class ExportEntry {
-
- /**
- * The value of the export
- */
- private String value;
- /**
- * The container id of the container that is responsible for the export
- */
- private String containerId;
- /**
- * Tag associated with the container - its usually an identifier different than container id
- * that allows a soft serial id to all containers of a component - e.g. 1, 2, 3, ...
- */
- private String tag;
- /**
- * An export can be at the level of a component or an application
- */
- private String level;
- /**
- * The time when the export was updated
- */
- private String updatedTime;
- /**
- * The time when the export expires
- */
- private String validUntil;
-
- public ExportEntry() {
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public String getContainerId() {
- return containerId;
- }
-
- public void setContainerId(String containerId) {
- this.containerId = containerId;
- }
-
- public String getTag() {
- return tag;
- }
-
- public void setTag(String tag) {
- this.tag = tag;
- }
-
- public String getLevel() {
- return level;
- }
-
- public void setLevel(String level) {
- this.level = level;
- }
- public String getUpdatedTime() {
- return updatedTime;
- }
-
- public void setUpdatedTime(String updatedTime) {
- this.updatedTime = updatedTime;
- }
-
- public String getValidUntil() {
- return validUntil;
- }
-
- public void setValidUntil(String validUntil) {
- this.validUntil = validUntil;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
-
- ExportEntry that = (ExportEntry) o;
-
- if (value != null ? !value.equals(that.value) : that.value != null)
- return false;
- return containerId != null ? containerId.equals(that.containerId) :
- that.containerId == null;
- }
-
- @Override
- public int hashCode() {
- int result = value != null ? value.hashCode() : 0;
- result = 31 * result + (containerId != null ? containerId.hashCode() : 0);
- return result;
- }
-
- @Override
- public String toString() {
- return new StringBuilder("ExportEntry{").
- append("value='").append(value).append("',").
- append("containerId='").append(containerId).append("',").
- append("tag='").append(tag).append("',").
- append("level='").append(level).append("'").
- append("updatedTime='").append(updatedTime).append("'").
- append("validUntil='").append(validUntil).append("'").
- append(" }").toString();
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedConfigSet.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedConfigSet.java
deleted file mode 100644
index edc129e..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedConfigSet.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.registry.docstore;
-
-import org.apache.slider.server.appmaster.web.rest.RestPaths;
-import org.apache.slider.server.services.utility.PatternValidator;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-
-/**
- * Represents a set of configurations for an application, component, etc.
- * Json serialisable; accessors are synchronized
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class PublishedConfigSet {
-
- private static final PatternValidator validator = new PatternValidator(
- RestPaths.PUBLISHED_CONFIGURATION_REGEXP);
-
- public Map configurations =
- new HashMap<>();
-
- public PublishedConfigSet() {
- }
-
- /**
- * Put a name -it will be converted to lower case before insertion.
- * Any existing entry will be overwritten (that includes an entry
- * with a different case in the original name)
- * @param name name of entry
- * @param conf configuration
- * @throws IllegalArgumentException if not a valid name
- */
- public void put(String name, PublishedConfiguration conf) {
- String name1 = name.toLowerCase(Locale.ENGLISH);
- validateName(name1);
- configurations.put(name1, conf);
- }
-
- /**
- * Validate the name -restricting it to the set defined in
- * {@link RestPaths#PUBLISHED_CONFIGURATION_REGEXP}
- * @param name name to validate
- * @throws IllegalArgumentException if not a valid name
- */
- public static void validateName(String name) {
- validator.validate(name);
-
- }
-
- public PublishedConfiguration get(String name) {
- return configurations.get(name);
- }
-
- public boolean contains(String name) {
- return configurations.containsKey(name);
- }
-
- public int size() {
- return configurations.size();
- }
-
- public Set keys() {
- TreeSet keys = new TreeSet<>();
- keys.addAll(configurations.keySet());
- return keys;
- }
-
- public PublishedConfigSet shallowCopy() {
- PublishedConfigSet that = new PublishedConfigSet();
- for (Map.Entry entry :
- configurations.entrySet()) {
- that.put(entry.getKey(), entry.getValue().shallowCopy());
- }
- return that;
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedExports.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedExports.java
deleted file mode 100644
index 58e67ee..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedExports.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.registry.docstore;
-
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.codehaus.jackson.map.SerializationConfig;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import java.io.IOException;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.TreeMap;
-
-/**
- * JSON-serializable description of a published key-val configuration.
- *
- * The values themselves are not serialized in the external view; they have to be served up by the far end
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class PublishedExports {
-
- public String description;
- public long updated;
- public String updatedTime;
- public Map> entries = new HashMap<>();
-
- public PublishedExports() {
- }
-
- /**
- * build an empty published configuration
- *
- * @param description configuration description
- */
- public PublishedExports(String description) {
- this.description = description;
- }
-
- /**
- * Build a configuration from the entries
- *
- * @param description configuration description
- * @param entries entries to put
- */
- public PublishedExports(String description,
- Iterable>> entries) {
- this.description = description;
- putValues(entries);
- }
-
- /**
- * Is the configuration empty. This means either that it has not been given any values,
- * or it is stripped down copy
- * set down over the wire.
- *
- * @return true if it is empty
- */
- public boolean isEmpty() {
- return entries.isEmpty();
- }
-
- public long getUpdated() {
- return updated;
- }
-
- public void setUpdated(long updated) {
- this.updated = updated;
- this.updatedTime = new Date(updated).toString();
- }
-
-
- public Map> sortedEntries() {
- Map> sortedEntries = new TreeMap<>();
- sortedEntries.putAll(entries);
- return sortedEntries;
- }
-
- /**
- * Set the values from an iterable (this includes a Hadoop Configuration and Java properties
- * object). Any existing value set is discarded
- *
- * @param values values to put
- */
- public void putValues(Iterable>> values) {
- this.entries = new HashMap<>();
- for (Map.Entry> entry : values) {
- this.entries.put(entry.getKey(), entry.getValue());
- }
- }
-
- /**
- * Return the values as json string
- *
- * @return the JSON form
- *
- * @throws IOException mapping problems
- */
- public String asJson() throws IOException {
- ObjectMapper mapper = new ObjectMapper();
- mapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true);
- String json = mapper.writeValueAsString(entries);
- return json;
- }
-
- /**
- * This makes a copy without the nested content -so is suitable for returning as part of the list of a parent's
- * values
- *
- * @return the copy
- */
- public PublishedExports shallowCopy() {
- PublishedExports that = new PublishedExports();
- that.description = this.description;
- that.updated = this.updated;
- that.updatedTime = this.updatedTime;
- return that;
- }
-
- @Override
- public String toString() {
- final StringBuilder sb =
- new StringBuilder("PublishedConfiguration{");
- sb.append("description='").append(description).append('\'');
- sb.append(" entries = ").append(entries.size());
- sb.append('}');
- return sb.toString();
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedExportsOutputter.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedExportsOutputter.java
deleted file mode 100644
index 67cb094..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedExportsOutputter.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.registry.docstore;
-
-import com.google.common.base.Charsets;
-import com.google.common.base.Preconditions;
-import org.apache.commons.io.FileUtils;
-import org.apache.commons.io.IOUtils;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-
-/** Output a published configuration */
-public abstract class PublishedExportsOutputter {
-
- protected final PublishedExports exports;
-
- protected PublishedExportsOutputter(PublishedExports exports) {
- this.exports = exports;
- }
-
- /**
- * Create an outputter for the chosen format
- *
- * @param format format enumeration
- * @param exports owning config
- * @return the outputter
- */
-
- public static PublishedExportsOutputter createOutputter(ConfigFormat format,
- PublishedExports exports) {
- Preconditions.checkNotNull(exports);
- switch (format) {
- case JSON:
- return new JsonOutputter(exports);
- default:
- throw new RuntimeException("Unsupported format :" + format);
- }
- }
-
- public void save(File dest) throws IOException {
- FileOutputStream out = null;
- try {
- out = new FileOutputStream(dest);
- save(out);
- out.close();
- } finally {
- org.apache.hadoop.io.IOUtils.closeStream(out);
- }
- }
-
- /**
- * Save the content. The default saves the asString() value to the output stream
- *
- * @param out output stream
- * @throws IOException
- */
- public void save(OutputStream out) throws IOException {
- IOUtils.write(asString(), out, Charsets.UTF_8);
- }
-
- /**
- * Convert to a string
- *
- * @return the string form
- * @throws IOException
- */
- public abstract String asString() throws IOException;
-
- public static class JsonOutputter extends PublishedExportsOutputter {
-
- public JsonOutputter(PublishedExports exports) {
- super(exports);
- }
-
- @Override
- public void save(File dest) throws IOException {
- FileUtils.writeStringToFile(dest, asString(), Charsets.UTF_8);
- }
-
- @Override
- public String asString() throws IOException {
- return exports.asJson();
- }
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedExportsSet.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedExportsSet.java
deleted file mode 100644
index 339d3d6..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/docstore/PublishedExportsSet.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.registry.docstore;
-
-import org.apache.slider.server.appmaster.web.rest.RestPaths;
-import org.apache.slider.server.services.utility.PatternValidator;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-
-/**
- * Represents a set of configurations for an application, component, etc.
- * Json serialisable; accessors are synchronized
- */
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class PublishedExportsSet {
-
- private static final PatternValidator validator = new PatternValidator(
- RestPaths.PUBLISHED_CONFIGURATION_REGEXP);
-
- public Map exports = new HashMap<>();
-
- public PublishedExportsSet() {
- }
-
- /**
- * Put a name -it will be converted to lower case before insertion.
- * Any existing entry will be overwritten (that includes an entry
- * with a different case in the original name)
- * @param name name of entry
- * @param export published export
- * @throws IllegalArgumentException if not a valid name
- */
- public void put(String name, PublishedExports export) {
- String name1 = name.toLowerCase(Locale.ENGLISH);
- validateName(name1);
- exports.put(name1, export);
- }
-
- /**
- * Validate the name -restricting it to the set defined in
- * {@link RestPaths#PUBLISHED_CONFIGURATION_REGEXP}
- * @param name name to validate
- * @throws IllegalArgumentException if not a valid name
- */
- public static void validateName(String name) {
- validator.validate(name);
-
- }
-
- public PublishedExports get(String name) {
- return exports.get(name);
- }
-
- public boolean contains(String name) {
- return exports.containsKey(name);
- }
-
- public int size() {
- return exports.size();
- }
-
- public Set keys() {
- TreeSet keys = new TreeSet<>();
- keys.addAll(exports.keySet());
- return keys;
- }
-
- public PublishedExportsSet shallowCopy() {
- PublishedExportsSet that = new PublishedExportsSet();
- for (Map.Entry entry : exports.entrySet()) {
- that.put(entry.getKey(), entry.getValue().shallowCopy());
- }
- return that;
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/docstore/UriMap.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/docstore/UriMap.java
deleted file mode 100644
index 120966f..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/docstore/UriMap.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.registry.docstore;
-
-import org.codehaus.jackson.annotate.JsonIgnore;
-import org.codehaus.jackson.annotate.JsonIgnoreProperties;
-import org.codehaus.jackson.map.annotate.JsonSerialize;
-
-import java.util.HashMap;
-import java.util.Map;
-
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-public class UriMap {
-
- public Map uris = new HashMap<>();
-
- @JsonIgnore
- public void put(String key, String value) {
- uris.put(key, value);
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/retrieve/AMWebClient.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/retrieve/AMWebClient.java
deleted file mode 100644
index e204178..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/retrieve/AMWebClient.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.registry.retrieve;
-
-import com.sun.jersey.api.client.Client;
-import com.sun.jersey.api.client.GenericType;
-import com.sun.jersey.api.client.WebResource;
-import com.sun.jersey.api.client.config.ClientConfig;
-import com.sun.jersey.api.client.config.DefaultClientConfig;
-import com.sun.jersey.api.json.JSONConfiguration;
-import com.sun.jersey.client.urlconnection.HttpURLConnectionFactory;
-import com.sun.jersey.client.urlconnection.URLConnectionClientHandler;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.security.ssl.SSLFactory;
-import org.apache.slider.client.rest.BaseRestClient;
-import org.apache.slider.core.restclient.HttpVerb;
-import org.apache.slider.core.restclient.UgiJerseyBinding;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.SSLSocketFactory;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
-import java.io.IOException;
-import java.net.HttpURLConnection;
-import java.net.URI;
-import java.net.URL;
-
-/**
- * Class to retrieve artifacts from the AM's web site. This sets up
- * the redirection and security logic properly
- */
-public class AMWebClient {
-
-
- private final BaseRestClient restClient;
- private static final Logger
- log = LoggerFactory.getLogger(AMWebClient.class);
-
-
- public AMWebClient(Configuration conf) {
- UgiJerseyBinding binding = new UgiJerseyBinding(conf);
-
- restClient = new BaseRestClient(binding.createJerseyClient());
-
- }
- public WebResource resource(String url) {
- return restClient.resource(url);
- }
-
- /**
- * 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 type expected
- * @return an instance of the type T
- * @throws IOException on any failure
- */
- public T exec(HttpVerb method, WebResource resource, Class c) throws IOException {
- return restClient.exec(method, resource, c);
- }
-
- /**
- * 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 type expected
- * @return an instance of the type T
- * @throws IOException on any failure
- */
- public T exec(HttpVerb method, WebResource resource, GenericType t)
- throws IOException {
- return restClient.exec(method, resource, t);
- }
-
- /**
- * Execute the GET operation. Failures are raised as IOException subclasses
- * @param resource resource to work against
- * @param c class to build
- * @param type expected
- * @return an instance of the type T
- * @throws IOException on any failure
- */
- public T get(WebResource resource, Class c) throws IOException {
- return restClient.get(resource, c);
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/retrieve/RegistryRetriever.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/retrieve/RegistryRetriever.java
deleted file mode 100644
index b0eddb8..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/registry/retrieve/RegistryRetriever.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.registry.retrieve;
-
-import com.beust.jcommander.Strings;
-import com.sun.jersey.api.client.UniformInterfaceException;
-import com.sun.jersey.api.client.WebResource;
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.registry.client.exceptions.RegistryIOException;
-import org.apache.hadoop.registry.client.types.ServiceRecord;
-import static org.apache.slider.client.ClientRegistryBinder.*;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.exceptions.ExceptionConverter;
-import org.apache.slider.core.registry.docstore.PublishedConfigSet;
-import org.apache.slider.core.registry.docstore.PublishedConfiguration;
-import org.apache.slider.core.registry.docstore.PublishedExports;
-import org.apache.slider.core.registry.docstore.PublishedExportsSet;
-import static org.apache.slider.core.registry.info.CustomRegistryConstants.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-
-/**
- * Registry retriever.
- * This hides the HTTP operations that take place to
- * get the actual content
- */
-public class RegistryRetriever extends AMWebClient {
- private static final Logger log = LoggerFactory.getLogger(RegistryRetriever.class);
-
- private final String externalConfigurationURL;
- private final String internalConfigurationURL;
- private final String externalExportsURL;
- private final String internalExportsURL;
-
- /**
- * Retrieve from a service by locating the
- * exported {@link CustomRegistryConstants.PUBLISHER_CONFIGURATIONS_API}
- * and working off it.
- *
- * @param conf configuration to work from
- * @param record service record
- * @throws RegistryIOException the address type of the endpoint does
- * not match that expected (i.e. not a list of URLs), missing endpoint...
- */
- public RegistryRetriever(Configuration conf, ServiceRecord record) throws RegistryIOException {
- super(conf);
- externalConfigurationURL = lookupRestAPI(record,
- PUBLISHER_CONFIGURATIONS_API, true);
- internalConfigurationURL = lookupRestAPI(record,
- PUBLISHER_CONFIGURATIONS_API, false);
- externalExportsURL = lookupRestAPI(record,
- PUBLISHER_EXPORTS_API, true);
- internalExportsURL = lookupRestAPI(record,
- PUBLISHER_EXPORTS_API, false);
- }
-
- /**
- * Does a bonded registry retriever have a configuration?
- * @param external flag to indicate that it is the external entries to fetch
- * @return true if there is a URL to the configurations defined
- */
- public boolean hasConfigurations(boolean external) {
- return !Strings.isStringEmpty(
- external ? externalConfigurationURL : internalConfigurationURL);
- }
-
- /**
- * Get the configurations of the registry
- * @param external flag to indicate that it is the external entries to fetch
- * @return the configuration sets
- */
- public PublishedConfigSet getConfigurations(boolean external) throws
- FileNotFoundException, IOException {
-
- String confURL = getConfigurationURL(external);
- WebResource webResource = resource(confURL);
- return get(webResource, PublishedConfigSet.class);
- }
-
- protected String getConfigurationURL(boolean external) throws FileNotFoundException {
- String confURL = external ? externalConfigurationURL: internalConfigurationURL;
- if (Strings.isStringEmpty(confURL)) {
- throw new FileNotFoundException("No configuration URL");
- }
- return confURL;
- }
-
- protected String getExportURL(boolean external) throws FileNotFoundException {
- String confURL = external ? externalExportsURL: internalExportsURL;
- if (Strings.isStringEmpty(confURL)) {
- throw new FileNotFoundException("No configuration URL");
- }
- return confURL;
- }
-
- /**
- * Get the configurations of the registry
- * @param external flag to indicate that it is the external entries to fetch
- * @return the configuration sets
- */
- public PublishedExportsSet getExports(boolean external) throws
- FileNotFoundException, IOException {
-
- String exportsUrl = getExportURL(external);
- WebResource webResource = resource(exportsUrl);
- return get(webResource, PublishedExportsSet.class);
- }
-
-
- /**
- * Get a complete configuration, with all values
- * @param configSet config set to ask for
- * @param name name of the configuration
- * @param external flag to indicate that it is an external configuration
- * @return the retrieved config
- * @throws IOException IO problems
- */
- public PublishedConfiguration retrieveConfiguration(PublishedConfigSet configSet,
- String name,
- boolean external) throws IOException {
- String confURL = getConfigurationURL(external);
- if (!configSet.contains(name)) {
- throw new FileNotFoundException("Unknown configuration " + name);
- }
- confURL = SliderUtils.appendToURL(confURL, name);
- WebResource webResource = resource(confURL);
- return get(webResource, PublishedConfiguration.class);
- }
-
- /**
- * Get a complete export, with all values
- * @param exportSet
- * @param name name of the configuration
- * @param external flag to indicate that it is an external configuration
- * @return the retrieved config
- * @throws IOException IO problems
- */
- public PublishedExports retrieveExports(PublishedExportsSet exportSet,
- String name,
- boolean external) throws IOException {
- if (!exportSet.contains(name)) {
- throw new FileNotFoundException("Unknown export " + name);
- }
- String exportsURL = getExportURL(external);
- exportsURL = SliderUtils.appendToURL(exportsURL, name);
- return get(resource(exportsURL), PublishedExports.class);
- }
-
- @Override
- public String toString() {
- final StringBuilder sb =
- new StringBuilder("RegistryRetriever{");
- sb.append("externalConfigurationURL='")
- .append(externalConfigurationURL)
- .append('\'');
- sb.append(", internalConfigurationURL='")
- .append(internalConfigurationURL)
- .append('\'');
- sb.append(", externalExportsURL='").append(externalExportsURL).append('\'');
- sb.append(", internalExportsURL='").append(internalExportsURL).append('\'');
- sb.append('}');
- return sb.toString();
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/zk/BlockingZKWatcher.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/zk/BlockingZKWatcher.java
deleted file mode 100644
index ca49888..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/zk/BlockingZKWatcher.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.zk;
-
-import org.apache.zookeeper.WatchedEvent;
-import org.apache.zookeeper.Watcher;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.net.ConnectException;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-public class BlockingZKWatcher implements Watcher {
-
- protected static final Logger log =
- LoggerFactory.getLogger(BlockingZKWatcher.class);
- private final AtomicBoolean connectedFlag = new AtomicBoolean(false);
-
- @Override
- public void process(WatchedEvent event) {
- log.info("ZK binding callback received");
- connectedFlag.set(true);
- synchronized (connectedFlag) {
- try {
- connectedFlag.notify();
- } catch (Exception e) {
- log.warn("failed while waiting for notification", e);
- }
- }
- }
-
- /**
- * Wait for a flag to go true
- * @param timeout timeout in millis
- */
-
- public void waitForZKConnection(int timeout)
- throws InterruptedException, ConnectException {
- synchronized (connectedFlag) {
- if (!connectedFlag.get()) {
- log.info("waiting for ZK event");
- //wait a bit
- connectedFlag.wait(timeout);
- }
- }
- if (!connectedFlag.get()) {
- throw new ConnectException("Unable to connect to ZK quorum");
- }
- }
-
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/zk/MiniZooKeeperCluster.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/zk/MiniZooKeeperCluster.java
deleted file mode 100644
index 1af883e..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/zk/MiniZooKeeperCluster.java
+++ /dev/null
@@ -1,402 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.zk;
-
-import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.fs.FileUtil;
-import org.apache.hadoop.io.IOUtils;
-import org.apache.hadoop.service.AbstractService;
-import org.apache.zookeeper.server.NIOServerCnxnFactory;
-import org.apache.zookeeper.server.ZooKeeperServer;
-import org.apache.zookeeper.server.persistence.FileTxnLog;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.Reader;
-import java.net.BindException;
-import java.net.InetSocketAddress;
-import java.net.Socket;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
-
-
-/**
- * This is a version of the HBase ZK cluster cut out to be standalone.
- *
- * Important: keep this Java6 language level for now
- */
-public class MiniZooKeeperCluster extends AbstractService {
- private static final Logger LOG = LoggerFactory.getLogger(
- MiniZooKeeperCluster.class);
-
- private static final int TICK_TIME = 2000;
- private static final int CONNECTION_TIMEOUT = 30000;
- public static final int MAX_CLIENT_CONNECTIONS = 1000;
-
- private boolean started;
-
- /** The default port. If zero, we use a random port. */
- private int defaultClientPort = 0;
-
- private int clientPort;
-
- private final List standaloneServerFactoryList;
- private final List zooKeeperServers;
- private final List clientPortList;
-
- private int activeZKServerIndex;
- private int tickTime = 0;
- private File baseDir;
- private final int numZooKeeperServers;
- private String zkQuorum = "";
-
- public MiniZooKeeperCluster(int numZooKeeperServers) {
- super("MiniZooKeeperCluster");
- this.numZooKeeperServers = numZooKeeperServers;
- this.started = false;
- activeZKServerIndex = -1;
- zooKeeperServers = new ArrayList();
- clientPortList = new ArrayList();
- standaloneServerFactoryList = new ArrayList();
- }
-
-
- @Override
- protected void serviceInit(Configuration conf) throws Exception {
- super.serviceInit(conf);
- }
-
- public void setDefaultClientPort(int clientPort) {
- if (clientPort <= 0) {
- throw new IllegalArgumentException("Invalid default ZK client port: "
- + clientPort);
- }
- this.defaultClientPort = clientPort;
- }
-
- /**
- * Selects a ZK client port. Returns the default port if specified.
- * Otherwise, returns a random port. The random port is selected from the
- * range between 49152 to 65535. These ports cannot be registered with IANA
- * and are intended for dynamic allocation (see http://bit.ly/dynports).
- */
- private int selectClientPort(Random r) {
- if (defaultClientPort > 0) {
- return defaultClientPort;
- }
- return 0xc000 + r.nextInt(0x3f00);
- }
-
- public void setTickTime(int tickTime) {
- this.tickTime = tickTime;
- }
-
- public int getBackupZooKeeperServerNum() {
- return zooKeeperServers.size() - 1;
- }
-
- public int getZooKeeperServerNum() {
- return zooKeeperServers.size();
- }
-
- // / XXX: From o.a.zk.t.ClientBase
- private static void setupTestEnv() {
- // during the tests we run with 100K prealloc in the logs.
- // on windows systems prealloc of 64M was seen to take ~15seconds
- // resulting in test failure (client timeout on first session).
- // set env and directly in order to handle static init/gc issues
- System.setProperty("zookeeper.preAllocSize", "100");
- FileTxnLog.setPreallocSize(100 * 1024);
- }
-
- @Override
- protected void serviceStart() throws Exception {
- startup();
- }
-
- /**
- * @return ClientPort server bound to, -1 if there was a
- * binding problem and we couldn't pick another port.
- * @throws IOException
- * @throws InterruptedException
- */
- private int startup() throws IOException,
- InterruptedException {
- if (numZooKeeperServers <= 0)
- return -1;
-
- setupTestEnv();
- started = true;
- baseDir = File.createTempFile("zookeeper", ".dir");
- recreateDir(baseDir);
-
- StringBuilder quorumList = new StringBuilder();
- Random rnd = new Random();
- int tentativePort = selectClientPort(rnd);
-
- // running all the ZK servers
- for (int i = 0; i < numZooKeeperServers; i++) {
- File dir = new File(baseDir, "zookeeper_" + i).getAbsoluteFile();
- recreateDir(dir);
- int tickTimeToUse;
- if (this.tickTime > 0) {
- tickTimeToUse = this.tickTime;
- } else {
- tickTimeToUse = TICK_TIME;
- }
- ZooKeeperServer server = new ZooKeeperServer(dir, dir, tickTimeToUse);
- NIOServerCnxnFactory standaloneServerFactory;
- while (true) {
- try {
- standaloneServerFactory = new NIOServerCnxnFactory();
- standaloneServerFactory.configure(
- new InetSocketAddress(tentativePort),
- MAX_CLIENT_CONNECTIONS
- );
- } catch (BindException e) {
- LOG.debug("Failed binding ZK Server to client port: " +
- tentativePort, e);
- // We're told to use some port but it's occupied, fail
- if (defaultClientPort > 0) return -1;
- // This port is already in use, try to use another.
- tentativePort = selectClientPort(rnd);
- continue;
- }
- break;
- }
-
- // Start up this ZK server
- standaloneServerFactory.startup(server);
- if (!waitForServerUp(tentativePort, CONNECTION_TIMEOUT)) {
- throw new IOException("Waiting for startup of standalone server");
- }
-
- // We have selected this port as a client port.
- clientPortList.add(tentativePort);
- standaloneServerFactoryList.add(standaloneServerFactory);
- zooKeeperServers.add(server);
- if (quorumList.length() > 0) {
- quorumList.append(",");
- }
- quorumList.append("localhost:").append(tentativePort);
- tentativePort++; //for the next server
- }
-
- // set the first one to be active ZK; Others are backups
- activeZKServerIndex = 0;
-
- clientPort = clientPortList.get(activeZKServerIndex);
- zkQuorum = quorumList.toString();
- LOG.info("Started MiniZK Cluster and connect 1 ZK server " +
- "on client port: " + clientPort);
- return clientPort;
- }
-
- private void recreateDir(File dir) throws IOException {
- if (dir.exists()) {
- if (!FileUtil.fullyDelete(dir)) {
- throw new IOException("Could not delete zk base directory: " + dir);
- }
- }
- try {
- dir.mkdirs();
- } catch (SecurityException e) {
- throw new IOException("creating dir: " + dir, e);
- }
- }
-
- @Override
- protected void serviceStop() throws Exception {
-
- if (!started) {
- return;
- }
- started = false;
-
- try {
- // shut down all the zk servers
- for (int i = 0; i < standaloneServerFactoryList.size(); i++) {
- NIOServerCnxnFactory standaloneServerFactory =
- standaloneServerFactoryList.get(i);
- int clientPort = clientPortList.get(i);
-
- standaloneServerFactory.shutdown();
- if (!waitForServerDown(clientPort, CONNECTION_TIMEOUT)) {
- throw new IOException("Waiting for shutdown of standalone server");
- }
- }
- for (ZooKeeperServer zkServer : zooKeeperServers) {
- //explicitly close ZKDatabase since ZookeeperServer does not close them
- zkServer.getZKDatabase().close();
- }
- } finally {
- // clear everything
- activeZKServerIndex = 0;
- standaloneServerFactoryList.clear();
- clientPortList.clear();
- zooKeeperServers.clear();
- }
-
- LOG.info("Shutdown MiniZK cluster with all ZK servers");
- }
-
- /**@return clientPort return clientPort if there is another ZK backup can run
- * when killing the current active; return -1, if there is no backups.
- * @throws IOException
- * @throws InterruptedException
- */
- public int killCurrentActiveZooKeeperServer() throws IOException,
- InterruptedException {
- if (!started || activeZKServerIndex < 0) {
- return -1;
- }
-
- // Shutdown the current active one
- NIOServerCnxnFactory standaloneServerFactory =
- standaloneServerFactoryList.get(activeZKServerIndex);
- int clientPort = clientPortList.get(activeZKServerIndex);
-
- standaloneServerFactory.shutdown();
- if (!waitForServerDown(clientPort, CONNECTION_TIMEOUT)) {
- throw new IOException("Waiting for shutdown of standalone server");
- }
-
- zooKeeperServers.get(activeZKServerIndex).getZKDatabase().close();
-
- // remove the current active zk server
- standaloneServerFactoryList.remove(activeZKServerIndex);
- clientPortList.remove(activeZKServerIndex);
- zooKeeperServers.remove(activeZKServerIndex);
- LOG.info("Kill the current active ZK servers in the cluster " +
- "on client port: " + clientPort);
-
- if (standaloneServerFactoryList.size() == 0) {
- // there is no backup servers;
- return -1;
- }
- clientPort = clientPortList.get(activeZKServerIndex);
- LOG.info("Activate a backup zk server in the cluster " +
- "on client port: " + clientPort);
- // return the next back zk server's port
- return clientPort;
- }
-
- /**
- * Kill one back up ZK servers
- * @throws IOException
- * @throws InterruptedException
- */
- public void killOneBackupZooKeeperServer() throws IOException,
- InterruptedException {
- if (!started || activeZKServerIndex < 0 ||
- standaloneServerFactoryList.size() <= 1) {
- return;
- }
-
- int backupZKServerIndex = activeZKServerIndex + 1;
- // Shutdown the current active one
- NIOServerCnxnFactory standaloneServerFactory =
- standaloneServerFactoryList.get(backupZKServerIndex);
- int clientPort = clientPortList.get(backupZKServerIndex);
-
- standaloneServerFactory.shutdown();
- if (!waitForServerDown(clientPort, CONNECTION_TIMEOUT)) {
- throw new IOException("Waiting for shutdown of standalone server");
- }
-
- zooKeeperServers.get(backupZKServerIndex).getZKDatabase().close();
-
- // remove this backup zk server
- standaloneServerFactoryList.remove(backupZKServerIndex);
- clientPortList.remove(backupZKServerIndex);
- zooKeeperServers.remove(backupZKServerIndex);
- LOG.info("Kill one backup ZK servers in the cluster " +
- "on client port: " + clientPort);
- }
-
- // XXX: From o.a.zk.t.ClientBase
- private static boolean waitForServerDown(int port, long timeout) throws
- InterruptedException {
- long start = System.currentTimeMillis();
- while (true) {
- try {
- Socket sock = null;
- try {
- sock = new Socket("localhost", port);
- OutputStream outstream = sock.getOutputStream();
- outstream.write("stat".getBytes("UTF-8"));
- outstream.flush();
- } finally {
- IOUtils.closeSocket(sock);
- }
- } catch (IOException e) {
- return true;
- }
-
- if (System.currentTimeMillis() > start + timeout) {
- break;
- }
- Thread.sleep(250);
- }
- return false;
- }
-
- // XXX: From o.a.zk.t.ClientBase
- private static boolean waitForServerUp(int port, long timeout) throws
- InterruptedException {
- long start = System.currentTimeMillis();
- while (true) {
- try {
- Socket sock = null;
- sock = new Socket("localhost", port);
- BufferedReader reader = null;
- try {
- OutputStream outstream = sock.getOutputStream();
- outstream.write("stat".getBytes("UTF-8"));
- outstream.flush();
-
- Reader isr = new InputStreamReader(sock.getInputStream(), "UTF-8");
- reader = new BufferedReader(isr);
- String line = reader.readLine();
- if (line != null && line.startsWith("Zookeeper version:")) {
- return true;
- }
- } finally {
- IOUtils.closeSocket(sock);
- IOUtils.closeStream(reader);
- }
- } catch (IOException e) {
- // ignore as this is expected
- LOG.debug("server localhost:" + port + " not up " + e);
- }
-
- if (System.currentTimeMillis() > start + timeout) {
- break;
- }
- Thread.sleep(250);
- }
- return false;
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/zk/ZKCallback.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/zk/ZKCallback.java
deleted file mode 100644
index 045b72c..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/zk/ZKCallback.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.zk;
-
-import org.apache.zookeeper.Watcher;
-
-/**
- * Relays ZK watcher events to a closure
- */
-public abstract class ZKCallback implements Watcher {
-
- public ZKCallback() {
- }
-
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/zk/ZKPathBuilder.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/zk/ZKPathBuilder.java
deleted file mode 100644
index b088568..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/core/zk/ZKPathBuilder.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.slider.core.zk;
-
-import java.util.Locale;
-
-public final class ZKPathBuilder {
-
- private final String username, appname, clustername;
- private final String quorum;
-
- private String appPath;
- private String registryPath;
- private final String appQuorum;
-
- public ZKPathBuilder(String username,
- String appname,
- String clustername,
- String quorum,
- String appQuorum) {
- this.username = username;
- this.appname = appname;
- this.clustername = clustername;
- this.quorum = quorum;
- appPath = buildAppPath();
- registryPath = buildRegistryPath();
- this.appQuorum = appQuorum;
- }
-
- public String buildAppPath() {
- return String.format(Locale.ENGLISH, "/yarnapps_%s_%s_%s", appname,
- username, clustername);
-
- }
-
- public String buildRegistryPath() {
- return String.format(Locale.ENGLISH, "/services_%s_%s_%s", appname,
- username, clustername);
-
- }
-
- public String getQuorum() {
- return quorum;
- }
-
- public String getAppQuorum() {
- return appQuorum;
- }
-
- public String getAppPath() {
- return appPath;
- }
-
- public void setAppPath(String appPath) {
- this.appPath = appPath;
- }
-
- public String getRegistryPath() {
- return registryPath;
- }
-
- public void setRegistryPath(String registryPath) {
- this.registryPath = registryPath;
- }
-
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/AbstractProviderService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/AbstractProviderService.java
deleted file mode 100644
index 1e1b1b8..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/AbstractProviderService.java
+++ /dev/null
@@ -1,148 +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.providers;
-
-import org.apache.hadoop.service.AbstractService;
-import org.apache.hadoop.util.StringUtils;
-import org.apache.hadoop.yarn.api.ApplicationConstants;
-import org.apache.hadoop.yarn.api.records.Container;
-import org.apache.hadoop.yarn.api.records.ContainerId;
-import org.apache.hadoop.yarn.api.records.ContainerStatus;
-import org.apache.hadoop.yarn.service.conf.SliderKeys;
-import org.apache.hadoop.yarn.service.provider.ProviderService;
-import org.apache.hadoop.yarn.service.provider.ProviderUtils;
-import org.apache.hadoop.yarn.service.timelineservice.ServiceTimelinePublisher;
-import org.apache.slider.api.resource.Application;
-import org.apache.slider.api.resource.Component;
-import org.apache.slider.api.resource.ContainerState;
-import org.apache.slider.common.tools.SliderFileSystem;
-import org.apache.slider.common.tools.SliderUtils;
-import org.apache.slider.core.exceptions.SliderException;
-import org.apache.slider.core.launch.CommandLineBuilder;
-import org.apache.slider.core.launch.ContainerLauncher;
-import org.apache.slider.core.registry.docstore.PublishedConfiguration;
-import org.apache.slider.server.appmaster.state.RoleInstance;
-import org.apache.slider.server.appmaster.state.StateAccessForProviders;
-import org.apache.slider.server.services.yarnregistry.YarnRegistryViewForProviders;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import static org.apache.hadoop.yarn.service.utils.ServiceApiUtil.$;
-
-public abstract class AbstractProviderService extends AbstractService
- implements ProviderService, SliderKeys {
-
- protected static final Logger log =
- LoggerFactory.getLogger(AbstractProviderService.class);
- private static final ProviderUtils providerUtils = new ProviderUtils();
- protected StateAccessForProviders amState;
- protected YarnRegistryViewForProviders yarnRegistry;
- private ServiceTimelinePublisher serviceTimelinePublisher;
-
- protected AbstractProviderService(String name) {
- super(name);
- }
-
- public abstract void processArtifact(ContainerLauncher launcher,
- Application application, RoleInstance roleInstance,
- SliderFileSystem fileSystem) throws IOException;
-
-
- public void buildContainerLaunchContext(ContainerLauncher launcher,
- Application application, Container container, ProviderRole providerRole,
- SliderFileSystem fileSystem, RoleInstance roleInstance)
- throws IOException, SliderException {
- Component component = providerRole.component;
- processArtifact(launcher, application, roleInstance, fileSystem);
-
- // Generate tokens (key-value pair) for config substitution.
- // Get pre-defined tokens
- Map globalTokens = amState.getGlobalSubstitutionTokens();
- Map tokensForSubstitution = providerUtils
- .initCompTokensForSubstitute(null);
- tokensForSubstitution.putAll(globalTokens);
- // Set the environment variables in launcher
- launcher.putEnv(SliderUtils
- .buildEnvMap(component.getConfiguration(), tokensForSubstitution));
- launcher.setEnv("WORK_DIR", ApplicationConstants.Environment.PWD.$());
- launcher.setEnv("LOG_DIR", ApplicationConstants.LOG_DIR_EXPANSION_VAR);
- if (System.getenv(HADOOP_USER_NAME) != null) {
- launcher.setEnv(HADOOP_USER_NAME, System.getenv(HADOOP_USER_NAME));
- }
- launcher.setEnv("LANG", "en_US.UTF-8");
- launcher.setEnv("LC_ALL", "en_US.UTF-8");
- launcher.setEnv("LANGUAGE", "en_US.UTF-8");
-
- for (Entry entry : launcher.getEnv().entrySet()) {
- tokensForSubstitution.put($(entry.getKey()), entry.getValue());
- }
- providerUtils.addComponentHostTokens(tokensForSubstitution, amState);
-
- // create config file on hdfs and add local resource
-
- // substitute launch command
- String launchCommand = ProviderUtils
- .substituteStrWithTokens(component.getLaunchCommand(),
- tokensForSubstitution);
- CommandLineBuilder operation = new CommandLineBuilder();
- operation.add(launchCommand);
- operation.addOutAndErrFiles(OUT_FILE, ERR_FILE);
- launcher.addCommand(operation.build());
-
- // publish exports
- providerUtils
- .substituteMapWithTokens(application.getQuicklinks(), tokensForSubstitution);
- PublishedConfiguration pubconf = new PublishedConfiguration(QUICK_LINKS,
- application.getQuicklinks().entrySet());
- amState.getPublishedSliderConfigurations().put(QUICK_LINKS, pubconf);
- if (serviceTimelinePublisher != null) {
- serviceTimelinePublisher.serviceAttemptUpdated(application);
- }
- }
-
- public boolean processContainerStatus(ContainerId containerId,
- ContainerStatus status) {
- log.debug("Handling container status: {}", status);
- if (SliderUtils.isEmpty(status.getIPs()) ||
- SliderUtils.isUnset(status.getHost())) {
- return true;
- }
- RoleInstance instance = amState.getOwnedContainer(containerId);
- if (instance == null) {
- // container is completed?
- return false;
- }
-
- // TODO publish ip and host
- org.apache.slider.api.resource.Container container =
- instance.providerRole.component.getContainer(containerId.toString());
- if (container != null) {
- container.setIp(StringUtils.join(",", status.getIPs()));
- container.setHostname(status.getHost());
- container.setState(ContainerState.READY);
- } else {
- log.warn(containerId + " not found in Application!");
- }
- return false;
- }
-
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/MonitorDetail.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/MonitorDetail.java
deleted file mode 100644
index 27d3415..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/MonitorDetail.java
+++ /dev/null
@@ -1,43 +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.providers;
-
-/**
- * Details about some exported information from a provider to the AM web UI.
- */
-public class MonitorDetail {
-
- private final String value;
- private final boolean isUrl;
-
- public MonitorDetail(String value, boolean isUrl) {
- this.value = value;
- this.isUrl = isUrl;
- }
-
- public String getValue() {
- return value;
- }
-
- public boolean isUrl() {
- return isUrl;
- }
-
- public String toString() {
- return "MonitorDetail[" + value + " isUrl=" + isUrl + "]";
- }
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/PlacementPolicy.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/PlacementPolicy.java
deleted file mode 100644
index 128dd5d..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/PlacementPolicy.java
+++ /dev/null
@@ -1,64 +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.providers;
-
-/**
- * Placement values.
- * This is nominally a bitmask, though not all values make sense
- */
-public class PlacementPolicy {
-
- /**
- * Default value: history used, anti-affinity hinted at on rebuild/flex up
- */
- public static final int NONE = 0;
-
- /**
- * Default value: history used, anti-affinity hinted at on rebuild/flex up
- */
- public static final int DEFAULT = NONE;
-
- /**
- * Strict placement: when asking for an instance for which there is
- * history, mandate that it is strict
- */
- public static final int STRICT = 1;
-
- /**
- * No data locality; do not use placement history
- */
- public static final int ANYWHERE = 2;
-
- /**
- * @Deprecated: use {@link #ANYWHERE}
- */
- @Deprecated
- public static final int NO_DATA_LOCALITY = ANYWHERE;
-
- /**
- * Anti-affinity is mandatory.
- */
- public static final int ANTI_AFFINITY_REQUIRED = 4;
-
- /**
- * Exclude from flexing; used internally to mark AMs.
- */
- public static final int EXCLUDE_FROM_FLEXING = 16;
-
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/PlacementPolicyOptions.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/PlacementPolicyOptions.java
deleted file mode 100644
index e61f944..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/PlacementPolicyOptions.java
+++ /dev/null
@@ -1,26 +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.providers;
-
-public enum PlacementPolicyOptions {
-
- EXCLUDE_FROM_FLEXING,
- NO_DATA_LOCALITY,
- ANTI_AFFINITY_REQUIRED,
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/ProviderCompleted.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/ProviderCompleted.java
deleted file mode 100644
index f6ff4fd..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/ProviderCompleted.java
+++ /dev/null
@@ -1,29 +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.providers;
-
-/**
- * This is the callback triggered by the {@link ProviderCompletedCallable}
- * when it generates a notification
- */
-public interface ProviderCompleted {
-
- public void eventCallbackEvent(Object parameter);
-
-}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/ProviderCompletedCallable.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/ProviderCompletedCallable.java
deleted file mode 100644
index 47939c9..0000000
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-slider/hadoop-yarn-slider-core/src/main/java/org/apache/slider/providers/ProviderCompletedCallable.java
+++ /dev/null
@@ -1,38 +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.providers;
-
-import java.util.concurrent.Callable;
-
-public class ProviderCompletedCallable implements Callable