Search in sources :

Example 1 with SimpleSlotContext

use of org.apache.flink.runtime.instance.SimpleSlotContext in project flink by apache.

the class DeclarativeSlotPoolServiceTest method testCreateAllocatedSlotReport.

@Test
public void testCreateAllocatedSlotReport() throws Exception {
    final LocalTaskManagerLocation taskManagerLocation1 = new LocalTaskManagerLocation();
    final LocalTaskManagerLocation taskManagerLocation2 = new LocalTaskManagerLocation();
    final SimpleSlotContext simpleSlotContext2 = createSimpleSlotContext(taskManagerLocation2);
    final Collection<SlotInfo> slotInfos = Arrays.asList(createSimpleSlotContext(taskManagerLocation1), simpleSlotContext2);
    try (DeclarativeSlotPoolService declarativeSlotPoolService = createDeclarativeSlotPoolService(new TestingDeclarativeSlotPoolFactory(new TestingDeclarativeSlotPoolBuilder().setGetAllSlotsInformationSupplier(() -> slotInfos)))) {
        final AllocatedSlotReport allocatedSlotReport = declarativeSlotPoolService.createAllocatedSlotReport(taskManagerLocation2.getResourceID());
        assertThat(allocatedSlotReport.getAllocatedSlotInfos(), contains(matchesWithSlotContext(simpleSlotContext2)));
    }
}
Also used : SimpleSlotContext(org.apache.flink.runtime.instance.SimpleSlotContext) AllocatedSlotReport(org.apache.flink.runtime.jobmaster.AllocatedSlotReport) LocalTaskManagerLocation(org.apache.flink.runtime.taskmanager.LocalTaskManagerLocation) SlotInfo(org.apache.flink.runtime.jobmaster.SlotInfo) AllocatedSlotInfo(org.apache.flink.runtime.jobmaster.AllocatedSlotInfo) Test(org.junit.Test)

Aggregations

SimpleSlotContext (org.apache.flink.runtime.instance.SimpleSlotContext)1 AllocatedSlotInfo (org.apache.flink.runtime.jobmaster.AllocatedSlotInfo)1 AllocatedSlotReport (org.apache.flink.runtime.jobmaster.AllocatedSlotReport)1 SlotInfo (org.apache.flink.runtime.jobmaster.SlotInfo)1 LocalTaskManagerLocation (org.apache.flink.runtime.taskmanager.LocalTaskManagerLocation)1 Test (org.junit.Test)1