org.apache.flink.runtime.resourcemanager.slotmanager.SlotManager Java Examples

The following examples show how to use org.apache.flink.runtime.resourcemanager.slotmanager.SlotManager. 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: StandaloneResourceManagerTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testStartUpPeriodAfterLeadershipSwitch() 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.rmServices.revokeLeadership();
	rm.rmServices.grantLeadership();

	assertThat(setFailUnfulfillableRequestInvokes.take(), is(false));
	assertThat(setFailUnfulfillableRequestInvokes.take(), is(true));
}
 
Example #2
Source File: TestingResourceManager.java    From flink with Apache License 2.0 6 votes vote down vote up
public TestingResourceManager(
		RpcService rpcService,
		String resourceManagerEndpointId,
		ResourceID resourceId,
		HighAvailabilityServices highAvailabilityServices,
		HeartbeatServices heartbeatServices,
		SlotManager slotManager,
		MetricRegistry metricRegistry,
		JobLeaderIdService jobLeaderIdService,
		FatalErrorHandler fatalErrorHandler,
		JobManagerMetricGroup jobManagerMetricGroup) {
	super(
		rpcService,
		resourceManagerEndpointId,
		resourceId,
		highAvailabilityServices,
		heartbeatServices,
		slotManager,
		metricRegistry,
		jobLeaderIdService,
		new ClusterInformation("localhost", 1234),
		fatalErrorHandler,
		jobManagerMetricGroup);
}
 
Example #3
Source File: KubernetesResourceManagerTest.java    From flink with Apache License 2.0 6 votes vote down vote up
private TestingKubernetesResourceManager createAndStartResourceManager(Configuration configuration, SlotManager slotManager, FlinkKubeClient flinkKubeClient) throws Exception {

			final TestingRpcService rpcService = new TestingRpcService(configuration);
			final MockResourceManagerRuntimeServices rmServices = new MockResourceManagerRuntimeServices(rpcService, TIMEOUT, slotManager);

			final TestingKubernetesResourceManager kubernetesResourceManager = new TestingKubernetesResourceManager(
				rpcService,
				ResourceID.generate(),
				configuration,
				rmServices.highAvailabilityServices,
				rmServices.heartbeatServices,
				rmServices.slotManager,
				rmServices.jobLeaderIdService,
				new ClusterInformation("localhost", 1234),
				testingFatalErrorHandlerResource.getFatalErrorHandler(),
				UnregisteredMetricGroups.createUnregisteredResourceManagerMetricGroup(),
				flinkKubeClient,
				new KubernetesResourceManagerConfiguration(CLUSTER_ID, TESTING_POD_CREATION_RETRY_INTERVAL));
			kubernetesResourceManager.start();
			rmServices.grantLeadership();
			return kubernetesResourceManager;
		}
 
Example #4
Source File: ResourceManagerRuntimeServices.java    From flink with Apache License 2.0 6 votes vote down vote up
public static ResourceManagerRuntimeServices fromConfiguration(
		ResourceManagerRuntimeServicesConfiguration configuration,
		HighAvailabilityServices highAvailabilityServices,
		ScheduledExecutor scheduledExecutor) throws Exception {

	final SlotManagerConfiguration slotManagerConfiguration = configuration.getSlotManagerConfiguration();

	final SlotManager slotManager = new SlotManagerImpl(
		scheduledExecutor,
		slotManagerConfiguration.getTaskManagerRequestTimeout(),
		slotManagerConfiguration.getSlotRequestTimeout(),
		slotManagerConfiguration.getTaskManagerTimeout(),
		slotManagerConfiguration.isWaitResultConsumedBeforeRelease());

	final JobLeaderIdService jobLeaderIdService = new JobLeaderIdService(
		highAvailabilityServices,
		scheduledExecutor,
		configuration.getJobTimeout());

	return new ResourceManagerRuntimeServices(slotManager, jobLeaderIdService);
}
 
