use of org.apache.flink.runtime.jobmaster.slotpool.DummyPayload in project flink by apache.
the class SharedSlotTest method testReleaseIfPhysicalSlotIsAllocated.
@Test
public void testReleaseIfPhysicalSlotIsAllocated() {
CompletableFuture<PhysicalSlot> slotContextFuture = CompletableFuture.completedFuture(new TestingPhysicalSlot(RP, new AllocationID()));
CompletableFuture<ExecutionSlotSharingGroup> released = new CompletableFuture<>();
SharedSlot sharedSlot = SharedSlotBuilder.newBuilder().withSlotContextFuture(slotContextFuture).withExternalReleaseCallback(released::complete).build();
LogicalSlot logicalSlot = sharedSlot.allocateLogicalSlot(EV1).join();
CompletableFuture<Object> terminalFuture = new CompletableFuture<>();
logicalSlot.tryAssignPayload(new DummyPayload(terminalFuture));
assertThat(terminalFuture.isDone(), is(false));
sharedSlot.release(new Throwable());
assertThat(terminalFuture.isDone(), is(true));
assertThat(sharedSlot.isEmpty(), is(true));
assertThat(released.isDone(), is(true));
}
use of org.apache.flink.runtime.jobmaster.slotpool.DummyPayload in project flink by apache.
the class SlotSharingExecutionSlotAllocatorTest method releaseLogicalSlot.
private static void releaseLogicalSlot(LogicalSlot slot) {
slot.tryAssignPayload(new DummyPayload(CompletableFuture.completedFuture(null)));
slot.releaseSlot(new Throwable());
}
Aggregations