org.apache.flink.runtime.heartbeat.HeartbeatServices Java Examples

The following examples show how to use org.apache.flink.runtime.heartbeat.HeartbeatServices. 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: DispatcherHATest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Nonnull
private HATestingDispatcher createDispatcher(
	HighAvailabilityServices highAvailabilityServices,
	@Nonnull Queue<DispatcherId> fencingTokens,
	JobManagerRunnerFactory jobManagerRunnerFactory) throws Exception {
	final Configuration configuration = new Configuration();

	TestingResourceManagerGateway resourceManagerGateway = new TestingResourceManagerGateway();
	return new HATestingDispatcher(
		rpcService,
		UUID.randomUUID().toString(),
		configuration,
		highAvailabilityServices,
		() -> CompletableFuture.completedFuture(resourceManagerGateway),
		new BlobServer(configuration, new VoidBlobStore()),
		new HeartbeatServices(1000L, 1000L),
		UnregisteredMetricGroups.createUnregisteredJobManagerMetricGroup(),
		null,
		new MemoryArchivedExecutionGraphStore(),
		jobManagerRunnerFactory,
		testingFatalErrorHandler,
		fencingTokens);
}
 
Example #2
Source File: PartialDispatcherServices.java    From flink with Apache License 2.0 6 votes vote down vote up
public PartialDispatcherServices(
		@Nonnull Configuration configuration,
		@Nonnull HighAvailabilityServices highAvailabilityServices,
		@Nonnull GatewayRetriever<ResourceManagerGateway> resourceManagerGatewayRetriever,
		@Nonnull BlobServer blobServer,
		@Nonnull HeartbeatServices heartbeatServices,
		@Nonnull JobManagerMetricGroupFactory jobManagerMetricGroupFactory,
		@Nonnull ArchivedExecutionGraphStore archivedExecutionGraphStore,
		@Nonnull FatalErrorHandler fatalErrorHandler,
		@Nonnull HistoryServerArchivist historyServerArchivist,
		@Nullable String metricQueryServiceAddress) {
	this.configuration = configuration;
	this.highAvailabilityServices = highAvailabilityServices;
	this.resourceManagerGatewayRetriever = resourceManagerGatewayRetriever;
	this.blobServer = blobServer;
	this.heartbeatServices = heartbeatServices;
	this.jobManagerMetricGroupFactory = jobManagerMetricGroupFactory;
	this.archivedExecutionGraphStore = archivedExecutionGraphStore;
	this.fatalErrorHandler = fatalErrorHandler;
	this.historyServerArchivist = historyServerArchivist;
	this.metricQueryServiceAddress = metricQueryServiceAddress;
}
 
Example #3
Source File: TestingJobManagerRunnerFactory.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Override
public JobManagerRunner createJobManagerRunner(
		JobGraph jobGraph,
		Configuration configuration,
		RpcService rpcService,
		HighAvailabilityServices highAvailabilityServices,
		HeartbeatServices heartbeatServices,
		JobManagerSharedServices jobManagerSharedServices,
		JobManagerJobMetricGroupFactory jobManagerJobMetricGroupFactory,
		FatalErrorHandler fatalErrorHandler) throws Exception {
	final Supplier<Exception> exceptionSupplier = failJobMasterCreationWith.get();

	if (exceptionSupplier != null) {
		throw exceptionSupplier.get();
	} else {
		jobGraphFuture.complete(jobGraph);

		final JobManagerRunner mock = mock(JobManagerRunner.class);
		when(mock.getResultFuture()).thenReturn(resultFuture);
		when(mock.closeAsync()).thenReturn(terminationFuture);
		when(mock.getJobGraph()).thenReturn(jobGraph);

		return mock;
	}
}
 
Example #4
Source File: TaskManagerRunnerStartupTest.java    From flink with Apache License 2.0 6 votes vote down vote up
private static void startTaskManager(
	Configuration configuration,
	RpcService rpcService,
	HighAvailabilityServices highAvailabilityServices
) throws Exception {

	TaskManagerRunner.startTaskManager(
		configuration,
		ResourceID.generate(),
		rpcService,
		highAvailabilityServices,
		mock(HeartbeatServices.class),
		NoOpMetricRegistry.INSTANCE,
		mock(BlobCacheService.class),
		false,
		error -> {});
}
 