Example #5
Source File: MesosResourceManagerTest.java    From flink with Apache License 2.0 6 votes vote down vote up
MockResourceManagerRuntimeServices() throws Exception {
	highAvailabilityServices = new TestingHighAvailabilityServices();
	rmLeaderElectionService = new TestingLeaderElectionService();
	highAvailabilityServices.setResourceManagerLeaderElectionService(rmLeaderElectionService);
	heartbeatServices = new HeartbeatServices(Integer.MAX_VALUE, Integer.MAX_VALUE);
	slotManager = mock(SlotManager.class);
	slotManagerStarted = new CompletableFuture<>();
	jobLeaderIdService = new JobLeaderIdService(
		highAvailabilityServices,
		rpcService.getScheduledExecutor(),
		Time.minutes(5L));

	doAnswer(new Answer<Object>() {
		@Override
		public Object answer(InvocationOnMock invocation) throws Throwable {
			rmActions = invocation.getArgument(2);
			slotManagerStarted.complete(true);
			return null;
		}
	}).when(slotManager).start(any(ResourceManagerId.class), any(Executor.class), any(ResourceActions.class));

	when(slotManager.registerSlotRequest(any(SlotRequest.class))).thenReturn(true);
}
 
Example #6
Source File: ResourceManagerRuntimeServices.java    From flink with Apache License 2.0 6 votes vote down vote up
public static ResourceManagerRuntimeServices fromConfiguration(
		ResourceManagerRuntimeServicesConfiguration configuration,
		HighAvailabilityServices highAvailabilityServices,
		ScheduledExecutor scheduledExecutor,
		SlotManagerMetricGroup slotManagerMetricGroup) {

	final SlotManager slotManager = new SlotManagerImpl(
		scheduledExecutor,
		configuration.getSlotManagerConfiguration(),
		slotManagerMetricGroup);

	final JobLeaderIdService jobLeaderIdService = new JobLeaderIdService(
		highAvailabilityServices,
		scheduledExecutor,
		configuration.getJobTimeout());

	return new ResourceManagerRuntimeServices(slotManager, jobLeaderIdService);
}
 
Example #7
Source File: MesosResourceManagerTest.java    From flink with Apache License 2.0 6 votes vote down vote up
MockResourceManagerRuntimeServices() throws Exception {
	highAvailabilityServices = new TestingHighAvailabilityServices();
	rmLeaderElectionService = new TestingLeaderElectionService();
	highAvailabilityServices.setResourceManagerLeaderElectionService(rmLeaderElectionService);
	heartbeatServices = new HeartbeatServices(5L, 5L);
	metricRegistry = mock(MetricRegistryImpl.class);
	slotManager = mock(SlotManager.class);
	slotManagerStarted = new CompletableFuture<>();
	jobLeaderIdService = new JobLeaderIdService(
		highAvailabilityServices,
		rpcService.getScheduledExecutor(),
		Time.minutes(5L));

	doAnswer(new Answer<Object>() {
		@Override
		public Object answer(InvocationOnMock invocation) throws Throwable {
			rmActions = invocation.getArgument(2);
			slotManagerStarted.complete(true);
			return null;
		}
	}).when(slotManager).start(any(ResourceManagerId.class), any(Executor.class), any(ResourceActions.class));

	when(slotManager.registerSlotRequest(any(SlotRequest.class))).thenReturn(true);
}
 
Example #8
Source File: TestingResourceManager.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
public TestingResourceManager(
		RpcService rpcService,
		String resourceManagerEndpointId,
		ResourceID resourceId,
		HighAvailabilityServices highAvailabilityServices,
		HeartbeatServices heartbeatServices,
		SlotManager slotManager,
		MetricRegistry metricRegistry,
		JobLeaderIdService jobLeaderIdService,
		FatalErrorHandler fatalErrorHandler,
		JobManagerMetricGroup jobManagerMetricGroup) {
	super(
		rpcService,
		resourceManagerEndpointId,
		resourceId,
		highAvailabilityServices,
		heartbeatServices,
		slotManager,
		metricRegistry,
		jobLeaderIdService,
		new ClusterInformation("localhost", 1234),
		fatalErrorHandler,
		jobManagerMetricGroup);
}
 
