YARN-11049. MutableConfScheduler is referred as plain String instead of class name. Contributed by Szilard Nemeth

This commit is contained in:
9uapaw 2022-03-07 09:00:22 +01:00
parent 8f07081789
commit 851a4dc2d9
3 changed files with 15 additions and 13 deletions

View File

@ -1864,8 +1864,8 @@ static void deleteRMConfStore(Configuration conf) throws Exception {
confStore.initialize(conf, conf, rmContext); confStore.initialize(conf, conf, rmContext);
confStore.format(); confStore.format();
} else { } else {
System.out.println("Scheduler Configuration format only " + System.out.println(String.format("Scheduler Configuration format only " +
"supported by MutableConfScheduler."); "supported by %s.", MutableConfScheduler.class.getSimpleName()));
} }
} }

View File

@ -2678,7 +2678,7 @@ public Response formatSchedulerConfiguration(@Context HttpServletRequest hsr)
} else { } else {
return Response.status(Status.BAD_REQUEST) return Response.status(Status.BAD_REQUEST)
.entity("Scheduler Configuration format only supported by " + .entity("Scheduler Configuration format only supported by " +
"MutableConfScheduler.").build(); MutableConfScheduler.class.getSimpleName()).build();
} }
} }
@ -2727,8 +2727,8 @@ public synchronized Response validateAndGetSchedulerConfiguration(
.build(); .build();
} }
} else { } else {
String errorMsg = "Configuration change validation only supported by " + String errorMsg = String.format("Configuration change validation only supported by %s.",
"MutableConfScheduler."; MutableConfScheduler.class.getSimpleName());
LOG.warn(errorMsg); LOG.warn(errorMsg);
return Response.status(Status.BAD_REQUEST) return Response.status(Status.BAD_REQUEST)
.entity(errorMsg) .entity(errorMsg)
@ -2823,10 +2823,11 @@ public Response getSchedulerConfiguration(@Context HttpServletRequest hsr)
.build(); .build();
} else { } else {
return Response.status(Status.BAD_REQUEST).entity( return Response.status(Status.BAD_REQUEST).entity(
"This API only supports to retrieve scheduler configuration" String.format("This API only supports to retrieve scheduler configuration"
+ " from a mutable-conf scheduler, underneath scheduler " + " from a mutable-conf scheduler, underneath scheduler %s"
+ scheduler.getClass().getSimpleName() + " is not an instance of %s",
+ " is not an instance of MutableConfScheduler") scheduler.getClass().getSimpleName(),
MutableConfScheduler.class.getSimpleName()))
.build(); .build();
} }
} }
@ -2858,8 +2859,8 @@ public Response getSchedulerConfigurationVersion(@Context
} }
} else { } else {
return Response.status(Status.BAD_REQUEST) return Response.status(Status.BAD_REQUEST)
.entity("Configuration Version only supported by " .entity(String.format("Configuration Version only supported by %s.",
+ "MutableConfScheduler.").build(); MutableConfScheduler.class.getSimpleName())).build();
} }
} }

View File

@ -75,6 +75,7 @@
import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager; import org.apache.hadoop.yarn.server.resourcemanager.nodelabels.RMNodeLabelsManager;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMApp;
import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppMetrics; import org.apache.hadoop.yarn.server.resourcemanager.rmapp.RMAppMetrics;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.MutableConfScheduler;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.QueueMetrics; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.QueueMetrics;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler; 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.CapacityScheduler;
@ -1003,8 +1004,8 @@ public void testValidateAndGetSchedulerConfigurationInvalidScheduler()
Assert.assertEquals(Status.BAD_REQUEST Assert.assertEquals(Status.BAD_REQUEST
.getStatusCode(), response.getStatus()); .getStatusCode(), response.getStatus());
Assert.assertTrue(response.getEntity().toString() Assert.assertTrue(response.getEntity().toString()
.contains("Configuration change validation only supported by" .contains(String.format("Configuration change validation only supported by %s.",
+" MutableConfScheduler.")); MutableConfScheduler.class.getSimpleName())));
} }
@Test @Test