Search in sources :

Example 1 with CapacityOverTimePolicy

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

the class TestGreedyReservationAgent method setup.

@Before
public void setup() throws Exception {
    long seed = rand.nextLong();
    rand.setSeed(seed);
    Log.getLog().info("Running with seed: " + seed);
    // setting completely loose quotas
    long timeWindow = 1000000L;
    Resource clusterCapacity = Resource.newInstance(100 * 1024, 100);
    step = 1000L;
    String reservationQ = ReservationSystemTestUtil.getFullReservationQueueName();
    float instConstraint = 100;
    float avgConstraint = 100;
    ReservationSchedulerConfiguration conf = ReservationSystemTestUtil.createConf(reservationQ, timeWindow, instConstraint, avgConstraint);
    CapacityOverTimePolicy policy = new CapacityOverTimePolicy();
    policy.init(reservationQ, conf);
    // setting conf to
    conf.setBoolean(GreedyReservationAgent.GREEDY_FAVOR_EARLY_ALLOCATION, allocateLeft);
    agent = new GreedyReservationAgent();
    agent.init(conf);
    QueueMetrics queueMetrics = mock(QueueMetrics.class);
    RMContext context = ReservationSystemTestUtil.createMockRMContext();
    plan = new InMemoryPlan(queueMetrics, policy, agent, clusterCapacity, step, res, minAlloc, maxAlloc, "dedicated", null, true, context);
}
Also used : InMemoryPlan(org.apache.hadoop.yarn.server.resourcemanager.reservation.InMemoryPlan) CapacityOverTimePolicy(org.apache.hadoop.yarn.server.resourcemanager.reservation.CapacityOverTimePolicy) QueueMetrics(org.apache.hadoop.yarn.server.resourcemanager.scheduler.QueueMetrics) RMContext(org.apache.hadoop.yarn.server.resourcemanager.RMContext) Resource(org.apache.hadoop.yarn.api.records.Resource) ReservationSchedulerConfiguration(org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSchedulerConfiguration) Before(org.junit.Before)

Example 2 with CapacityOverTimePolicy

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

the class TestGreedyReservationAgent method testStress.

public void testStress(int numJobs) throws PlanningException, IOException {
    long timeWindow = 1000000L;
    Resource clusterCapacity = Resource.newInstance(500 * 100 * 1024, 500 * 32);
    step = 1000L;
    ReservationSystemTestUtil testUtil = new ReservationSystemTestUtil();
    CapacityScheduler scheduler = testUtil.mockCapacityScheduler(500 * 100);
    String reservationQ = ReservationSystemTestUtil.getFullReservationQueueName();
    float instConstraint = 100;
    float avgConstraint = 100;
    ReservationSchedulerConfiguration conf = ReservationSystemTestUtil.createConf(reservationQ, timeWindow, instConstraint, avgConstraint);
    CapacityOverTimePolicy policy = new CapacityOverTimePolicy();
    policy.init(reservationQ, conf);
    RMContext context = ReservationSystemTestUtil.createMockRMContext();
    plan = new InMemoryPlan(scheduler.getRootQueueMetrics(), policy, agent, clusterCapacity, step, res, minAlloc, maxAlloc, "dedicated", null, true, context);
    int acc = 0;
    List<ReservationDefinition> list = new ArrayList<ReservationDefinition>();
    for (long i = 0; i < numJobs; i++) {
        list.add(ReservationSystemTestUtil.generateRandomRR(rand, i));
    }
    long start = System.currentTimeMillis();
    for (int i = 0; i < numJobs; i++) {
        try {
            if (agent.createReservation(ReservationSystemTestUtil.getNewReservationId(), "u" + i % 100, plan, list.get(i))) {
                acc++;
            }
        } catch (PlanningException p) {
        // ignore exceptions
        }
    }
    long end = System.currentTimeMillis();
    System.out.println("Submitted " + numJobs + " jobs " + " accepted " + acc + " in " + (end - start) + "ms");
}
Also used : InMemoryPlan(org.apache.hadoop.yarn.server.resourcemanager.reservation.InMemoryPlan) CapacityOverTimePolicy(org.apache.hadoop.yarn.server.resourcemanager.reservation.CapacityOverTimePolicy) RMContext(org.apache.hadoop.yarn.server.resourcemanager.RMContext) ReservationDefinition(org.apache.hadoop.yarn.api.records.ReservationDefinition) Resource(org.apache.hadoop.yarn.api.records.Resource) ArrayList(java.util.ArrayList) ReservationSchedulerConfiguration(org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSchedulerConfiguration) PlanningException(org.apache.hadoop.yarn.server.resourcemanager.reservation.exceptions.PlanningException) ReservationSystemTestUtil(org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil) CapacityScheduler(org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler)