Example #9
Source File: TestingResourceManager.java    From flink with Apache License 2.0 6 votes vote down vote up
public TestingResourceManager(
		RpcService rpcService,
		ResourceID resourceId,
		HighAvailabilityServices highAvailabilityServices,
		HeartbeatServices heartbeatServices,
		SlotManager slotManager,
		ResourceManagerPartitionTrackerFactory clusterPartitionTrackerFactory,
		JobLeaderIdService jobLeaderIdService,
		FatalErrorHandler fatalErrorHandler,
		ResourceManagerMetricGroup resourceManagerMetricGroup) {
	super(
		rpcService,
		resourceId,
		highAvailabilityServices,
		heartbeatServices,
		slotManager,
		clusterPartitionTrackerFactory,
		jobLeaderIdService,
		new ClusterInformation("localhost", 1234),
		fatalErrorHandler,
		resourceManagerMetricGroup,
		RpcUtils.INF_TIMEOUT);
}
 
Example #10
Source File: ResourceManagerRuntimeServices.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
public static ResourceManagerRuntimeServices fromConfiguration(
		ResourceManagerRuntimeServicesConfiguration configuration,
		HighAvailabilityServices highAvailabilityServices,
		ScheduledExecutor scheduledExecutor) throws Exception {

	final SlotManagerConfiguration slotManagerConfiguration = configuration.getSlotManagerConfiguration();

	final SlotManager slotManager = new SlotManager(
		scheduledExecutor,
		slotManagerConfiguration.getTaskManagerRequestTimeout(),
		slotManagerConfiguration.getSlotRequestTimeout(),
		slotManagerConfiguration.getTaskManagerTimeout(),
		slotManagerConfiguration.isWaitResultConsumedBeforeRelease());

	final JobLeaderIdService jobLeaderIdService = new JobLeaderIdService(
		highAvailabilityServices,
		scheduledExecutor,
		configuration.getJobTimeout());

	return new ResourceManagerRuntimeServices(slotManager, jobLeaderIdService);
}
 
Example #11
Source File: MesosResourceManagerTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
MockResourceManagerRuntimeServices() throws Exception {
	highAvailabilityServices = new TestingHighAvailabilityServices();
	rmLeaderElectionService = new TestingLeaderElectionService();
	highAvailabilityServices.setResourceManagerLeaderElectionService(rmLeaderElectionService);
	heartbeatServices = new HeartbeatServices(5L, 5L);
	metricRegistry = mock(MetricRegistryImpl.class);
	slotManager = mock(SlotManager.class);
	slotManagerStarted = new CompletableFuture<>();
	jobLeaderIdService = new JobLeaderIdService(
		highAvailabilityServices,
		rpcService.getScheduledExecutor(),
		Time.minutes(5L));

	doAnswer(new Answer<Object>() {
		@Override
		public Object answer(InvocationOnMock invocation) throws Throwable {
			rmActions = invocation.getArgument(2);
			slotManagerStarted.complete(true);
			return null;
		}
	}).when(slotManager).start(any(ResourceManagerId.class), any(Executor.class), any(ResourceActions.class));

	when(slotManager.registerSlotRequest(any(SlotRequest.class))).thenReturn(true);
}
 
Example #12
Source File: StandaloneResourceManager.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
public StandaloneResourceManager(
		RpcService rpcService,
		String resourceManagerEndpointId,
		ResourceID resourceId,
		HighAvailabilityServices highAvailabilityServices,
		HeartbeatServices heartbeatServices,
		SlotManager slotManager,
		MetricRegistry metricRegistry,
		JobLeaderIdService jobLeaderIdService,
		ClusterInformation clusterInformation,
		FatalErrorHandler fatalErrorHandler,
		JobManagerMetricGroup jobManagerMetricGroup) {
	super(
		rpcService,
		resourceManagerEndpointId,
		resourceId,
		highAvailabilityServices,
		heartbeatServices,
		slotManager,
		metricRegistry,
		jobLeaderIdService,
		clusterInformation,
		fatalErrorHandler,
		jobManagerMetricGroup);
}
 
Example #13
Source File: StandaloneResourceManagerTest.java    From flink with Apache License 2.0 6 votes vote down vote up
private TestingStandaloneResourceManager createResourceManager(Time startupPeriod, SlotManager slotManager) throws Exception {

		final MockResourceManagerRuntimeServices rmServices = new MockResourceManagerRuntimeServices(
			RPC_SERVICE.getTestingRpcService(),
			TIMEOUT,
			slotManager);

		final TestingStandaloneResourceManager rm = new TestingStandaloneResourceManager(
			rmServices.rpcService,
			ResourceID.generate(),
			rmServices.highAvailabilityServices,
			rmServices.heartbeatServices,
			rmServices.slotManager,
			rmServices.jobLeaderIdService,
			new ClusterInformation("localhost", 1234),
			fatalErrorHandler,
			UnregisteredMetricGroups.createUnregisteredResourceManagerMetricGroup(),
			startupPeriod,
			rmServices);

		rm.start();
		rmServices.grantLeadership();

		return rm;
	}
 
