Java Code Examples for org.apache.flink.runtime.jobmaster.slotpool.SlotPool#offerSlots()
The following examples show how to use
org.apache.flink.runtime.jobmaster.slotpool.SlotPool#offerSlots() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExecutionGraphRestartTest.java From flink with Apache License 2.0 | 6 votes |
private static Scheduler createSchedulerWithSlots( int numSlots, SlotPool slotPool, TaskManagerLocation taskManagerLocation) throws Exception { final TaskManagerGateway taskManagerGateway = new SimpleAckingTaskManagerGateway(); setupSlotPool(slotPool); Scheduler scheduler = new SchedulerImpl(LocationPreferenceSlotSelectionStrategy.INSTANCE, slotPool); scheduler.start(mainThreadExecutor); slotPool.registerTaskManager(taskManagerLocation.getResourceID()); final List<SlotOffer> slotOffers = new ArrayList<>(NUM_TASKS); for (int i = 0; i < numSlots; i++) { final AllocationID allocationId = new AllocationID(); final SlotOffer slotOffer = new SlotOffer(allocationId, 0, ResourceProfile.ANY); slotOffers.add(slotOffer); } slotPool.offerSlots(taskManagerLocation, taskManagerGateway, slotOffers); return scheduler; }
Example 2
Source File: ExecutionGraphRestartTest.java From flink with Apache License 2.0 | 6 votes |
private static Scheduler createSchedulerWithSlots(SlotPool slotPool, TaskManagerLocation taskManagerLocation, int numSlots) throws Exception { final TaskManagerGateway taskManagerGateway = new SimpleAckingTaskManagerGateway(); setupSlotPool(slotPool); Scheduler scheduler = new SchedulerImpl(LocationPreferenceSlotSelectionStrategy.createDefault(), slotPool); scheduler.start(mainThreadExecutor); slotPool.registerTaskManager(taskManagerLocation.getResourceID()); final List<SlotOffer> slotOffers = new ArrayList<>(NUM_TASKS); for (int i = 0; i < numSlots; i++) { final AllocationID allocationId = new AllocationID(); final SlotOffer slotOffer = new SlotOffer(allocationId, 0, ResourceProfile.ANY); slotOffers.add(slotOffer); } slotPool.offerSlots(taskManagerLocation, taskManagerGateway, slotOffers); return scheduler; }