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.format();
} else {
System.out.println("Scheduler Configuration format only " +
"supported by MutableConfScheduler.");
System.out.println(String.format("Scheduler Configuration format only " +
"supported by %s.", MutableConfScheduler.class.getSimpleName()));
}
}

View File

@ -2678,7 +2678,7 @@ public Response formatSchedulerConfiguration(@Context HttpServletRequest hsr)
} else {
return Response.status(Status.BAD_REQUEST)
.entity("Scheduler Configuration format only supported by " +
"MutableConfScheduler.").build();
MutableConfScheduler.class.getSimpleName()).build();
}
}
@ -2727,8 +2727,8 @@ public synchronized Response validateAndGetSchedulerConfiguration(
.build();
}
} else {
String errorMsg = "Configuration change validation only supported by " +
"MutableConfScheduler.";
String errorMsg = String.format("Configuration change validation only supported by %s.",
MutableConfScheduler.class.getSimpleName());
LOG.warn(errorMsg);
return Response.status(Status.BAD_REQUEST)
.entity(errorMsg)
@ -2823,10 +2823,11 @@ public Response getSchedulerConfiguration(@Context HttpServletRequest hsr)
.build();
} else {
return Response.status(Status.BAD_REQUEST).entity(
"This API only supports to retrieve scheduler configuration"
+ " from a mutable-conf scheduler, underneath scheduler "
+ scheduler.getClass().getSimpleName()
+ " is not an instance of MutableConfScheduler")
String.format("This API only supports to retrieve scheduler configuration"
+ " from a mutable-conf scheduler, underneath scheduler %s"
+ " is not an instance of %s",
scheduler.getClass().getSimpleName(),
MutableConfScheduler.class.getSimpleName()))
.build();
}
}
@ -2858,8 +2859,8 @@ public Response getSchedulerConfigurationVersion(@Context
}
} else {
return Response.status(Status.BAD_REQUEST)
.entity("Configuration Version only supported by "
+ "MutableConfScheduler.").build();
.entity(String.format("Configuration Version only supported by %s.",
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.rmapp.RMApp;
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.ResourceScheduler;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler;
@ -1003,8 +1004,8 @@ public void testValidateAndGetSchedulerConfigurationInvalidScheduler()
Assert.assertEquals(Status.BAD_REQUEST
.getStatusCode(), response.getStatus());
Assert.assertTrue(response.getEntity().toString()
.contains("Configuration change validation only supported by"
+" MutableConfScheduler."));
.contains(String.format("Configuration change validation only supported by %s.",
MutableConfScheduler.class.getSimpleName())));
}
@Test