Example #5
Source File: DefaultJobMasterServiceFactory.java    From flink with Apache License 2.0 6 votes vote down vote up
public DefaultJobMasterServiceFactory(
		JobMasterConfiguration jobMasterConfiguration,
		SlotPoolFactory slotPoolFactory,
		SchedulerFactory schedulerFactory,
		RpcService rpcService,
		HighAvailabilityServices haServices,
		JobManagerSharedServices jobManagerSharedServices,
		HeartbeatServices heartbeatServices,
		JobManagerJobMetricGroupFactory jobManagerJobMetricGroupFactory,
		FatalErrorHandler fatalErrorHandler,
		SchedulerNGFactory schedulerNGFactory,
		ShuffleMaster<?> shuffleMaster) {
	this.jobMasterConfiguration = jobMasterConfiguration;
	this.slotPoolFactory = slotPoolFactory;
	this.schedulerFactory = schedulerFactory;
	this.rpcService = rpcService;
	this.haServices = haServices;
	this.jobManagerSharedServices = jobManagerSharedServices;
	this.heartbeatServices = heartbeatServices;
	this.jobManagerJobMetricGroupFactory = jobManagerJobMetricGroupFactory;
	this.fatalErrorHandler = fatalErrorHandler;
	this.schedulerNGFactory = schedulerNGFactory;
	this.shuffleMaster = shuffleMaster;
}
 
Example #6
Source File: JobMasterTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Nonnull
private JobMaster createJobMaster(
		Configuration configuration,
		JobGraph jobGraph,
		HighAvailabilityServices highAvailabilityServices,
		JobManagerSharedServices jobManagerSharedServices,
		HeartbeatServices heartbeatServices) throws Exception {

	return createJobMaster(
		configuration,
		jobGraph,
		highAvailabilityServices,
		jobManagerSharedServices,
		heartbeatServices,
		new TestingOnCompletionActions());
}
 
Example #7
Source File: TaskManagerRunnerStartupTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
private static void startTaskManager(
	Configuration configuration,
	RpcService rpcService,
	HighAvailabilityServices highAvailabilityServices
) throws Exception {

	TaskManagerRunner.startTaskManager(
		configuration,
		ResourceID.generate(),
		rpcService,
		highAvailabilityServices,
		mock(HeartbeatServices.class),
		NoOpMetricRegistry.INSTANCE,
		mock(BlobCacheService.class),
		false,
		error -> {});
}
 
Example #8
Source File: DispatcherTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public JobManagerRunner createJobManagerRunner(
		JobGraph jobGraph,
		Configuration configuration,
		RpcService rpcService,
		HighAvailabilityServices highAvailabilityServices,
		HeartbeatServices heartbeatServices,
		JobManagerSharedServices jobManagerSharedServices,
		JobManagerJobMetricGroupFactory jobManagerJobMetricGroupFactory,
		FatalErrorHandler fatalErrorHandler) throws Exception {
	assertEquals(expectedJobId, jobGraph.getJobID());

	createdJobManagerRunnerLatch.countDown();

	return DefaultJobManagerRunnerFactory.INSTANCE.createJobManagerRunner(
		jobGraph,
		configuration,
		rpcService,
		highAvailabilityServices,
		heartbeatServices,
		jobManagerSharedServices,
		jobManagerJobMetricGroupFactory,
		fatalErrorHandler);
}
 
Example #9
Source File: TestingTaskExecutor.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
public TestingTaskExecutor(
		RpcService rpcService,
		TaskManagerConfiguration taskManagerConfiguration,
		HighAvailabilityServices haServices,
		TaskManagerServices taskExecutorServices,
		HeartbeatServices heartbeatServices,
		TaskManagerMetricGroup taskManagerMetricGroup,
		@Nullable String metricQueryServicePath,
		BlobCacheService blobCacheService,
		FatalErrorHandler fatalErrorHandler) {
	super(
		rpcService,
		taskManagerConfiguration,
		haServices,
		taskExecutorServices,
		heartbeatServices,
		taskManagerMetricGroup,
		metricQueryServicePath,
		blobCacheService,
		fatalErrorHandler);
}
 
