Search in sources :

Example 1 with ReservationAgent

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);
    }
}
Also used : YarnRuntimeException(org.apache.hadoop.yarn.exceptions.YarnRuntimeException) ReservationAgent(org.apache.hadoop.yarn.server.resourcemanager.reservation.planning.ReservationAgent)

Aggregations

YarnRuntimeException (org.apache.hadoop.yarn.exceptions.YarnRuntimeException)1 ReservationAgent (org.apache.hadoop.yarn.server.resourcemanager.reservation.planning.ReservationAgent)1