Java Code Examples for org.apache.flink.runtime.highavailability.HighAvailabilityServicesUtils#createHighAvailabilityServices()

The following examples show how to use org.apache.flink.runtime.highavailability.HighAvailabilityServicesUtils#createHighAvailabilityServices() . 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: ClusterEntrypoint.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
protected HighAvailabilityServices createHaServices(
	Configuration configuration,
	Executor executor) throws Exception {
	return HighAvailabilityServicesUtils.createHighAvailabilityServices(
		configuration,
		executor,
		HighAvailabilityServicesUtils.AddressResolution.NO_ADDRESS_RESOLUTION);
}
 
Example 2
Source File: ClusterClient.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a instance that submits the programs to the JobManager defined in the
 * configuration. This method will try to resolve the JobManager hostname and throw an exception
 * if that is not possible.
 *
 * @param flinkConfig The config used to obtain the job-manager's address, and used to configure the optimizer.
 *
 * @throws Exception we cannot create the high availability services
 */
public ClusterClient(Configuration flinkConfig) throws Exception {
	this(
		flinkConfig,
		HighAvailabilityServicesUtils.createHighAvailabilityServices(
			flinkConfig,
			Executors.directExecutor(),
			HighAvailabilityServicesUtils.AddressResolution.TRY_ADDRESS_RESOLUTION),
		false);
}
 
Example 3
Source File: ClusterEntrypoint.java    From flink with Apache License 2.0 5 votes vote down vote up
protected HighAvailabilityServices createHaServices(
	Configuration configuration,
	Executor executor) throws Exception {
	return HighAvailabilityServicesUtils.createHighAvailabilityServices(
		configuration,
		executor,
		HighAvailabilityServicesUtils.AddressResolution.NO_ADDRESS_RESOLUTION);
}
 
Example 4
Source File: ClusterClient.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a instance that submits the programs to the JobManager defined in the
 * configuration. This method will try to resolve the JobManager hostname and throw an exception
 * if that is not possible.
 *
 * @param flinkConfig The config used to obtain the job-manager's address, and used to configure the optimizer.
 *
 * @throws Exception we cannot create the high availability services
 */
public ClusterClient(Configuration flinkConfig) throws Exception {
	this(
		flinkConfig,
		HighAvailabilityServicesUtils.createHighAvailabilityServices(
			flinkConfig,
			Executors.directExecutor(),
			HighAvailabilityServicesUtils.AddressResolution.TRY_ADDRESS_RESOLUTION),
		false);
}
 
Example 5
Source File: ClusterEntrypoint.java    From flink with Apache License 2.0 5 votes vote down vote up
protected HighAvailabilityServices createHaServices(
	Configuration configuration,
	Executor executor) throws Exception {
	return HighAvailabilityServicesUtils.createHighAvailabilityServices(
		configuration,
		executor,
		HighAvailabilityServicesUtils.AddressResolution.NO_ADDRESS_RESOLUTION);
}
 
Example 6
Source File: TaskManagerRunner.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
public TaskManagerRunner(Configuration configuration, ResourceID resourceId) throws Exception {
	this.configuration = checkNotNull(configuration);
	this.resourceId = checkNotNull(resourceId);

	timeout = AkkaUtils.getTimeoutAsTime(configuration);

	this.executor = java.util.concurrent.Executors.newScheduledThreadPool(
		Hardware.getNumberCPUCores(),
		new ExecutorThreadFactory("taskmanager-future"));

	highAvailabilityServices = HighAvailabilityServicesUtils.createHighAvailabilityServices(
		configuration,
		executor,
		HighAvailabilityServicesUtils.AddressResolution.TRY_ADDRESS_RESOLUTION);

	rpcService = createRpcService(configuration, highAvailabilityServices);
	metricQueryServiceActorSystem = MetricUtils.startMetricsActorSystem(configuration, rpcService.getAddress(), LOG);

	HeartbeatServices heartbeatServices = HeartbeatServices.fromConfiguration(configuration);

	metricRegistry = new MetricRegistryImpl(MetricRegistryConfiguration.fromConfiguration(configuration));

	// TODO: Temporary hack until the MetricQueryService has been ported to RpcEndpoint
	metricRegistry.startQueryService(metricQueryServiceActorSystem, resourceId);

	blobCacheService = new BlobCacheService(
		configuration, highAvailabilityServices.createBlobStore(), null
	);

	taskManager = startTaskManager(
		this.configuration,
		this.resourceId,
		rpcService,
		highAvailabilityServices,
		heartbeatServices,
		metricRegistry,
		blobCacheService,
		false,
		this);

	this.terminationFuture = new CompletableFuture<>();
	this.shutdown = false;

	MemoryLogger.startIfConfigured(LOG, configuration, metricQueryServiceActorSystem);
}
 
Example 7
Source File: TaskManagerRunnerConfigurationTest.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
private HighAvailabilityServices createHighAvailabilityServices(final Configuration config) throws Exception {
	return HighAvailabilityServicesUtils.createHighAvailabilityServices(
		config,
		Executors.directExecutor(),
		HighAvailabilityServicesUtils.AddressResolution.NO_ADDRESS_RESOLUTION);
}
 