Example #14
Source File: StandaloneResourceManagerTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Test
public void testStartUpPeriodAfterLeadershipSwitch() 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.rmServices.revokeLeadership();
	rm.rmServices.grantLeadership();

	assertThat(setFailUnfulfillableRequestInvokes.take(), is(false));
	assertThat(setFailUnfulfillableRequestInvokes.take(), is(true));
}
 
Example #15
Source File: ResourceManagerPartitionLifecycleTest.java    From flink with Apache License 2.0 5 votes vote down vote up
private ResourceManagerGateway createAndStartResourceManager() throws Exception {
	final SlotManager slotManager = SlotManagerBuilder.newBuilder()
		.setScheduledExecutor(rpcService.getScheduledExecutor())
		.build();
	final JobLeaderIdService jobLeaderIdService = new JobLeaderIdService(
		highAvailabilityServices,
		rpcService.getScheduledExecutor(),
		TestingUtils.infiniteTime());

	final TestingResourceManager resourceManager = new TestingResourceManager(
		rpcService,
		ResourceID.generate(),
		highAvailabilityServices,
		new HeartbeatServices(100000L, 1000000L),
		slotManager,
		ResourceManagerPartitionTrackerImpl::new,
		jobLeaderIdService,
		testingFatalErrorHandler,
		UnregisteredMetricGroups.createUnregisteredResourceManagerMetricGroup());

	resourceManager.start();

	// first make the ResourceManager the leader
	resourceManagerLeaderElectionService.isLeader(ResourceManagerId.generate().toUUID()).get();

	this.resourceManager = resourceManager;

	return resourceManager.getSelfGateway(ResourceManagerGateway.class);
}
 
Example #16
Source File: YarnResourceManagerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
TestingYarnResourceManager(
		RpcService rpcService,
		ResourceID resourceId,
		Configuration flinkConfig,
		Map<String, String> env,
		HighAvailabilityServices highAvailabilityServices,
		HeartbeatServices heartbeatServices,
		SlotManager slotManager,
		JobLeaderIdService jobLeaderIdService,
		ClusterInformation clusterInformation,
		FatalErrorHandler fatalErrorHandler,
		@Nullable String webInterfaceUrl,
		ResourceManagerMetricGroup resourceManagerMetricGroup) {
	super(
		rpcService,
		resourceId,
		flinkConfig,
		env,
		highAvailabilityServices,
		heartbeatServices,
		slotManager,
		NoOpResourceManagerPartitionTracker::get,
		jobLeaderIdService,
		clusterInformation,
		fatalErrorHandler,
		webInterfaceUrl,
		resourceManagerMetricGroup);
	this.testingYarnNMClientAsync = new TestingYarnNMClientAsync(this);
	this.testingYarnAMRMClientAsync = new TestingYarnAMRMClientAsync(this);
}
 
Example #17
Source File: ResourceManagerJobMasterTest.java    From flink with Apache License 2.0 5 votes vote down vote up
private ResourceManager<?> createAndStartResourceManager() throws Exception {
	ResourceID rmResourceId = ResourceID.generate();

	HeartbeatServices heartbeatServices = new HeartbeatServices(1000L, 1000L);

	JobLeaderIdService jobLeaderIdService = new JobLeaderIdService(
		haServices,
		rpcService.getScheduledExecutor(),
		Time.minutes(5L));

	final SlotManager slotManager = SlotManagerBuilder.newBuilder()
		.setScheduledExecutor(rpcService.getScheduledExecutor())
		.build();

	ResourceManager<?> resourceManager = new StandaloneResourceManager(
		rpcService,
		rmResourceId,
		haServices,
		heartbeatServices,
		slotManager,
		NoOpResourceManagerPartitionTracker::get,
		jobLeaderIdService,
		new ClusterInformation("localhost", 1234),
		testingFatalErrorHandler,
		UnregisteredMetricGroups.createUnregisteredResourceManagerMetricGroup(),
		Time.minutes(5L),
		RpcUtils.INF_TIMEOUT);

	resourceManager.start();

	return resourceManager;
}
 
