Search in sources :

Example 21 with ReservationAllocation

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

the class TestReservationSystemWithRMHA method validateReservation.

private void validateReservation(Plan plan, ReservationId resId, ReservationDefinition rDef) {
    ReservationAllocation reservation = plan.getReservationById(resId);
    Assert.assertNotNull(reservation);
    Assert.assertEquals(rDef.getDeadline(), reservation.getReservationDefinition().getDeadline());
}
Also used : ReservationAllocation(org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationAllocation)

Example 22 with ReservationAllocation

use of org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationAllocation 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

ReservationAllocation (org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationAllocation)22 ReservationId (org.apache.hadoop.yarn.api.records.ReservationId)17 ReservationDefinition (org.apache.hadoop.yarn.api.records.ReservationDefinition)16 InMemoryReservationAllocation (org.apache.hadoop.yarn.server.resourcemanager.reservation.InMemoryReservationAllocation)16 Test (org.junit.Test)14 ReservationRequest (org.apache.hadoop.yarn.api.records.ReservationRequest)7 ReservationRequests (org.apache.hadoop.yarn.api.records.ReservationRequests)7 ReservationDefinitionPBImpl (org.apache.hadoop.yarn.api.records.impl.pb.ReservationDefinitionPBImpl)7 ReservationRequestsPBImpl (org.apache.hadoop.yarn.api.records.impl.pb.ReservationRequestsPBImpl)7 ArrayList (java.util.ArrayList)5 Resource (org.apache.hadoop.yarn.api.records.Resource)4 Plan (org.apache.hadoop.yarn.server.resourcemanager.reservation.Plan)3 PlanningException (org.apache.hadoop.yarn.server.resourcemanager.reservation.exceptions.PlanningException)3 ResourceCalculator (org.apache.hadoop.yarn.util.resource.ResourceCalculator)3 RMContext (org.apache.hadoop.yarn.server.resourcemanager.RMContext)2 RLESparseResourceAllocation (org.apache.hadoop.yarn.server.resourcemanager.reservation.RLESparseResourceAllocation)2 ReservationInterval (org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationInterval)2 ReservationSchedulerConfiguration (org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSchedulerConfiguration)2 DefaultResourceCalculator (org.apache.hadoop.yarn.util.resource.DefaultResourceCalculator)2 IOException (java.io.IOException)1