Example #10
Source File: ZooKeeperHADispatcherTest.java    From flink with Apache License 2.0 6 votes vote down vote up
@Nonnull
private TestingDispatcher createDispatcher(HighAvailabilityServices highAvailabilityServices, JobManagerRunnerFactory jobManagerRunnerFactory) throws Exception {
	TestingResourceManagerGateway resourceManagerGateway = new TestingResourceManagerGateway();
	return new TestingDispatcher(
		rpcService,
		Dispatcher.DISPATCHER_NAME + '_' + name.getMethodName() + UUID.randomUUID(),
		configuration,
		highAvailabilityServices,
		() -> CompletableFuture.completedFuture(resourceManagerGateway),
		blobServer,
		new HeartbeatServices(1000L, 1000L),
		UnregisteredMetricGroups.createUnregisteredJobManagerMetricGroup(),
		null,
		new MemoryArchivedExecutionGraphStore(),
		jobManagerRunnerFactory,
		testingFatalErrorHandler);
}
 
Example #11
Source File: MiniCluster.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@VisibleForTesting
protected Collection<? extends DispatcherResourceManagerComponent<?>> createDispatcherResourceManagerComponents(
		Configuration configuration,
		RpcServiceFactory rpcServiceFactory,
		HighAvailabilityServices haServices,
		BlobServer blobServer,
		HeartbeatServices heartbeatServices,
		MetricRegistry metricRegistry,
		MetricQueryServiceRetriever metricQueryServiceRetriever,
		FatalErrorHandler fatalErrorHandler) throws Exception {
	SessionDispatcherResourceManagerComponentFactory dispatcherResourceManagerComponentFactory = createDispatcherResourceManagerComponentFactory();
	return Collections.singleton(
		dispatcherResourceManagerComponentFactory.create(
			configuration,
			rpcServiceFactory.createRpcService(),
			haServices,
			blobServer,
			heartbeatServices,
			metricRegistry,
			new MemoryArchivedExecutionGraphStore(),
			metricQueryServiceRetriever,
			fatalErrorHandler));
}
 
Example #12
Source File: DispatcherTest.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@Nonnull
private TestingDispatcher createDispatcher(HeartbeatServices heartbeatServices, TestingHighAvailabilityServices haServices, JobManagerRunnerFactory jobManagerRunnerFactory) throws Exception {
	TestingResourceManagerGateway resourceManagerGateway = new TestingResourceManagerGateway();
	return new TestingDispatcher(
		rpcService,
		Dispatcher.DISPATCHER_NAME + '_' + name.getMethodName(),
		configuration,
		haServices,
		() -> CompletableFuture.completedFuture(resourceManagerGateway),
		blobServer,
		heartbeatServices,
		UnregisteredMetricGroups.createUnregisteredJobManagerMetricGroup(),
		null,
		new MemoryArchivedExecutionGraphStore(),
		jobManagerRunnerFactory,
		fatalErrorHandler);
}
 
Example #13
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 #14
Source File: ActiveResourceManagerFactory.java    From flink with Apache License 2.0 6 votes vote down vote up
@Override
public ResourceManager<T> createResourceManager(
		Configuration configuration,
		ResourceID resourceId,
		RpcService rpcService,
		HighAvailabilityServices highAvailabilityServices,
		HeartbeatServices heartbeatServices,
		FatalErrorHandler fatalErrorHandler,
		ClusterInformation clusterInformation,
		@Nullable String webInterfaceUrl,
		MetricRegistry metricRegistry,
		String hostname) throws Exception {
	return super.createResourceManager(
		createActiveResourceManagerConfiguration(configuration),
		resourceId,
		rpcService,
		highAvailabilityServices,
		heartbeatServices,
		fatalErrorHandler,
		clusterInformation,
		webInterfaceUrl,
		metricRegistry,
		hostname);
}
 
Example #15
Source File: DispatcherFactory.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Create a {@link Dispatcher} of the given type {@link T}.
 */
T createDispatcher(
	Configuration configuration,
	RpcService rpcService,
	HighAvailabilityServices highAvailabilityServices,
	GatewayRetriever<ResourceManagerGateway> resourceManagerGatewayRetriever,
	BlobServer blobServer,
	HeartbeatServices heartbeatServices,
	JobManagerMetricGroup jobManagerMetricGroup,
	@Nullable String metricQueryServiceAddress,
	ArchivedExecutionGraphStore archivedExecutionGraphStore,
	FatalErrorHandler fatalErrorHandler,
	HistoryServerArchivist historyServerArchivist) throws Exception;
 