Example #18
Source File: ResourceManagerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
private TestingResourceManager createAndStartResourceManager(HeartbeatServices heartbeatServices) throws Exception {
	final SlotManager slotManager = SlotManagerBuilder.newBuilder()
		.setScheduledExecutor(rpcService.getScheduledExecutor())
		.build();
	final JobLeaderIdService jobLeaderIdService = new JobLeaderIdService(
		highAvailabilityServices,
		rpcService.getScheduledExecutor(),
		TestingUtils.infiniteTime());

	final TestingResourceManager resourceManager = new TestingResourceManager(
		rpcService,
		resourceManagerResourceId,
		highAvailabilityServices,
		heartbeatServices,
		slotManager,
		NoOpResourceManagerPartitionTracker::get,
		jobLeaderIdService,
		testingFatalErrorHandler,
		UnregisteredMetricGroups.createUnregisteredResourceManagerMetricGroup());

	resourceManager.start();

	// first make the ResourceManager the leader
	resourceManagerId = ResourceManagerId.generate();
	resourceManagerLeaderElectionService.isLeader(resourceManagerId.toUUID()).get();

	return resourceManager;
}
 
Example #19
Source File: StandaloneResourceManagerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example #20
Source File: StandaloneResourceManagerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@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();
}
 
Example #21
Source File: StandaloneResourceManager.java    From flink with Apache License 2.0 5 votes vote down vote up
public StandaloneResourceManager(
		RpcService rpcService,
		ResourceID resourceId,
		HighAvailabilityServices highAvailabilityServices,
		HeartbeatServices heartbeatServices,
		SlotManager slotManager,
		ResourceManagerPartitionTrackerFactory clusterPartitionTrackerFactory,
		JobLeaderIdService jobLeaderIdService,
		ClusterInformation clusterInformation,
		FatalErrorHandler fatalErrorHandler,
		ResourceManagerMetricGroup resourceManagerMetricGroup,
		Time startupPeriodTime,
		Time rpcTimeout) {
	super(
		rpcService,
		resourceId,
		highAvailabilityServices,
		heartbeatServices,
		slotManager,
		clusterPartitionTrackerFactory,
		jobLeaderIdService,
		clusterInformation,
		fatalErrorHandler,
		resourceManagerMetricGroup,
		rpcTimeout);
	this.startupPeriodTime = Preconditions.checkNotNull(startupPeriodTime);
}
 
Example #22
Source File: ActiveResourceManager.java    From flink with Apache License 2.0 5 votes vote down vote up
public ActiveResourceManager(
		Configuration flinkConfig,
		Map<String, String> env,
		RpcService rpcService,
		ResourceID resourceId,
		HighAvailabilityServices highAvailabilityServices,
		HeartbeatServices heartbeatServices,
		SlotManager slotManager,
		ResourceManagerPartitionTrackerFactory clusterPartitionTrackerFactory,
		JobLeaderIdService jobLeaderIdService,
		ClusterInformation clusterInformation,
		FatalErrorHandler fatalErrorHandler,
		ResourceManagerMetricGroup resourceManagerMetricGroup) {
	super(
		rpcService,
		resourceId,
		highAvailabilityServices,
		heartbeatServices,
		slotManager,
		clusterPartitionTrackerFactory,
		jobLeaderIdService,
		clusterInformation,
		fatalErrorHandler,
		resourceManagerMetricGroup,
		AkkaUtils.getTimeoutAsTime(flinkConfig));

	this.flinkConfig = flinkConfig;
	this.env = env;

	// Load the flink config uploaded by flink client
	this.flinkClientConfig = loadClientConfiguration();

	requestedNotAllocatedWorkerCounter = new PendingWorkerCounter();
	requestedNotRegisteredWorkerCounter = new PendingWorkerCounter();
	allocatedNotRegisteredWorkerResourceSpecs = new HashMap<>();
}
 
