|
@@ -36,7 +36,7 @@ import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler
|
|
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler;
|
|
|
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacitySchedulerConfiguration;
|
|
|
import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.QueueConfigInfo;
|
|
|
-import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.QueueConfigsUpdateInfo;
|
|
|
+import org.apache.hadoop.yarn.server.resourcemanager.webapp.dao.SchedConfUpdateInfo;
|
|
|
import org.apache.hadoop.yarn.webapp.GenericExceptionHandler;
|
|
|
import org.apache.hadoop.yarn.webapp.GuiceServletConfig;
|
|
|
import org.apache.hadoop.yarn.webapp.JerseyTestBase;
|
|
@@ -162,7 +162,7 @@ public class TestRMWebServicesConfigurationMutation extends JerseyTestBase {
|
|
|
ClientResponse response;
|
|
|
|
|
|
// Add parent queue root.d with two children d1 and d2.
|
|
|
- QueueConfigsUpdateInfo updateInfo = new QueueConfigsUpdateInfo();
|
|
|
+ SchedConfUpdateInfo updateInfo = new SchedConfUpdateInfo();
|
|
|
Map<String, String> d1Capacity = new HashMap<>();
|
|
|
d1Capacity.put(CapacitySchedulerConfiguration.CAPACITY, "25");
|
|
|
d1Capacity.put(CapacitySchedulerConfiguration.MAXIMUM_CAPACITY, "25");
|
|
@@ -181,9 +181,9 @@ public class TestRMWebServicesConfigurationMutation extends JerseyTestBase {
|
|
|
updateInfo.getAddQueueInfo().add(d);
|
|
|
response =
|
|
|
r.path("ws").path("v1").path("cluster")
|
|
|
- .path("queues").queryParam("user.name", userName)
|
|
|
+ .path("sched-conf").queryParam("user.name", userName)
|
|
|
.accept(MediaType.APPLICATION_JSON)
|
|
|
- .entity(toJson(updateInfo, QueueConfigsUpdateInfo.class),
|
|
|
+ .entity(toJson(updateInfo, SchedConfUpdateInfo.class),
|
|
|
MediaType.APPLICATION_JSON)
|
|
|
.put(ClientResponse.class);
|
|
|
|
|
@@ -205,7 +205,7 @@ public class TestRMWebServicesConfigurationMutation extends JerseyTestBase {
|
|
|
ClientResponse response;
|
|
|
|
|
|
// Add root.d with capacity 25, reducing root.b capacity from 75 to 50.
|
|
|
- QueueConfigsUpdateInfo updateInfo = new QueueConfigsUpdateInfo();
|
|
|
+ SchedConfUpdateInfo updateInfo = new SchedConfUpdateInfo();
|
|
|
Map<String, String> dCapacity = new HashMap<>();
|
|
|
dCapacity.put(CapacitySchedulerConfiguration.CAPACITY, "25");
|
|
|
Map<String, String> bCapacity = new HashMap<>();
|
|
@@ -216,9 +216,9 @@ public class TestRMWebServicesConfigurationMutation extends JerseyTestBase {
|
|
|
updateInfo.getUpdateQueueInfo().add(b);
|
|
|
response =
|
|
|
r.path("ws").path("v1").path("cluster")
|
|
|
- .path("queues").queryParam("user.name", userName)
|
|
|
+ .path("sched-conf").queryParam("user.name", userName)
|
|
|
.accept(MediaType.APPLICATION_JSON)
|
|
|
- .entity(toJson(updateInfo, QueueConfigsUpdateInfo.class),
|
|
|
+ .entity(toJson(updateInfo, SchedConfUpdateInfo.class),
|
|
|
MediaType.APPLICATION_JSON)
|
|
|
.put(ClientResponse.class);
|
|
|
|
|
@@ -238,13 +238,13 @@ public class TestRMWebServicesConfigurationMutation extends JerseyTestBase {
|
|
|
|
|
|
stopQueue("root.a.a2");
|
|
|
// Remove root.a.a2
|
|
|
- QueueConfigsUpdateInfo updateInfo = new QueueConfigsUpdateInfo();
|
|
|
+ SchedConfUpdateInfo updateInfo = new SchedConfUpdateInfo();
|
|
|
updateInfo.getRemoveQueueInfo().add("root.a.a2");
|
|
|
response =
|
|
|
r.path("ws").path("v1").path("cluster")
|
|
|
- .path("queues").queryParam("user.name", userName)
|
|
|
+ .path("sched-conf").queryParam("user.name", userName)
|
|
|
.accept(MediaType.APPLICATION_JSON)
|
|
|
- .entity(toJson(updateInfo, QueueConfigsUpdateInfo.class),
|
|
|
+ .entity(toJson(updateInfo, SchedConfUpdateInfo.class),
|
|
|
MediaType.APPLICATION_JSON)
|
|
|
.put(ClientResponse.class);
|
|
|
|
|
@@ -263,13 +263,13 @@ public class TestRMWebServicesConfigurationMutation extends JerseyTestBase {
|
|
|
|
|
|
stopQueue("root.c", "root.c.c1");
|
|
|
// Remove root.c (parent queue)
|
|
|
- QueueConfigsUpdateInfo updateInfo = new QueueConfigsUpdateInfo();
|
|
|
+ SchedConfUpdateInfo updateInfo = new SchedConfUpdateInfo();
|
|
|
updateInfo.getRemoveQueueInfo().add("root.c");
|
|
|
response =
|
|
|
r.path("ws").path("v1").path("cluster")
|
|
|
- .path("queues").queryParam("user.name", userName)
|
|
|
+ .path("sched-conf").queryParam("user.name", userName)
|
|
|
.accept(MediaType.APPLICATION_JSON)
|
|
|
- .entity(toJson(updateInfo, QueueConfigsUpdateInfo.class),
|
|
|
+ .entity(toJson(updateInfo, SchedConfUpdateInfo.class),
|
|
|
MediaType.APPLICATION_JSON)
|
|
|
.put(ClientResponse.class);
|
|
|
|
|
@@ -288,7 +288,7 @@ public class TestRMWebServicesConfigurationMutation extends JerseyTestBase {
|
|
|
|
|
|
stopQueue("root.a", "root.a.a1", "root.a.a2");
|
|
|
// Remove root.a (parent queue) with capacity 25
|
|
|
- QueueConfigsUpdateInfo updateInfo = new QueueConfigsUpdateInfo();
|
|
|
+ SchedConfUpdateInfo updateInfo = new SchedConfUpdateInfo();
|
|
|
updateInfo.getRemoveQueueInfo().add("root.a");
|
|
|
|
|
|
// Set root.b capacity to 100
|
|
@@ -298,9 +298,9 @@ public class TestRMWebServicesConfigurationMutation extends JerseyTestBase {
|
|
|
updateInfo.getUpdateQueueInfo().add(b);
|
|
|
response =
|
|
|
r.path("ws").path("v1").path("cluster")
|
|
|
- .path("queues").queryParam("user.name", userName)
|
|
|
+ .path("sched-conf").queryParam("user.name", userName)
|
|
|
.accept(MediaType.APPLICATION_JSON)
|
|
|
- .entity(toJson(updateInfo, QueueConfigsUpdateInfo.class),
|
|
|
+ .entity(toJson(updateInfo, SchedConfUpdateInfo.class),
|
|
|
MediaType.APPLICATION_JSON)
|
|
|
.put(ClientResponse.class);
|
|
|
|
|
@@ -320,7 +320,7 @@ public class TestRMWebServicesConfigurationMutation extends JerseyTestBase {
|
|
|
|
|
|
stopQueue("root.b", "root.c", "root.c.c1");
|
|
|
// Remove root.b and root.c
|
|
|
- QueueConfigsUpdateInfo updateInfo = new QueueConfigsUpdateInfo();
|
|
|
+ SchedConfUpdateInfo updateInfo = new SchedConfUpdateInfo();
|
|
|
updateInfo.getRemoveQueueInfo().add("root.b");
|
|
|
updateInfo.getRemoveQueueInfo().add("root.c");
|
|
|
Map<String, String> aCapacity = new HashMap<>();
|
|
@@ -330,9 +330,9 @@ public class TestRMWebServicesConfigurationMutation extends JerseyTestBase {
|
|
|
updateInfo.getUpdateQueueInfo().add(configInfo);
|
|
|
response =
|
|
|
r.path("ws").path("v1").path("cluster")
|
|
|
- .path("queues").queryParam("user.name", userName)
|
|
|
+ .path("sched-conf").queryParam("user.name", userName)
|
|
|
.accept(MediaType.APPLICATION_JSON)
|
|
|
- .entity(toJson(updateInfo, QueueConfigsUpdateInfo.class),
|
|
|
+ .entity(toJson(updateInfo, SchedConfUpdateInfo.class),
|
|
|
MediaType.APPLICATION_JSON)
|
|
|
.put(ClientResponse.class);
|
|
|
|
|
@@ -348,7 +348,7 @@ public class TestRMWebServicesConfigurationMutation extends JerseyTestBase {
|
|
|
ClientResponse response;
|
|
|
|
|
|
// Set state of queues to STOPPED.
|
|
|
- QueueConfigsUpdateInfo updateInfo = new QueueConfigsUpdateInfo();
|
|
|
+ SchedConfUpdateInfo updateInfo = new SchedConfUpdateInfo();
|
|
|
Map<String, String> stoppedParam = new HashMap<>();
|
|
|
stoppedParam.put(CapacitySchedulerConfiguration.STATE,
|
|
|
QueueState.STOPPED.toString());
|
|
@@ -358,9 +358,9 @@ public class TestRMWebServicesConfigurationMutation extends JerseyTestBase {
|
|
|
}
|
|
|
response =
|
|
|
r.path("ws").path("v1").path("cluster")
|
|
|
- .path("queues").queryParam("user.name", userName)
|
|
|
+ .path("sched-conf").queryParam("user.name", userName)
|
|
|
.accept(MediaType.APPLICATION_JSON)
|
|
|
- .entity(toJson(updateInfo, QueueConfigsUpdateInfo.class),
|
|
|
+ .entity(toJson(updateInfo, SchedConfUpdateInfo.class),
|
|
|
MediaType.APPLICATION_JSON)
|
|
|
.put(ClientResponse.class);
|
|
|
assertEquals(Status.OK.getStatusCode(), response.getStatus());
|
|
@@ -378,7 +378,7 @@ public class TestRMWebServicesConfigurationMutation extends JerseyTestBase {
|
|
|
ClientResponse response;
|
|
|
|
|
|
// Update config value.
|
|
|
- QueueConfigsUpdateInfo updateInfo = new QueueConfigsUpdateInfo();
|
|
|
+ SchedConfUpdateInfo updateInfo = new SchedConfUpdateInfo();
|
|
|
Map<String, String> updateParam = new HashMap<>();
|
|
|
updateParam.put(CapacitySchedulerConfiguration.MAXIMUM_AM_RESOURCE_SUFFIX,
|
|
|
"0.2");
|
|
@@ -393,9 +393,9 @@ public class TestRMWebServicesConfigurationMutation extends JerseyTestBase {
|
|
|
0.001f);
|
|
|
response =
|
|
|
r.path("ws").path("v1").path("cluster")
|
|
|
- .path("queues").queryParam("user.name", userName)
|
|
|
+ .path("sched-conf").queryParam("user.name", userName)
|
|
|
.accept(MediaType.APPLICATION_JSON)
|
|
|
- .entity(toJson(updateInfo, QueueConfigsUpdateInfo.class),
|
|
|
+ .entity(toJson(updateInfo, SchedConfUpdateInfo.class),
|
|
|
MediaType.APPLICATION_JSON)
|
|
|
.put(ClientResponse.class);
|
|
|
assertEquals(Status.OK.getStatusCode(), response.getStatus());
|
|
@@ -411,9 +411,9 @@ public class TestRMWebServicesConfigurationMutation extends JerseyTestBase {
|
|
|
updateInfo.getUpdateQueueInfo().add(aUpdateInfo);
|
|
|
response =
|
|
|
r.path("ws").path("v1").path("cluster")
|
|
|
- .path("queues").queryParam("user.name", userName)
|
|
|
+ .path("sched-conf").queryParam("user.name", userName)
|
|
|
.accept(MediaType.APPLICATION_JSON)
|
|
|
- .entity(toJson(updateInfo, QueueConfigsUpdateInfo.class),
|
|
|
+ .entity(toJson(updateInfo, SchedConfUpdateInfo.class),
|
|
|
MediaType.APPLICATION_JSON)
|
|
|
.put(ClientResponse.class);
|
|
|
assertEquals(Status.OK.getStatusCode(), response.getStatus());
|
|
@@ -431,7 +431,7 @@ public class TestRMWebServicesConfigurationMutation extends JerseyTestBase {
|
|
|
ClientResponse response;
|
|
|
|
|
|
// Update root.a and root.b capacity to 50.
|
|
|
- QueueConfigsUpdateInfo updateInfo = new QueueConfigsUpdateInfo();
|
|
|
+ SchedConfUpdateInfo updateInfo = new SchedConfUpdateInfo();
|
|
|
Map<String, String> updateParam = new HashMap<>();
|
|
|
updateParam.put(CapacitySchedulerConfiguration.CAPACITY, "50");
|
|
|
QueueConfigInfo aUpdateInfo = new QueueConfigInfo("root.a", updateParam);
|
|
@@ -441,9 +441,9 @@ public class TestRMWebServicesConfigurationMutation extends JerseyTestBase {
|
|
|
|
|
|
response =
|
|
|
r.path("ws").path("v1").path("cluster")
|
|
|
- .path("queues").queryParam("user.name", userName)
|
|
|
+ .path("sched-conf").queryParam("user.name", userName)
|
|
|
.accept(MediaType.APPLICATION_JSON)
|
|
|
- .entity(toJson(updateInfo, QueueConfigsUpdateInfo.class),
|
|
|
+ .entity(toJson(updateInfo, SchedConfUpdateInfo.class),
|
|
|
MediaType.APPLICATION_JSON)
|
|
|
.put(ClientResponse.class);
|
|
|
assertEquals(Status.OK.getStatusCode(), response.getStatus());
|
|
@@ -453,6 +453,47 @@ public class TestRMWebServicesConfigurationMutation extends JerseyTestBase {
|
|
|
assertEquals(50.0f, newCSConf.getNonLabeledQueueCapacity("root.b"), 0.01f);
|
|
|
}
|
|
|
|
|
|
+ @Test
|
|
|
+ public void testGlobalConfChange() throws Exception {
|
|
|
+ WebResource r = resource();
|
|
|
+
|
|
|
+ ClientResponse response;
|
|
|
+
|
|
|
+ // Set maximum-applications to 30000.
|
|
|
+ SchedConfUpdateInfo updateInfo = new SchedConfUpdateInfo();
|
|
|
+ updateInfo.getGlobalParams().put(CapacitySchedulerConfiguration.PREFIX +
|
|
|
+ "maximum-applications", "30000");
|
|
|
+
|
|
|
+ response =
|
|
|
+ r.path("ws").path("v1").path("cluster")
|
|
|
+ .path("sched-conf").queryParam("user.name", userName)
|
|
|
+ .accept(MediaType.APPLICATION_JSON)
|
|
|
+ .entity(toJson(updateInfo, SchedConfUpdateInfo.class),
|
|
|
+ MediaType.APPLICATION_JSON)
|
|
|
+ .put(ClientResponse.class);
|
|
|
+ assertEquals(Status.OK.getStatusCode(), response.getStatus());
|
|
|
+ CapacitySchedulerConfiguration newCSConf =
|
|
|
+ ((CapacityScheduler) rm.getResourceScheduler()).getConfiguration();
|
|
|
+ assertEquals(30000, newCSConf.getMaximumSystemApplications());
|
|
|
+
|
|
|
+ updateInfo.getGlobalParams().put(CapacitySchedulerConfiguration.PREFIX +
|
|
|
+ "maximum-applications", null);
|
|
|
+ // Unset maximum-applications. Should be set to default.
|
|
|
+ response =
|
|
|
+ r.path("ws").path("v1").path("cluster")
|
|
|
+ .path("sched-conf").queryParam("user.name", userName)
|
|
|
+ .accept(MediaType.APPLICATION_JSON)
|
|
|
+ .entity(toJson(updateInfo, SchedConfUpdateInfo.class),
|
|
|
+ MediaType.APPLICATION_JSON)
|
|
|
+ .put(ClientResponse.class);
|
|
|
+ assertEquals(Status.OK.getStatusCode(), response.getStatus());
|
|
|
+ newCSConf =
|
|
|
+ ((CapacityScheduler) rm.getResourceScheduler()).getConfiguration();
|
|
|
+ assertEquals(CapacitySchedulerConfiguration
|
|
|
+ .DEFAULT_MAXIMUM_SYSTEM_APPLICATIIONS,
|
|
|
+ newCSConf.getMaximumSystemApplications());
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
@After
|
|
|
public void tearDown() throws Exception {
|