use of org.apache.hadoop.yarn.api.records.ReservationDefinition in project hadoop by apache.
the class TestCapacityOverTimePolicy method testInstFail.
@Test(expected = PlanningQuotaException.class)
public void testInstFail() throws IOException, PlanningException {
// generate allocation that exceed the instantaneous cap single-show
int[] f = generateData(3600, (int) Math.ceil(0.71 * totCont));
ReservationDefinition rDef = ReservationSystemTestUtil.createSimpleReservationDefinition(initTime, initTime + f.length + 1, f.length);
assertTrue(plan.toString(), plan.addReservation(new InMemoryReservationAllocation(ReservationSystemTestUtil.getNewReservationId(), rDef, "u1", "dedicated", initTime, initTime + f.length, ReservationSystemTestUtil.generateAllocation(initTime, step, f), res, minAlloc), false));
Assert.fail("should not have accepted this");
}
use of org.apache.hadoop.yarn.api.records.ReservationDefinition in project hadoop by apache.
the class TestCapacityOverTimePolicy method testMultiTenantFail.
@Test(expected = PlanningQuotaException.class)
public void testMultiTenantFail() throws IOException, PlanningException {
// generate allocation from multiple tenants that exceed tot capacity
int[] f = generateData(3600, (int) Math.ceil(0.25 * totCont));
ReservationDefinition rDef = ReservationSystemTestUtil.createSimpleReservationDefinition(initTime, initTime + f.length + 1, f.length);
for (int i = 0; i < 5; i++) {
assertTrue(plan.toString(), plan.addReservation(new InMemoryReservationAllocation(ReservationSystemTestUtil.getNewReservationId(), rDef, "u" + i, "dedicated", initTime, initTime + f.length, ReservationSystemTestUtil.generateAllocation(initTime, step, f), res, minAlloc), false));
}
}
use of org.apache.hadoop.yarn.api.records.ReservationDefinition in project hadoop by apache.
the class TestCapacityOverTimePolicy method testSimplePass2.
@Test
public void testSimplePass2() throws IOException, PlanningException {
// generate allocation from single tenant that exceed avg momentarily but
// fit within
// max instantanesou
int[] f = generateData(3600, (int) Math.ceil(0.69 * totCont));
ReservationDefinition rDef = ReservationSystemTestUtil.createSimpleReservationDefinition(initTime, initTime + f.length + 1, f.length);
assertTrue(plan.toString(), plan.addReservation(new InMemoryReservationAllocation(ReservationSystemTestUtil.getNewReservationId(), rDef, "u1", "dedicated", initTime, initTime + f.length, ReservationSystemTestUtil.generateAllocation(initTime, step, f), res, minAlloc), false));
}
use of org.apache.hadoop.yarn.api.records.ReservationDefinition in project hadoop by apache.
the class TestCapacityOverTimePolicy method testFailAvg.
@Test(expected = PlanningQuotaException.class)
public void testFailAvg() throws IOException, PlanningException {
// generate an allocation which violates the 25% average single-shot
Map<ReservationInterval, Resource> req = new TreeMap<ReservationInterval, Resource>();
long win = timeWindow / 2 + 100;
int cont = (int) Math.ceil(0.5 * totCont);
req.put(new ReservationInterval(initTime, initTime + win), ReservationSystemUtil.toResource(ReservationRequest.newInstance(Resource.newInstance(1024, 1), cont)));
ReservationDefinition rDef = ReservationSystemTestUtil.createSimpleReservationDefinition(initTime, initTime + win, win);
assertTrue(plan.toString(), plan.addReservation(new InMemoryReservationAllocation(ReservationSystemTestUtil.getNewReservationId(), rDef, "u1", "dedicated", initTime, initTime + win, req, res, minAlloc), false));
}
use of org.apache.hadoop.yarn.api.records.ReservationDefinition in project hadoop by apache.
the class TestCapacityOverTimePolicy method testFailAvgBySum.
@Test
public void testFailAvgBySum() throws IOException, PlanningException {
// generate an allocation which violates the 25% average by sum
Map<ReservationInterval, Resource> req = new TreeMap<ReservationInterval, Resource>();
long win = 86400000 / 4 + 1;
int cont = (int) Math.ceil(0.5 * totCont);
req.put(new ReservationInterval(initTime, initTime + win), ReservationSystemUtil.toResource(ReservationRequest.newInstance(Resource.newInstance(1024, 1), cont)));
ReservationDefinition rDef = ReservationSystemTestUtil.createSimpleReservationDefinition(initTime, initTime + win, win);
assertTrue(plan.toString(), plan.addReservation(new InMemoryReservationAllocation(ReservationSystemTestUtil.getNewReservationId(), rDef, "u1", "dedicated", initTime, initTime + win, req, res, minAlloc), false));
try {
assertTrue(plan.toString(), plan.addReservation(new InMemoryReservationAllocation(ReservationSystemTestUtil.getNewReservationId(), null, "u1", "dedicated", initTime, initTime + win, req, res, minAlloc), false));
Assert.fail("should not have accepted this");
} catch (PlanningQuotaException e) {
// expected
}
}
Aggregations