Example #23
Source File: MockResourceManagerRuntimeServices.java    From flink with Apache License 2.0 5 votes vote down vote up
public MockResourceManagerRuntimeServices(RpcService rpcService, Time timeout, SlotManager slotManager) {
	this.rpcService = checkNotNull(rpcService);
	this.timeout = checkNotNull(timeout);
	this.slotManager = slotManager;
	highAvailabilityServices = new TestingHighAvailabilityServices();
	rmLeaderElectionService = new TestingLeaderElectionService();
	highAvailabilityServices.setResourceManagerLeaderElectionService(rmLeaderElectionService);
	heartbeatServices = new TestingHeartbeatServices();
	jobLeaderIdService = new JobLeaderIdService(
		highAvailabilityServices,
		rpcService.getScheduledExecutor(),
		Time.minutes(5L));
}
 
Example #24
Source File: MesosResourceManagerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
public TestingMesosResourceManager(
	RpcService rpcService,
	String resourceManagerEndpointId,
	ResourceID resourceId,
	HighAvailabilityServices highAvailabilityServices,
	HeartbeatServices heartbeatServices,
	SlotManager slotManager,
	JobLeaderIdService jobLeaderIdService,
	FatalErrorHandler fatalErrorHandler,

	// Mesos specifics
	Configuration flinkConfig,
	MesosServices mesosServices,
	MesosConfiguration mesosConfig,
	MesosTaskManagerParameters taskManagerParameters,
	ContainerSpecification taskManagerContainerSpec,
	ResourceManagerMetricGroup resourceManagerMetricGroup) {
	super(
		rpcService,
		resourceId,
		highAvailabilityServices,
		heartbeatServices,
		slotManager,
		NoOpResourceManagerPartitionTracker::get,
		jobLeaderIdService,
		new ClusterInformation("localhost", 1234),
		fatalErrorHandler,
		flinkConfig,
		mesosServices,
		mesosConfig,
		taskManagerParameters,
		taskManagerContainerSpec,
		null,
		resourceManagerMetricGroup);
}
 
Example #25
Source File: StandaloneResourceManagerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
private TestingStandaloneResourceManager(
		RpcService rpcService,
		ResourceID resourceId,
		HighAvailabilityServices highAvailabilityServices,
		HeartbeatServices heartbeatServices,
		SlotManager slotManager,
		JobLeaderIdService jobLeaderIdService,
		ClusterInformation clusterInformation,
		FatalErrorHandler fatalErrorHandler,
		ResourceManagerMetricGroup resourceManagerMetricGroup,
		Time startupPeriodTime,
		MockResourceManagerRuntimeServices rmServices) {
	super(
		rpcService,
		resourceId,
		highAvailabilityServices,
		heartbeatServices,
		slotManager,
		NoOpResourceManagerPartitionTracker::get,
		jobLeaderIdService,
		clusterInformation,
		fatalErrorHandler,
		resourceManagerMetricGroup,
		startupPeriodTime,
		RpcUtils.INF_TIMEOUT);
	this.rmServices = rmServices;
}
 
Example #26
Source File: KubernetesResourceManagerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
TestingKubernetesResourceManager(
		RpcService rpcService,
		ResourceID resourceId,
		Configuration flinkConfig,
		HighAvailabilityServices highAvailabilityServices,
		HeartbeatServices heartbeatServices,
		SlotManager slotManager,
		JobLeaderIdService jobLeaderIdService,
		ClusterInformation clusterInformation,
		FatalErrorHandler fatalErrorHandler,
		ResourceManagerMetricGroup resourceManagerMetricGroup,
		FlinkKubeClient flinkKubeClient,
		KubernetesResourceManagerConfiguration configuration) {
	super(
		rpcService,
		resourceId,
		flinkConfig,
		highAvailabilityServices,
		heartbeatServices,
		slotManager,
		NoOpResourceManagerPartitionTracker::get,
		jobLeaderIdService,
		clusterInformation,
		fatalErrorHandler,
		resourceManagerMetricGroup,
		flinkKubeClient,
		configuration
	);
}
 
