Java Code Examples for org.apache.flink.runtime.jobmaster.slotpool.SlotPool#start()

The following examples show how to use org.apache.flink.runtime.jobmaster.slotpool.SlotPool#start() . 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: SchedulerTestBase.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() throws Exception {
	final JobID jobId = new JobID();
	final SlotPool slotPool = new SlotPoolImpl(jobId);
	final TestingScheduler testingScheduler = new TestingScheduler(
		new HashMap<>(16),
		LocationPreferenceSlotSelectionStrategy.INSTANCE,
		slotPool);

	testingSlotProvider = new TestingSlotPoolSlotProvider(slotPool, testingScheduler);

	final JobMasterId jobMasterId = JobMasterId.generate();
	final String jobManagerAddress = "localhost";
	ComponentMainThreadExecutor executor = TestingComponentMainThreadExecutorServiceAdapter.forMainThread();
	slotPool.start(jobMasterId, jobManagerAddress, executor);
	testingScheduler.start(executor);
}
 
Example 2
Source File: SchedulerTestBase.java    From flink with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() throws Exception {
	final JobID jobId = new JobID();
	final SlotPool slotPool = new TestingSlotPoolImpl(jobId);
	final TestingScheduler testingScheduler = new TestingScheduler(
		new HashMap<>(16),
		LocationPreferenceSlotSelectionStrategy.INSTANCE,
		slotPool);

	testingSlotProvider = new TestingSlotPoolSlotProvider(slotPool, testingScheduler);

	final JobMasterId jobMasterId = JobMasterId.generate();
	final String jobManagerAddress = "localhost";
	ComponentMainThreadExecutor executor = ComponentMainThreadExecutorServiceAdapter.forMainThread();
	slotPool.start(jobMasterId, jobManagerAddress, executor);
	testingScheduler.start(executor);
}
 
Example 3
Source File: ExecutionGraphNotEnoughResourceTest.java    From flink with Apache License 2.0 6 votes vote down vote up
private static Scheduler createSchedulerWithSlots(
		int numSlots,
		SlotPool slotPool,
		TaskManagerLocation taskManagerLocation) throws Exception {
	final TaskManagerGateway taskManagerGateway = new SimpleAckingTaskManagerGateway();
	final String jobManagerAddress = "foobar";
	final ResourceManagerGateway resourceManagerGateway = new TestingResourceManagerGateway();
	slotPool.start(JobMasterId.generate(), jobManagerAddress, mainThreadExecutor);
	slotPool.connectToResourceManager(resourceManagerGateway);
	Scheduler scheduler = new SchedulerImpl(LocationPreferenceSlotSelectionStrategy.createDefault(), slotPool);
	scheduler.start(mainThreadExecutor);

	CompletableFuture.runAsync(() -> slotPool.registerTaskManager(taskManagerLocation.getResourceID()), mainThreadExecutor).join();

	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);
	}

	CompletableFuture.runAsync(() -> slotPool.offerSlots(taskManagerLocation, taskManagerGateway, slotOffers), mainThreadExecutor).join();

	return scheduler;
}
 
Example 4
Source File: ExecutionGraphRestartTest.java    From flink with Apache License 2.0 4 votes vote down vote up
private static void setupSlotPool(SlotPool slotPool) throws Exception {
	final String jobManagerAddress = "foobar";
	final ResourceManagerGateway resourceManagerGateway = new TestingResourceManagerGateway();
	slotPool.start(JobMasterId.generate(), jobManagerAddress, mainThreadExecutor);
	slotPool.connectToResourceManager(resourceManagerGateway);
}
 
Example 5
Source File: ExecutionGraphRestartTest.java    From flink with Apache License 2.0 4 votes vote down vote up
private static void setupSlotPool(SlotPool slotPool) throws Exception {
	final String jobManagerAddress = "foobar";
	final ResourceManagerGateway resourceManagerGateway = new TestingResourceManagerGateway();
	slotPool.start(JobMasterId.generate(), jobManagerAddress, mainThreadExecutor);
	slotPool.connectToResourceManager(resourceManagerGateway);
}