use of org.apache.flink.runtime.jobmaster.SlotRequestId in project flink by apache.
the class DeclarativeSlotPoolBridgeResourceDeclarationTest method testRequirementsDecreasedOnSlotFreeing.
@Test
public void testRequirementsDecreasedOnSlotFreeing() throws Exception {
declarativeSlotPoolBridge.start(jobMasterId, "localhost", mainThreadExecutor);
final PhysicalSlot newSlot = createAllocatedSlot(new AllocationID());
declarativeSlotPoolBridge.newSlotsAreAvailable(Collections.singleton(newSlot));
final SlotRequestId slotRequestId = new SlotRequestId();
declarativeSlotPoolBridge.allocateAvailableSlot(slotRequestId, newSlot.getAllocationId(), ResourceProfile.UNKNOWN);
// releasing (==freeing) a [reserved] slot should decrease the requirements
declarativeSlotPoolBridge.releaseSlot(slotRequestId, new RuntimeException("Test exception"));
assertThat(requirementListener.getRequirements().getResourceCount(ResourceProfile.UNKNOWN), is(0));
}
use of org.apache.flink.runtime.jobmaster.SlotRequestId in project flink by apache.
the class DeclarativeSlotPoolBridgeResourceDeclarationTest method testRequirementsDecreasedOnSlotAllocationFailure.
@Test
public void testRequirementsDecreasedOnSlotAllocationFailure() throws Exception {
declarativeSlotPoolBridge.start(jobMasterId, "localhost", mainThreadExecutor);
final PhysicalSlot newSlot = createAllocatedSlot(new AllocationID());
declarativeSlotPoolBridge.newSlotsAreAvailable(Collections.singleton(newSlot));
declarativeSlotPoolBridge.allocateAvailableSlot(new SlotRequestId(), newSlot.getAllocationId(), ResourceProfile.UNKNOWN);
// releasing (==freeing) a [reserved] slot should decrease the requirements
declarativeSlotPoolBridge.failAllocation(newSlot.getTaskManagerLocation().getResourceID(), newSlot.getAllocationId(), new RuntimeException("Test exception"));
assertThat(requirementListener.getRequirements().getResourceCount(ResourceProfile.UNKNOWN), is(0));
}
use of org.apache.flink.runtime.jobmaster.SlotRequestId in project flink by apache.
the class PhysicalSlotProviderImplWithSpreadOutStrategyTest method testSlotAllocationFulfilledWithPreferredInputOverwrittingSpreadOut.
@Test
public void testSlotAllocationFulfilledWithPreferredInputOverwrittingSpreadOut() throws ExecutionException, InterruptedException {
physicalSlotProviderResource.registerSlotOffersFromNewTaskExecutor(ResourceProfile.ANY, ResourceProfile.ANY);
physicalSlotProviderResource.registerSlotOffersFromNewTaskExecutor(ResourceProfile.ANY, ResourceProfile.ANY);
PhysicalSlotRequest request0 = physicalSlotProviderResource.createSimpleRequest();
PhysicalSlotRequest.Result result0 = physicalSlotProviderResource.allocateSlot(request0).get();
TaskManagerLocation preferredTaskManagerLocation = result0.getPhysicalSlot().getTaskManagerLocation();
PhysicalSlotRequest request1 = new PhysicalSlotRequest(new SlotRequestId(), SlotProfileTestingUtils.preferredLocality(ResourceProfile.ANY, Collections.singleton(preferredTaskManagerLocation)), false);
PhysicalSlotRequest.Result result1 = physicalSlotProviderResource.allocateSlot(request1).get();
assertThat(result1.getPhysicalSlot().getTaskManagerLocation(), is(preferredTaskManagerLocation));
}
use of org.apache.flink.runtime.jobmaster.SlotRequestId in project flink by apache.
the class PhysicalSlotRequestBulkCheckerImplTest method testBulkUnfulfillableWithSlotAlreadyAssignedToBulk.
@Test
public void testBulkUnfulfillableWithSlotAlreadyAssignedToBulk() {
final SlotRequestId slotRequestId = new SlotRequestId();
final PhysicalSlotRequestBulkImpl bulk = createPhysicalSlotRequestBulk(slotRequestId, new SlotRequestId());
final PhysicalSlot slot = addOneSlot();
bulk.markRequestFulfilled(slotRequestId, slot.getAllocationId());
assertThat(isFulfillable(bulk), is(false));
}
use of org.apache.flink.runtime.jobmaster.SlotRequestId in project flink by apache.
the class PhysicalSlotRequestBulkCheckerImplTest method testBulkUnfulfillableWithInsufficientSlots.
@Test
public void testBulkUnfulfillableWithInsufficientSlots() {
final PhysicalSlotRequestBulk bulk = createPhysicalSlotRequestBulk(new SlotRequestId(), new SlotRequestId());
addOneSlot();
assertThat(isFulfillable(bulk), is(false));
}
Aggregations