use of org.apache.hadoop.yarn.server.resourcemanager.reservation.planning.ReservationAgent in project hadoop by apache.
the class AbstractReservationSystem method getAgent.
protected ReservationAgent getAgent(String queueName) {
ReservationSchedulerConfiguration reservationConfig = getReservationSchedulerConfiguration();
String agentClassName = reservationConfig.getReservationAgent(queueName);
LOG.info("Using Agent: " + agentClassName + " for queue: " + queueName);
try {
Class<?> agentClazz = conf.getClassByName(agentClassName);
if (ReservationAgent.class.isAssignableFrom(agentClazz)) {
ReservationAgent resevertionAgent = (ReservationAgent) agentClazz.newInstance();
resevertionAgent.init(conf);
return resevertionAgent;
} else {
throw new YarnRuntimeException("Class: " + agentClassName + " not instance of " + ReservationAgent.class.getCanonicalName());
}
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) {
throw new YarnRuntimeException("Could not instantiate Agent: " + agentClassName + " for queue: " + queueName, e);
}
}
Aggregations