Example #16
Source File: JobDispatcherFactory.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public MiniDispatcher createDispatcher(
		Configuration configuration,
		RpcService rpcService,
		HighAvailabilityServices highAvailabilityServices,
		GatewayRetriever<ResourceManagerGateway> resourceManagerGatewayRetriever,
		BlobServer blobServer,
		HeartbeatServices heartbeatServices,
		JobManagerMetricGroup jobManagerMetricGroup,
		@Nullable String metricQueryServiceAddress,
		ArchivedExecutionGraphStore archivedExecutionGraphStore,
		FatalErrorHandler fatalErrorHandler,
		HistoryServerArchivist historyServerArchivist) throws Exception {
	final JobGraph jobGraph = jobGraphRetriever.retrieveJobGraph(configuration);

	final String executionModeValue = configuration.getString(EXECUTION_MODE);

	final ClusterEntrypoint.ExecutionMode executionMode = ClusterEntrypoint.ExecutionMode.valueOf(executionModeValue);

	return new MiniDispatcher(
		rpcService,
		getEndpointId(),
		configuration,
		highAvailabilityServices,
		resourceManagerGatewayRetriever,
		blobServer,
		heartbeatServices,
		jobManagerMetricGroup,
		metricQueryServiceAddress,
		archivedExecutionGraphStore,
		DefaultJobManagerRunnerFactory.INSTANCE,
		fatalErrorHandler,
		historyServerArchivist,
		jobGraph,
		executionMode);
}
 
Example #17
Source File: StandaloneResourceManager.java    From flink with Apache License 2.0 5 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,
		Time startupPeriodTime) {
	super(
		rpcService,
		resourceManagerEndpointId,
		resourceId,
		highAvailabilityServices,
		heartbeatServices,
		slotManager,
		metricRegistry,
		jobLeaderIdService,
		clusterInformation,
		fatalErrorHandler,
		jobManagerMetricGroup);
	this.startupPeriodTime = Preconditions.checkNotNull(startupPeriodTime);
}
 
Example #18
Source File: ResourceManager.java    From flink with Apache License 2.0 5 votes vote down vote up
public ResourceManager(
		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);

	this.resourceId = checkNotNull(resourceId);
	this.highAvailabilityServices = checkNotNull(highAvailabilityServices);
	this.heartbeatServices = checkNotNull(heartbeatServices);
	this.slotManager = checkNotNull(slotManager);
	this.metricRegistry = checkNotNull(metricRegistry);
	this.jobLeaderIdService = checkNotNull(jobLeaderIdService);
	this.clusterInformation = checkNotNull(clusterInformation);
	this.fatalErrorHandler = checkNotNull(fatalErrorHandler);
	this.jobManagerMetricGroup = checkNotNull(jobManagerMetricGroup);

	this.jobManagerRegistrations = new HashMap<>(4);
	this.jmResourceIdRegistrations = new HashMap<>(4);
	this.taskExecutors = new HashMap<>(8);
	this.taskExecutorGatewayFutures = new HashMap<>(8);
}
 
Example #19
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 #20
Source File: TaskExecutor.java    From flink with Apache License 2.0 5 votes vote down vote up
private HeartbeatManager<Void, TaskExecutorHeartbeatPayload> createResourceManagerHeartbeatManager(HeartbeatServices heartbeatServices, ResourceID resourceId) {
	return heartbeatServices.createHeartbeatManager(
		resourceId,
		new ResourceManagerHeartbeatListener(),
		getMainThreadExecutor(),
		log);
}
 
Example #21
Source File: DispatcherResourceManagerComponentFactory.java    From flink with Apache License 2.0 5 votes vote down vote up
DispatcherResourceManagerComponent<T> create(
Configuration configuration,
RpcService rpcService,
HighAvailabilityServices highAvailabilityServices,
BlobServer blobServer,
HeartbeatServices heartbeatServices,
MetricRegistry metricRegistry,
ArchivedExecutionGraphStore archivedExecutionGraphStore,
MetricQueryServiceRetriever metricQueryServiceRetriever,
FatalErrorHandler fatalErrorHandler) throws Exception;
 
