use of org.apache.flink.runtime.resourcemanager.slotmanager.SlotManager in project flink by apache.
the class ResourceManagerTest method testDisconnectJobManagerClearsRequirements.
@Test
public void testDisconnectJobManagerClearsRequirements() throws Exception {
final TestingJobMasterGateway jobMasterGateway = new TestingJobMasterGatewayBuilder().setAddress(UUID.randomUUID().toString()).build();
rpcService.registerGateway(jobMasterGateway.getAddress(), jobMasterGateway);
final JobLeaderIdService jobLeaderIdService = TestingJobLeaderIdService.newBuilder().setGetLeaderIdFunction(jobId -> CompletableFuture.completedFuture(jobMasterGateway.getFencingToken())).build();
final CompletableFuture<JobID> clearRequirementsFuture = new CompletableFuture<>();
final SlotManager slotManager = new TestingSlotManagerBuilder().setClearRequirementsConsumer(clearRequirementsFuture::complete).createSlotManager();
resourceManager = new ResourceManagerBuilder().withJobLeaderIdService(jobLeaderIdService).withSlotManager(slotManager).buildAndStart();
final JobID jobId = JobID.generate();
final ResourceManagerGateway resourceManagerGateway = resourceManager.getSelfGateway(ResourceManagerGateway.class);
resourceManagerGateway.registerJobMaster(jobMasterGateway.getFencingToken(), ResourceID.generate(), jobMasterGateway.getAddress(), jobId, TIMEOUT).get();
resourceManagerGateway.declareRequiredResources(jobMasterGateway.getFencingToken(), ResourceRequirements.create(jobId, jobMasterGateway.getAddress(), Collections.singleton(ResourceRequirement.create(ResourceProfile.UNKNOWN, 1))), TIMEOUT).get();
resourceManagerGateway.disconnectJobManager(jobId, JobStatus.FINISHED, new FlinkException("Test exception"));
assertThat(clearRequirementsFuture.get(5, TimeUnit.SECONDS), is(jobId));
}
use of org.apache.flink.runtime.resourcemanager.slotmanager.SlotManager in project flink by apache.
the class StandaloneResourceManagerTest method testStartupPeriod.
@Test
public void testStartupPeriod() throws Exception {
final LinkedBlockingQueue<Boolean> setFailUnfulfillableRequestInvokes = new LinkedBlockingQueue<>();
final SlotManager slotManager = new TestingSlotManagerBuilder().setSetFailUnfulfillableRequestConsumer(setFailUnfulfillableRequestInvokes::add).createSlotManager();
final TestingStandaloneResourceManager rm = createResourceManager(Time.milliseconds(1L), slotManager);
assertThat(setFailUnfulfillableRequestInvokes.take(), is(false));
assertThat(setFailUnfulfillableRequestInvokes.take(), is(true));
rm.close();
}
use of org.apache.flink.runtime.resourcemanager.slotmanager.SlotManager in project flink by apache.
the class StandaloneResourceManagerTest method testNoStartupPeriod.
@Test
public void testNoStartupPeriod() throws Exception {
final LinkedBlockingQueue<Boolean> setFailUnfulfillableRequestInvokes = new LinkedBlockingQueue<>();
final SlotManager slotManager = new TestingSlotManagerBuilder().setSetFailUnfulfillableRequestConsumer(setFailUnfulfillableRequestInvokes::add).createSlotManager();
final TestingStandaloneResourceManager rm = createResourceManager(Time.milliseconds(-1L), slotManager);
assertThat(setFailUnfulfillableRequestInvokes.take(), is(false));
assertThat(setFailUnfulfillableRequestInvokes.poll(50L, TimeUnit.MILLISECONDS), is(nullValue()));
rm.close();
}
use of org.apache.flink.runtime.resourcemanager.slotmanager.SlotManager in project flink by apache.
the class ResourceManagerRuntimeServices method fromConfiguration.
// -------------------- Static methods --------------------------------------
public static ResourceManagerRuntimeServices fromConfiguration(ResourceManagerRuntimeServicesConfiguration configuration, HighAvailabilityServices highAvailabilityServices, ScheduledExecutor scheduledExecutor, SlotManagerMetricGroup slotManagerMetricGroup) {
final SlotManager slotManager = createSlotManager(configuration, scheduledExecutor, slotManagerMetricGroup);
final JobLeaderIdService jobLeaderIdService = new DefaultJobLeaderIdService(highAvailabilityServices, scheduledExecutor, configuration.getJobTimeout());
return new ResourceManagerRuntimeServices(slotManager, jobLeaderIdService);
}
Aggregations