Example #27
Source File: KubernetesResourceManager.java    From flink with Apache License 2.0 5 votes vote down vote up
public KubernetesResourceManager(
		RpcService rpcService,
		ResourceID resourceId,
		Configuration flinkConfig,
		HighAvailabilityServices highAvailabilityServices,
		HeartbeatServices heartbeatServices,
		SlotManager slotManager,
		ResourceManagerPartitionTrackerFactory clusterPartitionTrackerFactory,
		JobLeaderIdService jobLeaderIdService,
		ClusterInformation clusterInformation,
		FatalErrorHandler fatalErrorHandler,
		ResourceManagerMetricGroup resourceManagerMetricGroup,
		FlinkKubeClient kubeClient,
		KubernetesResourceManagerConfiguration configuration) {
	super(
		flinkConfig,
		System.getenv(),
		rpcService,
		resourceId,
		highAvailabilityServices,
		heartbeatServices,
		slotManager,
		clusterPartitionTrackerFactory,
		jobLeaderIdService,
		clusterInformation,
		fatalErrorHandler,
		resourceManagerMetricGroup);
	this.clusterId = configuration.getClusterId();
	this.kubeClient = kubeClient;
	this.configuration = configuration;
	this.podWorkerResources = new HashMap<>();
}
 
Example #28
Source File: StandaloneResourceManagerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
private TestingStandaloneResourceManager(
		RpcService rpcService,
		String resourceManagerEndpointId,
		ResourceID resourceId,
		HighAvailabilityServices highAvailabilityServices,
		HeartbeatServices heartbeatServices,
		SlotManager slotManager,
		MetricRegistry metricRegistry,
		JobLeaderIdService jobLeaderIdService,
		ClusterInformation clusterInformation,
		FatalErrorHandler fatalErrorHandler,
		JobManagerMetricGroup jobManagerMetricGroup,
		Time startupPeriodTime,
		MockResourceManagerRuntimeServices rmServices) {
	super(
		rpcService,
		resourceManagerEndpointId,
		resourceId,
		highAvailabilityServices,
		heartbeatServices,
		slotManager,
		metricRegistry,
		jobLeaderIdService,
		clusterInformation,
		fatalErrorHandler,
		jobManagerMetricGroup,
		startupPeriodTime);
	this.rmServices = rmServices;
}
 
Example #29
Source File: StandaloneResourceManagerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
private TestingStandaloneResourceManager createResourceManager(Time startupPeriod, SlotManager slotManager) throws Exception {

		final MockResourceManagerRuntimeServices rmServices = new MockResourceManagerRuntimeServices(
			RPC_SERVICE.getTestingRpcService(),
			TIMEOUT,
			slotManager);

		final TestingStandaloneResourceManager rm = new TestingStandaloneResourceManager(
			rmServices.rpcService,
			UUID.randomUUID().toString(),
			ResourceID.generate(),
			rmServices.highAvailabilityServices,
			rmServices.heartbeatServices,
			rmServices.slotManager,
			rmServices.metricRegistry,
			rmServices.jobLeaderIdService,
			new ClusterInformation("localhost", 1234),
			fatalErrorHandler,
			UnregisteredMetricGroups.createUnregisteredJobManagerMetricGroup(),
			startupPeriod,
			rmServices);

		rm.start();
		rmServices.grantLeadership();

		return rm;
	}
 
Example #30
Source File: YarnResourceManagerTest.java    From flink with Apache License 2.0 5 votes vote down vote up
Context(Configuration configuration, @Nullable SlotManager slotManager) throws  Exception {

			workerResourceSpec = YarnWorkerResourceSpecFactory.INSTANCE.createDefaultWorkerResourceSpec(configuration);
			if (slotManager == null) {
				slotManager = SlotManagerBuilder.newBuilder()
					.setDefaultWorkerResourceSpec(workerResourceSpec)
					.build();
			}
			rpcService = new TestingRpcService();
			rmServices = new MockResourceManagerRuntimeServices(rpcService, TIMEOUT, slotManager);

			// resource manager
			rmResourceID = ResourceID.generate();
			resourceManager =
					new TestingYarnResourceManager(
							rpcService,
							rmResourceID,
							configuration,
							env,
							rmServices.highAvailabilityServices,
							rmServices.heartbeatServices,
							rmServices.slotManager,
							rmServices.jobLeaderIdService,
							new ClusterInformation("localhost", 1234),
							testingFatalErrorHandler,
							null,
							UnregisteredMetricGroups.createUnregisteredResourceManagerMetricGroup());

			testingYarnAMRMClientAsync = resourceManager.testingYarnAMRMClientAsync;
			testingYarnNMClientAsync = resourceManager.testingYarnNMClientAsync;

			containerResource = resourceManager.getContainerResource(workerResourceSpec).get();
		}