Example #22
Source File: TestingMiniCluster.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected Collection<? extends DispatcherResourceManagerComponent<?>> createDispatcherResourceManagerComponents(
		Configuration configuration,
		RpcServiceFactory rpcServiceFactory,
		HighAvailabilityServices haServices,
		BlobServer blobServer,
		HeartbeatServices heartbeatServices,
		MetricRegistry metricRegistry,
		MetricQueryServiceRetriever metricQueryServiceRetriever,
		FatalErrorHandler fatalErrorHandler) throws Exception {
	SessionDispatcherResourceManagerComponentFactory dispatcherResourceManagerComponentFactory = createTestingDispatcherResourceManagerComponentFactory();

	final List<DispatcherResourceManagerComponent<?>> result = new ArrayList<>(numberDispatcherResourceManagerComponents);

	for (int i = 0; i < numberDispatcherResourceManagerComponents; i++) {
		result.add(
			dispatcherResourceManagerComponentFactory.create(
				configuration,
				rpcServiceFactory.createRpcService(),
				haServices,
				blobServer,
				heartbeatServices,
				metricRegistry,
				new MemoryArchivedExecutionGraphStore(),
				metricQueryServiceRetriever,
				fatalErrorHandler));
	}

	return result;
}
 
Example #23
Source File: TestingTaskExecutor.java    From flink with Apache License 2.0 5 votes vote down vote up
public TestingTaskExecutor(
		RpcService rpcService,
		TaskManagerConfiguration taskManagerConfiguration,
		HighAvailabilityServices haServices,
		TaskManagerServices taskExecutorServices,
		ExternalResourceInfoProvider externalResourceInfoProvider,
		HeartbeatServices heartbeatServices,
		TaskManagerMetricGroup taskManagerMetricGroup,
		@Nullable String metricQueryServiceAddress,
		BlobCacheService blobCacheService,
		FatalErrorHandler fatalErrorHandler,
		TaskExecutorPartitionTracker partitionTracker,
		BackPressureSampleService backPressureSampleService) {
	super(
		rpcService,
		taskManagerConfiguration,
		haServices,
		taskExecutorServices,
		externalResourceInfoProvider,
		heartbeatServices,
		taskManagerMetricGroup,
		metricQueryServiceAddress,
		blobCacheService,
		fatalErrorHandler,
		partitionTracker,
		backPressureSampleService);
}
 
Example #24
Source File: ActiveResourceManagerFactory.java    From flink with Apache License 2.0 5 votes vote down vote up
protected abstract ResourceManager<T> createActiveResourceManager(
Configuration configuration,
ResourceID resourceId,
RpcService rpcService,
HighAvailabilityServices highAvailabilityServices,
HeartbeatServices heartbeatServices,
MetricRegistry metricRegistry,
FatalErrorHandler fatalErrorHandler,
ClusterInformation clusterInformation,
@Nullable String webInterfaceUrl,
JobManagerMetricGroup jobManagerMetricGroup) throws Exception;
 
Example #25
Source File: YarnResourceManagerFactory.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
public ResourceManager<YarnWorkerNode> createActiveResourceManager(
		Configuration configuration,
		ResourceID resourceId,
		RpcService rpcService,
		HighAvailabilityServices highAvailabilityServices,
		HeartbeatServices heartbeatServices,
		MetricRegistry metricRegistry,
		FatalErrorHandler fatalErrorHandler,
		ClusterInformation clusterInformation,
		@Nullable String webInterfaceUrl,
		JobManagerMetricGroup jobManagerMetricGroup) throws Exception {
	final ResourceManagerRuntimeServicesConfiguration rmServicesConfiguration = ResourceManagerRuntimeServicesConfiguration.fromConfiguration(configuration);
	final ResourceManagerRuntimeServices rmRuntimeServices = ResourceManagerRuntimeServices.fromConfiguration(
		rmServicesConfiguration,
		highAvailabilityServices,
		rpcService.getScheduledExecutor());

	return new YarnResourceManager(
		rpcService,
		getEndpointId(),
		resourceId,
		configuration,
		System.getenv(),
		highAvailabilityServices,
		heartbeatServices,
		rmRuntimeServices.getSlotManager(),
		metricRegistry,
		rmRuntimeServices.getJobLeaderIdService(),
		clusterInformation,
		fatalErrorHandler,
		webInterfaceUrl,
		jobManagerMetricGroup);
}
 
