Search in sources :

Example 1 with DummyPayload

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));
}
Also used : DummyPayload(org.apache.flink.runtime.jobmaster.slotpool.DummyPayload) AllocationID(org.apache.flink.runtime.clusterframework.types.AllocationID) LogicalSlot(org.apache.flink.runtime.jobmaster.LogicalSlot) PhysicalSlot(org.apache.flink.runtime.jobmaster.slotpool.PhysicalSlot) CompletableFuture(java.util.concurrent.CompletableFuture) SharedSlotTestingUtils.createExecutionSlotSharingGroup(org.apache.flink.runtime.scheduler.SharedSlotTestingUtils.createExecutionSlotSharingGroup) Test(org.junit.Test)

Example 2 with DummyPayload

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());
}
Also used : DummyPayload(org.apache.flink.runtime.jobmaster.slotpool.DummyPayload)

Aggregations

DummyPayload (org.apache.flink.runtime.jobmaster.slotpool.DummyPayload)2 CompletableFuture (java.util.concurrent.CompletableFuture)1 AllocationID (org.apache.flink.runtime.clusterframework.types.AllocationID)1 LogicalSlot (org.apache.flink.runtime.jobmaster.LogicalSlot)1 PhysicalSlot (org.apache.flink.runtime.jobmaster.slotpool.PhysicalSlot)1 SharedSlotTestingUtils.createExecutionSlotSharingGroup (org.apache.flink.runtime.scheduler.SharedSlotTestingUtils.createExecutionSlotSharingGroup)1 Test (org.junit.Test)1