use of org.apache.flink.runtime.jobmaster.SlotRequestId in project flink by apache.
the class PhysicalSlotRequestBulkCheckerImplTest method testBulkPendingOnCheckIfFulfillable.
@Test
public void testBulkPendingOnCheckIfFulfillable() {
final PhysicalSlotRequestBulkWithTimestamp bulk = createPhysicalSlotRequestBulkWithTimestamp(new SlotRequestId());
final PhysicalSlot slot = addOneSlot();
occupyPhysicalSlot(slot, false);
assertThat(checkBulkTimeout(bulk), is(PhysicalSlotRequestBulkCheckerImpl.TimeoutCheckResult.PENDING));
}
use of org.apache.flink.runtime.jobmaster.SlotRequestId in project flink by apache.
the class PhysicalSlotRequestBulkCheckerImplTest method testBulkPendingOnCheckIfUnfulfillableButNotTimedOut.
@Test
public void testBulkPendingOnCheckIfUnfulfillableButNotTimedOut() {
final PhysicalSlotRequestBulkWithTimestamp bulk = createPhysicalSlotRequestBulkWithTimestamp(new SlotRequestId());
assertThat(checkBulkTimeout(bulk), is(PhysicalSlotRequestBulkCheckerImpl.TimeoutCheckResult.PENDING));
}
use of org.apache.flink.runtime.jobmaster.SlotRequestId in project flink by apache.
the class PhysicalSlotRequestBulkCheckerImplTest method testBulkUnfulfillableWithSlotOccupiedIndefinitely.
@Test
public void testBulkUnfulfillableWithSlotOccupiedIndefinitely() {
final PhysicalSlotRequestBulk bulk = createPhysicalSlotRequestBulk(new SlotRequestId(), new SlotRequestId());
final PhysicalSlot slot1 = addOneSlot();
addOneSlot();
occupyPhysicalSlot(slot1, true);
assertThat(isFulfillable(bulk), is(false));
}
use of org.apache.flink.runtime.jobmaster.SlotRequestId in project flink by apache.
the class PhysicalSlotRequestBulkCheckerImplTest method testBulkFulfilledOnCheck.
@Test
public void testBulkFulfilledOnCheck() {
final SlotRequestId slotRequestId = new SlotRequestId();
final PhysicalSlotRequestBulkImpl bulk = createPhysicalSlotRequestBulk(slotRequestId);
bulk.markRequestFulfilled(slotRequestId, new AllocationID());
final PhysicalSlotRequestBulkWithTimestamp bulkWithTimestamp = new PhysicalSlotRequestBulkWithTimestamp(bulk);
assertThat(checkBulkTimeout(bulkWithTimestamp), is(PhysicalSlotRequestBulkCheckerImpl.TimeoutCheckResult.FULFILLED));
}
use of org.apache.flink.runtime.jobmaster.SlotRequestId in project flink by apache.
the class SimpleRequestSlotMatchingStrategyTest method testSlotRequestsThatCanBeFulfilledAreMatched.
@Test
public void testSlotRequestsThatCanBeFulfilledAreMatched() {
final SimpleRequestSlotMatchingStrategy simpleRequestSlotMatchingStrategy = SimpleRequestSlotMatchingStrategy.INSTANCE;
final ResourceProfile small = ResourceProfile.newBuilder().setCpuCores(1.0).build();
final ResourceProfile large = ResourceProfile.newBuilder().setCpuCores(2.0).build();
final Collection<PhysicalSlot> slots = Arrays.asList(TestingPhysicalSlot.builder().withResourceProfile(small).build(), TestingPhysicalSlot.builder().withResourceProfile(small).build());
final PendingRequest pendingRequest1 = PendingRequest.createNormalRequest(new SlotRequestId(), large, Collections.emptyList());
final PendingRequest pendingRequest2 = PendingRequest.createNormalRequest(new SlotRequestId(), small, Collections.emptyList());
final Collection<PendingRequest> pendingRequests = Arrays.asList(pendingRequest1, pendingRequest2);
final Collection<RequestSlotMatchingStrategy.RequestSlotMatch> requestSlotMatches = simpleRequestSlotMatchingStrategy.matchRequestsAndSlots(slots, pendingRequests);
assertThat(requestSlotMatches).hasSize(1);
assertThat(Iterators.getOnlyElement(requestSlotMatches.iterator()).getPendingRequest().getSlotRequestId()).isEqualTo(pendingRequest2.getSlotRequestId());
}
Aggregations