Search in sources :

Example 41 with SlotRequestId

use of org.apache.flink.runtime.jobmaster.SlotRequestId in project flink by apache.

the class PhysicalSlotRequestBulkCheckerImplTest method testFulfilledBulkIsNotCancelled.

@Test
public void testFulfilledBulkIsNotCancelled() throws InterruptedException, ExecutionException {
    final CompletableFuture<SlotRequestId> cancellationFuture = new CompletableFuture<>();
    final PhysicalSlotRequestBulk bulk = createPhysicalSlotRequestBulkWithCancellationFuture(cancellationFuture, new SlotRequestId());
    bulkChecker.schedulePendingRequestBulkTimeoutCheck(bulk, TIMEOUT);
    checkNotCancelledAfter(cancellationFuture, 2 * TIMEOUT.toMilliseconds());
}
Also used : SlotRequestId(org.apache.flink.runtime.jobmaster.SlotRequestId) CompletableFuture(java.util.concurrent.CompletableFuture) Test(org.junit.Test)

Example 42 with SlotRequestId

use of org.apache.flink.runtime.jobmaster.SlotRequestId in project flink by apache.

the class PhysicalSlotRequestBulkCheckerImplTest method testBulkFulfillable.

@Test
public void testBulkFulfillable() {
    final PhysicalSlotRequestBulk bulk = createPhysicalSlotRequestBulk(new SlotRequestId());
    addOneSlot();
    assertThat(isFulfillable(bulk), is(true));
}
Also used : SlotRequestId(org.apache.flink.runtime.jobmaster.SlotRequestId) Test(org.junit.Test)

Example 43 with SlotRequestId

use of org.apache.flink.runtime.jobmaster.SlotRequestId in project flink by apache.

the class PhysicalSlotRequestBulkCheckerImplTest method testPendingBulkIsNotCancelled.

@Test
public void testPendingBulkIsNotCancelled() throws InterruptedException, ExecutionException {
    final CompletableFuture<SlotRequestId> cancellationFuture = new CompletableFuture<>();
    final PhysicalSlotRequestBulk bulk = createPhysicalSlotRequestBulkWithCancellationFuture(cancellationFuture, new SlotRequestId());
    bulkChecker.schedulePendingRequestBulkTimeoutCheck(bulk, TIMEOUT);
    checkNotCancelledAfter(cancellationFuture, 2 * TIMEOUT.toMilliseconds());
}
Also used : SlotRequestId(org.apache.flink.runtime.jobmaster.SlotRequestId) CompletableFuture(java.util.concurrent.CompletableFuture) Test(org.junit.Test)

Example 44 with SlotRequestId

use of org.apache.flink.runtime.jobmaster.SlotRequestId in project flink by apache.

the class PhysicalSlotRequestBulkCheckerImplTest method testUnfulfillableBulkIsCancelled.

@Test
public void testUnfulfillableBulkIsCancelled() {
    final CompletableFuture<SlotRequestId> cancellationFuture = new CompletableFuture<>();
    final SlotRequestId slotRequestId = new SlotRequestId();
    final PhysicalSlotRequestBulk bulk = createPhysicalSlotRequestBulkWithCancellationFuture(cancellationFuture, slotRequestId);
    bulkChecker.schedulePendingRequestBulkTimeoutCheck(bulk, TIMEOUT);
    clock.advanceTime(TIMEOUT.toMilliseconds() + 1L, TimeUnit.MILLISECONDS);
    assertThat(cancellationFuture.join(), is(slotRequestId));
}
Also used : SlotRequestId(org.apache.flink.runtime.jobmaster.SlotRequestId) CompletableFuture(java.util.concurrent.CompletableFuture) Test(org.junit.Test)

Example 45 with SlotRequestId

use of org.apache.flink.runtime.jobmaster.SlotRequestId in project flink by apache.

the class PhysicalSlotRequestBulkCheckerImplTest method testBulkFulfillableWithSlotOccupiedTemporarily.

@Test
public void testBulkFulfillableWithSlotOccupiedTemporarily() {
    final PhysicalSlotRequestBulk bulk = createPhysicalSlotRequestBulk(new SlotRequestId(), new SlotRequestId());
    final PhysicalSlot slot1 = addOneSlot();
    addOneSlot();
    occupyPhysicalSlot(slot1, false);
    assertThat(isFulfillable(bulk), is(true));
}
Also used : SlotRequestId(org.apache.flink.runtime.jobmaster.SlotRequestId) PhysicalSlotTestUtils.occupyPhysicalSlot(org.apache.flink.runtime.jobmaster.slotpool.PhysicalSlotTestUtils.occupyPhysicalSlot) PhysicalSlotTestUtils.createPhysicalSlot(org.apache.flink.runtime.jobmaster.slotpool.PhysicalSlotTestUtils.createPhysicalSlot) Test(org.junit.Test)

Aggregations

SlotRequestId (org.apache.flink.runtime.jobmaster.SlotRequestId)51 Test (org.junit.Test)40 TestingPhysicalSlot (org.apache.flink.runtime.scheduler.TestingPhysicalSlot)15 LogicalSlot (org.apache.flink.runtime.jobmaster.LogicalSlot)12 CompletableFuture (java.util.concurrent.CompletableFuture)11 AllocationID (org.apache.flink.runtime.clusterframework.types.AllocationID)11 ResourceProfile (org.apache.flink.runtime.clusterframework.types.ResourceProfile)8 TestLogger (org.apache.flink.util.TestLogger)6 Collectors (java.util.stream.Collectors)5 CoreMatchers.is (org.hamcrest.CoreMatchers.is)5 Assert.fail (org.junit.Assert.fail)5 Collection (java.util.Collection)4 Collections (java.util.Collections)4 List (java.util.List)4 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)4 Consumer (java.util.function.Consumer)4 Time (org.apache.flink.api.common.time.Time)4 Arrays (java.util.Arrays)3 ExecutionException (java.util.concurrent.ExecutionException)3 SlotProfile (org.apache.flink.runtime.clusterframework.types.SlotProfile)3