Example 3 with CapacityOverTimePolicy

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

the class TestAlignedPlanner method setup.

@Before
public void setup() throws Exception {
    // Initialize random seed
    long seed = rand.nextLong();
    rand.setSeed(seed);
    Log.getLog().info("Running with seed: " + seed);
    // Set cluster parameters
    long timeWindow = 1000000L;
    int capacityMem = 100 * 1024;
    int capacityCores = 100;
    step = 60000L;
    Resource clusterCapacity = Resource.newInstance(capacityMem, capacityCores);
    String reservationQ = ReservationSystemTestUtil.getFullReservationQueueName();
    float instConstraint = 100;
    float avgConstraint = 100;
    ReservationSchedulerConfiguration conf = ReservationSystemTestUtil.createConf(reservationQ, timeWindow, instConstraint, avgConstraint);
    CapacityOverTimePolicy policy = new CapacityOverTimePolicy();
    policy.init(reservationQ, conf);
    QueueMetrics queueMetrics = mock(QueueMetrics.class);
    RMContext context = ReservationSystemTestUtil.createMockRMContext();
    conf.setInt(AlignedPlannerWithGreedy.SMOOTHNESS_FACTOR, AlignedPlannerWithGreedy.DEFAULT_SMOOTHNESS_FACTOR);
    // Set planning agent
    agent = new AlignedPlannerWithGreedy();
    agent.init(conf);
    // Create Plan
    plan = new InMemoryPlan(queueMetrics, policy, agent, clusterCapacity, step, res, minAlloc, maxAlloc, "dedicated", null, true, context);
}
Also used : AlignedPlannerWithGreedy(org.apache.hadoop.yarn.server.resourcemanager.reservation.planning.AlignedPlannerWithGreedy) InMemoryPlan(org.apache.hadoop.yarn.server.resourcemanager.reservation.InMemoryPlan) CapacityOverTimePolicy(org.apache.hadoop.yarn.server.resourcemanager.reservation.CapacityOverTimePolicy) QueueMetrics(org.apache.hadoop.yarn.server.resourcemanager.scheduler.QueueMetrics) RMContext(org.apache.hadoop.yarn.server.resourcemanager.RMContext) Resource(org.apache.hadoop.yarn.api.records.Resource) ReservationSchedulerConfiguration(org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSchedulerConfiguration) Before(org.junit.Before)

Aggregations

Resource (org.apache.hadoop.yarn.api.records.Resource)3 RMContext (org.apache.hadoop.yarn.server.resourcemanager.RMContext)3 CapacityOverTimePolicy (org.apache.hadoop.yarn.server.resourcemanager.reservation.CapacityOverTimePolicy)3 InMemoryPlan (org.apache.hadoop.yarn.server.resourcemanager.reservation.InMemoryPlan)3 ReservationSchedulerConfiguration (org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSchedulerConfiguration)3 QueueMetrics (org.apache.hadoop.yarn.server.resourcemanager.scheduler.QueueMetrics)2 Before (org.junit.Before)2 ArrayList (java.util.ArrayList)1 ReservationDefinition (org.apache.hadoop.yarn.api.records.ReservationDefinition)1 ReservationSystemTestUtil (org.apache.hadoop.yarn.server.resourcemanager.reservation.ReservationSystemTestUtil)1 PlanningException (org.apache.hadoop.yarn.server.resourcemanager.reservation.exceptions.PlanningException)1 AlignedPlannerWithGreedy (org.apache.hadoop.yarn.server.resourcemanager.reservation.planning.AlignedPlannerWithGreedy)1 CapacityScheduler (org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler)1