[1/2] hadoop git commit: YARN-8018. Added support for initiating yarn service upgrade. Contributed by Chandni Singh
Repository: hadoop Updated Branches: refs/heads/branch-3.1 23179c06a -> 150085cc6 http://git-wip-us.apache.org/repos/asf/hadoop/blob/150085cc/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/TestYarnNativeServices.java -- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/TestYarnNativeServices.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/TestYarnNativeServices.java index 51a190e..2b40e49 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/TestYarnNativeServices.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/TestYarnNativeServices.java @@ -33,7 +33,7 @@ import org.apache.hadoop.yarn.service.api.records.Component; import org.apache.hadoop.yarn.service.api.records.Container; import org.apache.hadoop.yarn.service.api.records.ContainerState; import org.apache.hadoop.yarn.service.client.ServiceClient; -import org.apache.hadoop.yarn.service.exceptions.SliderException; +import org.apache.hadoop.yarn.service.utils.ServiceApiUtil; import org.apache.hadoop.yarn.service.utils.SliderFileSystem; import org.hamcrest.CoreMatchers; import org.junit.After; @@ -86,7 +86,7 @@ public class TestYarnNativeServices extends ServiceTestUtils { @Test (timeout = 20) public void testCreateFlexStopDestroyService() throws Exception { setupInternal(NUM_NMS); -ServiceClient client = createClient(); +ServiceClient client = createClient(getConf()); Service exampleApp = createExampleApplication(); client.actionCreate(exampleApp); SliderFileSystem fileSystem = new SliderFileSystem(getConf()); @@ -143,7 +143,7 @@ public class TestYarnNativeServices extends ServiceTestUtils { @Test (timeout = 20) public void testComponentStartOrder() throws Exception { setupInternal(NUM_NMS); -ServiceClient client = createClient(); +ServiceClient client = createClient(getConf()); Service exampleApp = new Service(); exampleApp.setName("teststartorder"); exampleApp.setVersion("v1"); @@ -177,7 +177,7 @@ public class TestYarnNativeServices extends ServiceTestUtils { String userB = "userb"; setupInternal(NUM_NMS); -ServiceClient client = createClient(); +ServiceClient client = createClient(getConf()); String origBasePath = getConf().get(YARN_SERVICE_BASE_PATH); Service userAApp = new Service(); @@ -229,7 +229,7 @@ public class TestYarnNativeServices extends ServiceTestUtils { System.setProperty("user.name", user); setupInternal(NUM_NMS); -ServiceClient client = createClient(); +ServiceClient client = createClient(getConf()); Service appA = new Service(); appA.setName(sameAppName); @@ -298,7 +298,7 @@ public class TestYarnNativeServices extends ServiceTestUtils { setConf(conf); setupInternal(NUM_NMS); -ServiceClient client = createClient(); +ServiceClient client = createClient(getConf()); Service exampleApp = createExampleApplication(); client.actionCreate(exampleApp); MultimapcontainersBeforeFailure = @@ -341,6 +341,28 @@ public class TestYarnNativeServices extends ServiceTestUtils { client.actionDestroy(exampleApp.getName()); } + @Test(timeout = 20) + public void testUpgradeService() throws Exception { +setupInternal(NUM_NMS); +ServiceClient client = createClient(getConf()); + +Service service = createExampleApplication(); +client.actionCreate(service); +waitForServiceToBeStarted(client, service); + +//upgrade the service +service.setVersion("v2"); +client.actionUpgrade(service); + +//wait for service to be in upgrade state +waitForServiceToBeInState(client, service, ServiceState.UPGRADING); +SliderFileSystem fs = new SliderFileSystem(getConf()); +Service fromFs = ServiceApiUtil.loadServiceUpgrade(fs, +service.getName(), service.getVersion()); +Assert.assertEquals(service.getName(), fromFs.getName()); +Assert.assertEquals(service.getVersion(), fromFs.getVersion()); + } + // Check containers launched are in dependency order // Get all containers into a list and sort based on container launch time e.g. // compa-c1, compa-c2, compb-c1, compb-c2; @@ -478,16 +500,7 @@ public class TestYarnNativeServices extends ServiceTestUtils { */ private void waitForServiceToBeStable(ServiceClient client, Service exampleApp) throws TimeoutException,
[1/2] hadoop git commit: YARN-8018. Added support for initiating yarn service upgrade. Contributed by Chandni Singh
Repository: hadoop Updated Branches: refs/heads/trunk edb202e49 -> 27d60a163 http://git-wip-us.apache.org/repos/asf/hadoop/blob/27d60a16/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/TestYarnNativeServices.java -- diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/TestYarnNativeServices.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/TestYarnNativeServices.java index 091e624..df6d642 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/TestYarnNativeServices.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/test/java/org/apache/hadoop/yarn/service/TestYarnNativeServices.java @@ -33,7 +33,7 @@ import org.apache.hadoop.yarn.service.api.records.Component; import org.apache.hadoop.yarn.service.api.records.Container; import org.apache.hadoop.yarn.service.api.records.ContainerState; import org.apache.hadoop.yarn.service.client.ServiceClient; -import org.apache.hadoop.yarn.service.exceptions.SliderException; +import org.apache.hadoop.yarn.service.utils.ServiceApiUtil; import org.apache.hadoop.yarn.service.utils.SliderFileSystem; import org.hamcrest.CoreMatchers; import org.junit.After; @@ -86,7 +86,7 @@ public class TestYarnNativeServices extends ServiceTestUtils { @Test (timeout = 20) public void testCreateFlexStopDestroyService() throws Exception { setupInternal(NUM_NMS); -ServiceClient client = createClient(); +ServiceClient client = createClient(getConf()); Service exampleApp = createExampleApplication(); client.actionCreate(exampleApp); SliderFileSystem fileSystem = new SliderFileSystem(getConf()); @@ -141,7 +141,7 @@ public class TestYarnNativeServices extends ServiceTestUtils { @Test (timeout = 20) public void testComponentStartOrder() throws Exception { setupInternal(NUM_NMS); -ServiceClient client = createClient(); +ServiceClient client = createClient(getConf()); Service exampleApp = new Service(); exampleApp.setName("teststartorder"); exampleApp.setVersion("v1"); @@ -169,7 +169,7 @@ public class TestYarnNativeServices extends ServiceTestUtils { String userB = "userb"; setupInternal(NUM_NMS); -ServiceClient client = createClient(); +ServiceClient client = createClient(getConf()); String origBasePath = getConf().get(YARN_SERVICE_BASE_PATH); Service userAApp = new Service(); @@ -221,7 +221,7 @@ public class TestYarnNativeServices extends ServiceTestUtils { System.setProperty("user.name", user); setupInternal(NUM_NMS); -ServiceClient client = createClient(); +ServiceClient client = createClient(getConf()); Service appA = new Service(); appA.setName(sameAppName); @@ -290,7 +290,7 @@ public class TestYarnNativeServices extends ServiceTestUtils { setConf(conf); setupInternal(NUM_NMS); -ServiceClient client = createClient(); +ServiceClient client = createClient(getConf()); Service exampleApp = createExampleApplication(); client.actionCreate(exampleApp); MultimapcontainersBeforeFailure = @@ -333,6 +333,28 @@ public class TestYarnNativeServices extends ServiceTestUtils { client.actionDestroy(exampleApp.getName()); } + @Test(timeout = 20) + public void testUpgradeService() throws Exception { +setupInternal(NUM_NMS); +ServiceClient client = createClient(getConf()); + +Service service = createExampleApplication(); +client.actionCreate(service); +waitForServiceToBeStarted(client, service); + +//upgrade the service +service.setVersion("v2"); +client.actionUpgrade(service); + +//wait for service to be in upgrade state +waitForServiceToBeInState(client, service, ServiceState.UPGRADING); +SliderFileSystem fs = new SliderFileSystem(getConf()); +Service fromFs = ServiceApiUtil.loadServiceUpgrade(fs, +service.getName(), service.getVersion()); +Assert.assertEquals(service.getName(), fromFs.getName()); +Assert.assertEquals(service.getVersion(), fromFs.getVersion()); + } + // Check containers launched are in dependency order // Get all containers into a list and sort based on container launch time e.g. // compa-c1, compa-c2, compb-c1, compb-c2; @@ -470,16 +492,7 @@ public class TestYarnNativeServices extends ServiceTestUtils { */ private void waitForServiceToBeStable(ServiceClient client, Service exampleApp) throws TimeoutException, InterruptedException { -