SLIDER149 in sync with YARN-913 changes
Project: http://git-wip-us.apache.org/repos/asf/incubator-slider/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-slider/commit/f058495a Tree: http://git-wip-us.apache.org/repos/asf/incubator-slider/tree/f058495a Diff: http://git-wip-us.apache.org/repos/asf/incubator-slider/diff/f058495a Branch: refs/heads/develop Commit: f058495a6c05a385518333d135b84d357780c7f6 Parents: 62335bf Author: Steve Loughran <ste...@apache.org> Authored: Tue Sep 30 17:42:22 2014 -0700 Committer: Steve Loughran <ste...@apache.org> Committed: Tue Sep 30 17:42:22 2014 -0700 ---------------------------------------------------------------------- .../org/apache/slider/client/SliderClient.java | 6 +++--- .../YarnRegistryViewForProviders.java | 10 ++++----- .../TestStandaloneYarnRegistryAM.groovy | 17 ++++++--------- .../registry/TestRegistryRestResources.groovy | 4 ++-- .../minicluster/live/TestHBaseMaster.groovy | 8 +++---- .../minicluster/live/TestTwoLiveClusters.groovy | 22 +++++++++----------- 6 files changed, 30 insertions(+), 37 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f058495a/slider-core/src/main/java/org/apache/slider/client/SliderClient.java ---------------------------------------------------------------------- diff --git a/slider-core/src/main/java/org/apache/slider/client/SliderClient.java b/slider-core/src/main/java/org/apache/slider/client/SliderClient.java index 88d07b5..99896c8 100644 --- a/slider-core/src/main/java/org/apache/slider/client/SliderClient.java +++ b/slider-core/src/main/java/org/apache/slider/client/SliderClient.java @@ -41,9 +41,9 @@ import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.exceptions.YarnException; import org.apache.hadoop.yarn.registry.client.api.RegistryConstants; import org.apache.hadoop.yarn.registry.client.api.RegistryOperations; -import static org.apache.hadoop.yarn.registry.client.binding.RegistryOperationUtils.*; +import static org.apache.hadoop.yarn.registry.client.binding.RegistryUtils.*; -import org.apache.hadoop.yarn.registry.client.binding.RegistryOperationUtils; +import org.apache.hadoop.yarn.registry.client.binding.RegistryUtils; import org.apache.hadoop.yarn.registry.client.exceptions.NoRecordException; import org.apache.hadoop.yarn.registry.client.types.Endpoint; import org.apache.hadoop.yarn.registry.client.types.RegistryPathStatus; @@ -1455,7 +1455,7 @@ public class SliderClient extends AbstractSliderLaunchedService implements RunSe } public String getUsername() throws IOException { - return RegistryOperationUtils.currentUser(); + return RegistryUtils.currentUser(); } /** http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f058495a/slider-core/src/main/java/org/apache/slider/server/services/yarnregistry/YarnRegistryViewForProviders.java ---------------------------------------------------------------------- diff --git a/slider-core/src/main/java/org/apache/slider/server/services/yarnregistry/YarnRegistryViewForProviders.java b/slider-core/src/main/java/org/apache/slider/server/services/yarnregistry/YarnRegistryViewForProviders.java index e5b150a..d0c891d 100644 --- a/slider-core/src/main/java/org/apache/slider/server/services/yarnregistry/YarnRegistryViewForProviders.java +++ b/slider-core/src/main/java/org/apache/slider/server/services/yarnregistry/YarnRegistryViewForProviders.java @@ -20,7 +20,7 @@ package org.apache.slider.server.services.yarnregistry; import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; import org.apache.hadoop.yarn.registry.client.api.RegistryOperations; -import org.apache.hadoop.yarn.registry.client.binding.RegistryOperationUtils; +import org.apache.hadoop.yarn.registry.client.binding.RegistryUtils; import org.apache.hadoop.yarn.registry.client.binding.RegistryPathUtils; import org.apache.hadoop.yarn.registry.client.api.CreateFlags; @@ -104,7 +104,7 @@ public class YarnRegistryViewForProviders { String serviceName, String componentName, ServiceRecord record) throws IOException { - String path = RegistryOperationUtils.componentPath( + String path = RegistryUtils.componentPath( user, serviceClass, serviceName, componentName); registryOperations.mknode(RegistryPathUtils.parentOf(path), true); registryOperations.create(path, record, CreateFlags.OVERWRITE); @@ -122,7 +122,7 @@ public class YarnRegistryViewForProviders { String serviceClass, String serviceName, ServiceRecord record) throws IOException { - String path = RegistryOperationUtils.servicePath( + String path = RegistryUtils.servicePath( username, serviceClass, serviceName); registryOperations.mknode(RegistryPathUtils.parentOf(path), true); registryOperations.create(path, record, CreateFlags.OVERWRITE); @@ -139,14 +139,14 @@ public class YarnRegistryViewForProviders { String serviceClass, String serviceName, ServiceRecord record) throws IOException { - String path = RegistryOperationUtils.servicePath( + String path = RegistryUtils.servicePath( user, serviceClass, serviceName); registryOperations.mknode(RegistryPathUtils.parentOf(path), true); registryOperations.create(path, record, CreateFlags.OVERWRITE); } public void rmComponent(String componentName) throws IOException { - String path = RegistryOperationUtils.componentPath( + String path = RegistryUtils.componentPath( user, sliderServiceclass, instanceName, componentName); registryOperations.delete(path, false); http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f058495a/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneYarnRegistryAM.groovy ---------------------------------------------------------------------- diff --git a/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneYarnRegistryAM.groovy b/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneYarnRegistryAM.groovy index 0155232..b9238f4 100644 --- a/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneYarnRegistryAM.groovy +++ b/slider-core/src/test/groovy/org/apache/slider/agent/standalone/TestStandaloneYarnRegistryAM.groovy @@ -24,14 +24,13 @@ import org.apache.hadoop.yarn.api.records.ApplicationReport import org.apache.hadoop.yarn.api.records.YarnApplicationState import org.apache.hadoop.yarn.conf.YarnConfiguration import org.apache.hadoop.yarn.registry.client.api.RegistryConstants -import org.apache.hadoop.yarn.registry.client.binding.RecordOperations import org.apache.hadoop.yarn.registry.client.binding.RegistryTypeUtils import org.apache.hadoop.yarn.registry.client.services.RegistryOperationsClient import org.apache.hadoop.yarn.registry.client.types.RegistryPathStatus import org.apache.hadoop.yarn.registry.client.types.ServiceRecord import org.apache.slider.core.exceptions.UnknownApplicationInstanceException -import static org.apache.hadoop.yarn.registry.client.binding.RegistryOperationUtils.* +import static org.apache.hadoop.yarn.registry.client.binding.RegistryUtils.* import org.apache.slider.agent.AgentMiniClusterTestBase import org.apache.slider.api.ClusterNode import org.apache.slider.client.SliderClient @@ -49,11 +48,7 @@ import org.apache.slider.server.appmaster.PublishedArtifacts import org.apache.slider.server.appmaster.web.rest.RestPaths import org.junit.Test -import static org.apache.slider.core.registry.info.CustomRegistryConstants.AGENT_ONEWAY_REST_API -import static org.apache.slider.core.registry.info.CustomRegistryConstants.AGENT_SECURE_REST_API -import static org.apache.slider.core.registry.info.CustomRegistryConstants.AM_IPC_PROTOCOL -import static org.apache.slider.core.registry.info.CustomRegistryConstants.MANAGEMENT_REST_API -import static org.apache.slider.core.registry.info.CustomRegistryConstants.PUBLISHER_REST_API +import static org.apache.slider.core.registry.info.CustomRegistryConstants.* /** * work with a YARN registry @@ -147,15 +142,15 @@ class TestStandaloneYarnRegistryAM extends AgentMiniClusterTestBase { def self = currentUser() - List<RegistryPathStatus> serviceTypes = registryService.listFull(homePathForUser(self)) + def children = statChildren(registryService, homePathForUser(self)); + Collection<RegistryPathStatus> serviceTypes = children.values() dumpCollection(serviceTypes) def recordsPath = serviceclassPath(self, SliderKeys.APP_TYPE) - Map < String, ServiceRecord > recordMap = RecordOperations.extractServiceRecords( + Map<String, ServiceRecord> recordMap = extractServiceRecords( registryService, - recordsPath, - registryService.listFull(recordsPath)) + recordsPath); def serviceRecords = recordMap.values(); dumpCollection(serviceRecords) assert serviceRecords.size() == 1 http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f058495a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/rest/registry/TestRegistryRestResources.groovy ---------------------------------------------------------------------- diff --git a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/rest/registry/TestRegistryRestResources.groovy b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/rest/registry/TestRegistryRestResources.groovy index 9dd3092..e6d31fd 100644 --- a/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/rest/registry/TestRegistryRestResources.groovy +++ b/slider-core/src/test/groovy/org/apache/slider/server/appmaster/web/rest/registry/TestRegistryRestResources.groovy @@ -25,7 +25,7 @@ import com.sun.jersey.api.client.WebResource import groovy.transform.CompileStatic import groovy.util.logging.Slf4j import org.apache.hadoop.yarn.registry.client.api.RegistryConstants -import org.apache.hadoop.yarn.registry.client.binding.RegistryOperationUtils +import org.apache.hadoop.yarn.registry.client.binding.RegistryUtils import org.apache.slider.api.StatusKeys import org.apache.slider.client.SliderClient import org.apache.slider.common.SliderKeys @@ -113,7 +113,7 @@ class TestRegistryRestResources extends AgentTestBase { assert entryResource.service == null; // test the available GET URIs - def userhome = RegistryOperationUtils.homePathForCurrentUser() + def userhome = RegistryUtils.homePathForCurrentUser() def userServicesURL = appendToURL(registry_url, userhome + RegistryConstants.PATH_USER_SERVICES) http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f058495a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/live/TestHBaseMaster.groovy ---------------------------------------------------------------------- diff --git a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/live/TestHBaseMaster.groovy b/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/live/TestHBaseMaster.groovy index 422ee8d..84db30f 100644 --- a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/live/TestHBaseMaster.groovy +++ b/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/live/TestHBaseMaster.groovy @@ -20,7 +20,7 @@ package org.apache.slider.providers.hbase.minicluster.live import groovy.transform.CompileStatic import groovy.util.logging.Slf4j -import org.apache.hadoop.yarn.registry.client.binding.RegistryOperationUtils +import org.apache.hadoop.yarn.registry.client.binding.RegistryUtils import org.apache.hadoop.yarn.registry.client.types.ServiceRecord import org.apache.slider.common.SliderXmlConfKeys import org.apache.slider.api.ClusterDescription @@ -76,10 +76,10 @@ class TestHBaseMaster extends HBaseMiniClusterTestBase { // look up the registry entries for HBase describe "service registry names" - Map<String, ServiceRecord> records = RegistryOperationUtils.listServiceRecords( + Map<String, ServiceRecord> records = RegistryUtils.listServiceRecords( client.registryOperations, - RegistryOperationUtils.serviceclassPath( - RegistryOperationUtils.homePathForCurrentUser(), + RegistryUtils.serviceclassPath( + RegistryUtils.homePathForCurrentUser(), HBaseKeys.HBASE_SERVICE_TYPE ) ) http://git-wip-us.apache.org/repos/asf/incubator-slider/blob/f058495a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/live/TestTwoLiveClusters.groovy ---------------------------------------------------------------------- diff --git a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/live/TestTwoLiveClusters.groovy b/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/live/TestTwoLiveClusters.groovy index 01a67c7..bb652b3 100644 --- a/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/live/TestTwoLiveClusters.groovy +++ b/slider-providers/hbase/slider-hbase-provider/src/test/groovy/org/apache/slider/providers/hbase/minicluster/live/TestTwoLiveClusters.groovy @@ -21,7 +21,7 @@ package org.apache.slider.providers.hbase.minicluster.live import groovy.transform.CompileStatic import groovy.util.logging.Slf4j import org.apache.hadoop.yarn.registry.client.api.RegistryOperations -import org.apache.hadoop.yarn.registry.client.binding.RegistryOperationUtils +import org.apache.hadoop.yarn.registry.client.binding.RegistryUtils import org.apache.hadoop.yarn.registry.client.binding.RegistryPathUtils import org.apache.hadoop.yarn.registry.client.types.ServiceRecord import org.apache.slider.common.SliderKeys @@ -86,19 +86,17 @@ class TestTwoLiveClusters extends HBaseMiniClusterTestBase { // registry instances def names = client.listRegistryNames(clustername) describe "service registry names" RegistryOperations registry = cluster2Client.registryOperations - def home = RegistryOperationUtils.homePathForCurrentUser() + def home = RegistryUtils.homePathForCurrentUser() - def userSliderInstancesPath = RegistryOperationUtils.serviceclassPath( - RegistryOperationUtils.currentUser(), SliderKeys.APP_TYPE) + def userSliderInstancesPath = RegistryUtils.serviceclassPath( + RegistryUtils.currentUser(), SliderKeys.APP_TYPE) - def names = RegistryOperationUtils.listServiceRecords(registry, + def names = RegistryUtils.listServiceRecords(registry, userSliderInstancesPath) dumpMap(names) - - def stats = registry.listFull(userSliderInstancesPath) - - dumpCollection(stats) + def statMap = RegistryUtils.statChildren(registry, userSliderInstancesPath) + assert statMap.size() == 2 List<String> instanceIds = sliderClient.listRegisteredSliderInstances() dumpRegistryInstanceIDs(instanceIds) @@ -112,11 +110,11 @@ class TestTwoLiveClusters extends HBaseMiniClusterTestBase { assert instances.size() == 2 - def hbaseServicePath = RegistryOperationUtils.serviceclassPath( - RegistryOperationUtils.currentUser(), + def hbaseServicePath = RegistryUtils.serviceclassPath( + RegistryUtils.currentUser(), HBaseKeys.HBASE_SERVICE_TYPE) Map<String, ServiceRecord> hbaseInstances = - RegistryOperationUtils.listServiceRecords(registry, + RegistryUtils.listServiceRecords(registry, hbaseServicePath); assert hbaseInstances.size() == 2