Example #26
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,
	MetricRegistry metricRegistry,
	JobLeaderIdService jobLeaderIdService,
	FatalErrorHandler fatalErrorHandler,

	// Mesos specifics
	Configuration flinkConfig,
	MesosServices mesosServices,
	MesosConfiguration mesosConfig,
	MesosTaskManagerParameters taskManagerParameters,
	ContainerSpecification taskManagerContainerSpec,
	JobManagerMetricGroup jobManagerMetricGroup) {
	super(
		rpcService,
		resourceManagerEndpointId,
		resourceId,
		highAvailabilityServices,
		heartbeatServices,
		slotManager,
		metricRegistry,
		jobLeaderIdService,
		new ClusterInformation("localhost", 1234),
		fatalErrorHandler,
		flinkConfig,
		mesosServices,
		mesosConfig,
		taskManagerParameters,
		taskManagerContainerSpec,
		null,
		jobManagerMetricGroup);
}
 
Example #27
Source File: ResourceManagerTaskExecutorTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
private StandaloneResourceManager createAndStartResourceManager(LeaderElectionService rmLeaderElectionService, FatalErrorHandler fatalErrorHandler) throws Exception {
	TestingHighAvailabilityServices highAvailabilityServices = new TestingHighAvailabilityServices();
	HeartbeatServices heartbeatServices = new HeartbeatServices(1000L, HEARTBEAT_TIMEOUT);
	highAvailabilityServices.setResourceManagerLeaderElectionService(rmLeaderElectionService);

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

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

	StandaloneResourceManager resourceManager =
		new StandaloneResourceManager(
			rpcService,
			ResourceManager.RESOURCE_MANAGER_NAME + UUID.randomUUID(),
			resourceManagerResourceID,
			highAvailabilityServices,
			heartbeatServices,
			slotManager,
			NoOpMetricRegistry.INSTANCE,
			jobLeaderIdService,
			new ClusterInformation("localhost", 1234),
			fatalErrorHandler,
			UnregisteredMetricGroups.createUnregisteredJobManagerMetricGroup());

	resourceManager.start();

	return resourceManager;
}
 
Example #28
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,
		ResourceManager.RESOURCE_MANAGER_NAME + UUID.randomUUID(),
		resourceManagerResourceId,
		highAvailabilityServices,
		heartbeatServices,
		slotManager,
		NoOpMetricRegistry.INSTANCE,
		jobLeaderIdService,
		testingFatalErrorHandler,
		UnregisteredMetricGroups.createUnregisteredJobManagerMetricGroup());

	resourceManager.start();

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

	return resourceManager;
}
 
Example #29
Source File: JobManagerRunnerFactory.java    From flink with Apache License 2.0 5 votes vote down vote up
JobManagerRunner createJobManagerRunner(
JobGraph jobGraph,
Configuration configuration,
RpcService rpcService,
HighAvailabilityServices highAvailabilityServices,
HeartbeatServices heartbeatServices,
JobManagerSharedServices jobManagerServices,
JobManagerJobMetricGroupFactory jobManagerJobMetricGroupFactory,
FatalErrorHandler fatalErrorHandler) throws Exception;
 
Example #30
Source File: DispatcherTest.java    From flink with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
	final JobVertex testVertex = new JobVertex("testVertex");
	testVertex.setInvokableClass(NoOpInvokable.class);
	jobGraph = new JobGraph(TEST_JOB_ID, "testJob", testVertex);
	jobGraph.setAllowQueuedScheduling(true);

	fatalErrorHandler = new TestingFatalErrorHandler();
	heartbeatServices = new HeartbeatServices(1000L, 10000L);
	submittedJobGraphStore = new FaultySubmittedJobGraphStore();

	dispatcherLeaderElectionService = new TestingLeaderElectionService();
	jobMasterLeaderElectionService = new TestingLeaderElectionService();

	haServices = new TestingHighAvailabilityServices();
	haServices.setDispatcherLeaderElectionService(dispatcherLeaderElectionService);
	haServices.setSubmittedJobGraphStore(submittedJobGraphStore);
	haServices.setJobMasterLeaderElectionService(TEST_JOB_ID, jobMasterLeaderElectionService);
	haServices.setCheckpointRecoveryFactory(new StandaloneCheckpointRecoveryFactory());
	haServices.setResourceManagerLeaderRetriever(new SettableLeaderRetrievalService());
	runningJobsRegistry = haServices.getRunningJobsRegistry();

	configuration = new Configuration();

	configuration.setString(
		BlobServerOptions.STORAGE_DIRECTORY,
		temporaryFolder.newFolder().getAbsolutePath());

	createdJobManagerRunnerLatch = new CountDownLatch(2);
	blobServer = new BlobServer(configuration, new VoidBlobStore());
}