Example 8
Source File: TaskManagerRunner.java    From flink with Apache License 2.0 4 votes vote down vote up
public TaskManagerRunner(Configuration configuration, ResourceID resourceId) throws Exception {
	this.configuration = checkNotNull(configuration);
	this.resourceId = checkNotNull(resourceId);

	timeout = AkkaUtils.getTimeoutAsTime(configuration);

	this.executor = java.util.concurrent.Executors.newScheduledThreadPool(
		Hardware.getNumberCPUCores(),
		new ExecutorThreadFactory("taskmanager-future"));

	highAvailabilityServices = HighAvailabilityServicesUtils.createHighAvailabilityServices(
		configuration,
		executor,
		HighAvailabilityServicesUtils.AddressResolution.TRY_ADDRESS_RESOLUTION);

	rpcService = createRpcService(configuration, highAvailabilityServices);

	HeartbeatServices heartbeatServices = HeartbeatServices.fromConfiguration(configuration);

	metricRegistry = new MetricRegistryImpl(
		MetricRegistryConfiguration.fromConfiguration(configuration),
		ReporterSetup.fromConfiguration(configuration));

	final RpcService metricQueryServiceRpcService = MetricUtils.startMetricsRpcService(configuration, rpcService.getAddress());
	metricRegistry.startQueryService(metricQueryServiceRpcService, resourceId);

	blobCacheService = new BlobCacheService(
		configuration, highAvailabilityServices.createBlobStore(), null
	);

	taskManager = startTaskManager(
		this.configuration,
		this.resourceId,
		rpcService,
		highAvailabilityServices,
		heartbeatServices,
		metricRegistry,
		blobCacheService,
		false,
		this);

	this.terminationFuture = new CompletableFuture<>();
	this.shutdown = false;

	MemoryLogger.startIfConfigured(LOG, configuration, terminationFuture);
}
 
Example 9
Source File: TaskManagerRunnerConfigurationTest.java    From flink with Apache License 2.0 4 votes vote down vote up
private HighAvailabilityServices createHighAvailabilityServices(final Configuration config) throws Exception {
	return HighAvailabilityServicesUtils.createHighAvailabilityServices(
		config,
		Executors.directExecutor(),
		HighAvailabilityServicesUtils.AddressResolution.NO_ADDRESS_RESOLUTION);
}
 
Example 10
Source File: TaskManagerRunner.java    From flink with Apache License 2.0 4 votes vote down vote up
public TaskManagerRunner(Configuration configuration, PluginManager pluginManager) throws Exception {
	this.configuration = checkNotNull(configuration);

	timeout = AkkaUtils.getTimeoutAsTime(configuration);

	this.executor = java.util.concurrent.Executors.newScheduledThreadPool(
		Hardware.getNumberCPUCores(),
		new ExecutorThreadFactory("taskmanager-future"));

	highAvailabilityServices = HighAvailabilityServicesUtils.createHighAvailabilityServices(
		configuration,
		executor,
		HighAvailabilityServicesUtils.AddressResolution.NO_ADDRESS_RESOLUTION);

	rpcService = createRpcService(configuration, highAvailabilityServices);

	this.resourceId = new ResourceID(getTaskManagerResourceID(configuration, rpcService.getAddress(), rpcService.getPort()));

	HeartbeatServices heartbeatServices = HeartbeatServices.fromConfiguration(configuration);

	metricRegistry = new MetricRegistryImpl(
		MetricRegistryConfiguration.fromConfiguration(configuration),
		ReporterSetup.fromConfiguration(configuration, pluginManager));

	final RpcService metricQueryServiceRpcService = MetricUtils.startRemoteMetricsRpcService(configuration, rpcService.getAddress());
	metricRegistry.startQueryService(metricQueryServiceRpcService, resourceId);

	blobCacheService = new BlobCacheService(
		configuration, highAvailabilityServices.createBlobStore(), null
	);

	final ExternalResourceInfoProvider externalResourceInfoProvider =
		ExternalResourceUtils.createStaticExternalResourceInfoProvider(
			ExternalResourceUtils.getExternalResourceAmountMap(configuration),
			ExternalResourceUtils.externalResourceDriversFromConfig(configuration, pluginManager));

	taskManager = startTaskManager(
		this.configuration,
		this.resourceId,
		rpcService,
		highAvailabilityServices,
		heartbeatServices,
		metricRegistry,
		blobCacheService,
		false,
		externalResourceInfoProvider,
		this);

	this.terminationFuture = new CompletableFuture<>();
	this.shutdown = false;

	MemoryLogger.startIfConfigured(LOG, configuration, terminationFuture);
}
 
Example 11
Source File: TaskManagerRunnerConfigurationTest.java    From flink with Apache License 2.0 4 votes vote down vote up
private HighAvailabilityServices createHighAvailabilityServices(final Configuration config) throws Exception {
	return HighAvailabilityServicesUtils.createHighAvailabilityServices(
		config,
		Executors.directExecutor(),
		HighAvailabilityServicesUtils.AddressResolution.NO_ADDRESS_RESOLUTION);
}