Search in sources :

Example 6 with RLESparseResourceAllocation

use of org.apache.hadoop.yarn.server.resourcemanager.reservation.RLESparseResourceAllocation in project hadoop by apache.

the class IterativePlanner method initialize.

protected void initialize(Plan plan, ReservationId reservationId, ReservationDefinition reservation) throws PlanningException {
    // Get plan step & capacity
    capacity = plan.getTotalCapacity();
    step = plan.getStep();
    // Get job parameters (type, arrival time & deadline)
    jobType = reservation.getReservationRequests().getInterpreter();
    jobArrival = stepRoundUp(reservation.getArrival(), step);
    jobDeadline = stepRoundDown(reservation.getDeadline(), step);
    // Initialize the plan modifications
    planModifications = new RLESparseResourceAllocation(plan.getResourceCalculator());
    // well with huge reservation ranges
    if (this.algStageAllocator instanceof StageAllocatorLowCostAligned) {
        planLoads = getAllLoadsInInterval(plan, jobArrival, jobDeadline);
        ReservationAllocation oldRes = plan.getReservationById(reservationId);
        if (oldRes != null) {
            planModifications = RLESparseResourceAllocation.merge(plan.getResourceCalculator(), plan.getTotalCapacity(), planModifications, oldRes.getResourcesOverTime(), RLEOperator.subtract, jobArrival, jobDeadline);
        }
    }
}
Also used : RLESparseResourceAllocation(org.apache.hadoop.yarn.server.resourcemanager.reservation.RLESparseResourceAllocation) ReservationAllocation(org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationAllocation)

Aggregations

RLESparseResourceAllocation (org.apache.hadoop.yarn.server.resourcemanager.reservation.RLESparseResourceAllocation)6 Resource (org.apache.hadoop.yarn.api.records.Resource)5 ReservationInterval (org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationInterval)5 Map (java.util.Map)3 HashMap (java.util.HashMap)2 ReservationAllocation (org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationAllocation)2 PlanningException (org.apache.hadoop.yarn.server.resourcemanager.reservation.exceptions.PlanningException)2 Entry (java.util.Map.Entry)1 NavigableMap (java.util.NavigableMap)1 TreeSet (java.util.TreeSet)1 ReservationDefinition (org.apache.hadoop.yarn.api.records.ReservationDefinition)1 ReservationRequest (org.apache.hadoop.yarn.api.records.ReservationRequest)1 InMemoryReservationAllocation (org.apache.hadoop.yarn.server.resourcemanager.reservation.InMemoryReservationAllocation)1 ResourceCalculator (org.apache.hadoop.yarn.util.resource.ResourceCalculator)1