Java Code Examples for org.apache.flink.runtime.akka.AkkaUtils#getTimeoutAsTime()

The following examples show how to use org.apache.flink.runtime.akka.AkkaUtils#getTimeoutAsTime() . 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: JobMasterConfiguration.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
public static JobMasterConfiguration fromConfiguration(Configuration configuration) {

		final Time rpcTimeout = AkkaUtils.getTimeoutAsTime(configuration);

		final Time slotRequestTimeout = Time.milliseconds(configuration.getLong(JobManagerOptions.SLOT_REQUEST_TIMEOUT));

		final String tmpDirectory = ConfigurationUtils.parseTempDirectories(configuration)[0];

		final RetryingRegistrationConfiguration retryingRegistrationConfiguration = RetryingRegistrationConfiguration.fromConfiguration(configuration);

		return new JobMasterConfiguration(
			rpcTimeout,
			slotRequestTimeout,
			tmpDirectory,
			retryingRegistrationConfiguration,
			configuration);
	}
 
Example 2
Source File: JobMasterConfiguration.java    From flink with Apache License 2.0 6 votes vote down vote up
public static JobMasterConfiguration fromConfiguration(Configuration configuration) {

		final Time rpcTimeout = AkkaUtils.getTimeoutAsTime(configuration);

		final Time slotRequestTimeout = Time.milliseconds(configuration.getLong(JobManagerOptions.SLOT_REQUEST_TIMEOUT));

		final String tmpDirectory = ConfigurationUtils.parseTempDirectories(configuration)[0];

		final RetryingRegistrationConfiguration retryingRegistrationConfiguration = RetryingRegistrationConfiguration.fromConfiguration(configuration);

		return new JobMasterConfiguration(
			rpcTimeout,
			slotRequestTimeout,
			tmpDirectory,
			retryingRegistrationConfiguration,
			configuration);
	}
 
Example 3
Source File: JobMasterConfiguration.java    From flink with Apache License 2.0 6 votes vote down vote up
public static JobMasterConfiguration fromConfiguration(Configuration configuration) {

		final Time rpcTimeout = AkkaUtils.getTimeoutAsTime(configuration);

		final Time slotRequestTimeout = Time.milliseconds(configuration.getLong(JobManagerOptions.SLOT_REQUEST_TIMEOUT));

		final String tmpDirectory = ConfigurationUtils.parseTempDirectories(configuration)[0];

		final RetryingRegistrationConfiguration retryingRegistrationConfiguration = RetryingRegistrationConfiguration.fromConfiguration(configuration);

		return new JobMasterConfiguration(
			rpcTimeout,
			slotRequestTimeout,
			tmpDirectory,
			retryingRegistrationConfiguration,
			configuration);
	}
 
Example 4
Source File: DefaultSlotPoolFactory.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public static DefaultSlotPoolFactory fromConfiguration(@Nonnull Configuration configuration) {

		final Time rpcTimeout = AkkaUtils.getTimeoutAsTime(configuration);
		final Time slotIdleTimeout = Time.milliseconds(configuration.getLong(JobManagerOptions.SLOT_IDLE_TIMEOUT));

		return new DefaultSlotPoolFactory(
			SystemClock.getInstance(),
			rpcTimeout,
			slotIdleTimeout);
	}
 
Example 5
Source File: DefaultSlotPoolFactory.java    From flink with Apache License 2.0 5 votes vote down vote up
public static DefaultSlotPoolFactory fromConfiguration(@Nonnull Configuration configuration) {

		final Time rpcTimeout = AkkaUtils.getTimeoutAsTime(configuration);
		final Time slotIdleTimeout = Time.milliseconds(configuration.getLong(JobManagerOptions.SLOT_IDLE_TIMEOUT));
		final Time batchSlotTimeout = Time.milliseconds(configuration.getLong(JobManagerOptions.SLOT_REQUEST_TIMEOUT));

		return new DefaultSlotPoolFactory(
			SystemClock.getInstance(),
			rpcTimeout,
			slotIdleTimeout,
			batchSlotTimeout);
	}
 
Example 6
Source File: DefaultSlotPoolFactory.java    From flink with Apache License 2.0 5 votes vote down vote up
public static DefaultSlotPoolFactory fromConfiguration(@Nonnull Configuration configuration) {

		final Time rpcTimeout = AkkaUtils.getTimeoutAsTime(configuration);
		final Time slotIdleTimeout = Time.milliseconds(configuration.getLong(JobManagerOptions.SLOT_IDLE_TIMEOUT));
		final Time batchSlotTimeout = Time.milliseconds(configuration.getLong(JobManagerOptions.SLOT_REQUEST_TIMEOUT));

		return new DefaultSlotPoolFactory(
			SystemClock.getInstance(),
			rpcTimeout,
			slotIdleTimeout,
			batchSlotTimeout);
	}
 
Example 7
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 8
Source File: StandaloneResourceManagerFactory.java    From flink with Apache License 2.0 5 votes vote down vote up
@Override
protected ResourceManager<ResourceID> createResourceManager(
	Configuration configuration,
	ResourceID resourceId,
	RpcService rpcService,
	HighAvailabilityServices highAvailabilityServices,
	HeartbeatServices heartbeatServices,
	FatalErrorHandler fatalErrorHandler,
	ClusterInformation clusterInformation,
	@Nullable String webInterfaceUrl,
	ResourceManagerMetricGroup resourceManagerMetricGroup,
	ResourceManagerRuntimeServices resourceManagerRuntimeServices) {

	final Time standaloneClusterStartupPeriodTime = ConfigurationUtils.getStandaloneClusterStartupPeriodTime(configuration);

	return new StandaloneResourceManager(
		rpcService,
		resourceId,
		highAvailabilityServices,
		heartbeatServices,
		resourceManagerRuntimeServices.getSlotManager(),
		ResourceManagerPartitionTrackerImpl::new,
		resourceManagerRuntimeServices.getJobLeaderIdService(),
		clusterInformation,
		fatalErrorHandler,
		resourceManagerMetricGroup,
		standaloneClusterStartupPeriodTime,
		AkkaUtils.getTimeoutAsTime(configuration));
}
 
Example 9
Source File: SlotManagerConfiguration.java    From flink with Apache License 2.0 5 votes vote down vote up
public static SlotManagerConfiguration fromConfiguration(
		Configuration configuration,
		WorkerResourceSpec defaultWorkerResourceSpec) throws ConfigurationException {

	final Time rpcTimeout;
	try {
		rpcTimeout = AkkaUtils.getTimeoutAsTime(configuration);
	} catch (IllegalArgumentException e) {
		throw new ConfigurationException("Could not parse the resource manager's timeout " +
			"value " + AkkaOptions.ASK_TIMEOUT + '.', e);
	}

	final Time slotRequestTimeout = getSlotRequestTimeout(configuration);
	final Time taskManagerTimeout = Time.milliseconds(
			configuration.getLong(ResourceManagerOptions.TASK_MANAGER_TIMEOUT));

	boolean waitResultConsumedBeforeRelease =
		configuration.getBoolean(ResourceManagerOptions.TASK_MANAGER_RELEASE_WHEN_RESULT_CONSUMED);

	boolean evenlySpreadOutSlots = configuration.getBoolean(ClusterOptions.EVENLY_SPREAD_OUT_SLOTS_STRATEGY);
	final SlotMatchingStrategy slotMatchingStrategy = evenlySpreadOutSlots ?
		LeastUtilizationSlotMatchingStrategy.INSTANCE : AnyMatchingSlotMatchingStrategy.INSTANCE;

	int numSlotsPerWorker = configuration.getInteger(TaskManagerOptions.NUM_TASK_SLOTS);

	int maxSlotNum = configuration.getInteger(ResourceManagerOptions.MAX_SLOT_NUM);

	return new SlotManagerConfiguration(
		rpcTimeout,
		slotRequestTimeout,
		taskManagerTimeout,
		waitResultConsumedBeforeRelease,
		slotMatchingStrategy,
		defaultWorkerResourceSpec,
		numSlotsPerWorker,
		maxSlotNum);
}
 
Example 10
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 11
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 12
Source File: MesosResourceManager.java    From flink with Apache License 2.0 4 votes vote down vote up
public MesosResourceManager(
		// base class
		RpcService rpcService,
		ResourceID resourceId,
		HighAvailabilityServices highAvailabilityServices,
		HeartbeatServices heartbeatServices,
		SlotManager slotManager,
		ResourceManagerPartitionTrackerFactory clusterPartitionTrackerFactory,
		JobLeaderIdService jobLeaderIdService,
		ClusterInformation clusterInformation,
		FatalErrorHandler fatalErrorHandler,
		// Mesos specifics
		Configuration flinkConfig,
		MesosServices mesosServices,
		MesosConfiguration mesosConfig,
		MesosTaskManagerParameters taskManagerParameters,
		ContainerSpecification taskManagerContainerSpec,
		@Nullable String webUiUrl,
		ResourceManagerMetricGroup resourceManagerMetricGroup) {
	super(
		rpcService,
		resourceId,
		highAvailabilityServices,
		heartbeatServices,
		slotManager,
		clusterPartitionTrackerFactory,
		jobLeaderIdService,
		clusterInformation,
		fatalErrorHandler,
		resourceManagerMetricGroup,
		AkkaUtils.getTimeoutAsTime(flinkConfig));

	this.mesosServices = Preconditions.checkNotNull(mesosServices);
	this.actorSystem = Preconditions.checkNotNull(mesosServices.getLocalActorSystem());

	this.flinkConfig = Preconditions.checkNotNull(flinkConfig);
	this.mesosConfig = Preconditions.checkNotNull(mesosConfig);

	this.artifactServer = Preconditions.checkNotNull(mesosServices.getArtifactServer());

	this.taskManagerParameters = Preconditions.checkNotNull(taskManagerParameters);
	this.taskManagerContainerSpec = Preconditions.checkNotNull(taskManagerContainerSpec);
	this.webUiUrl = webUiUrl;

	this.workersInNew = new HashMap<>(8);
	this.workersInLaunch = new HashMap<>(8);
	this.workersBeingReturned = new HashMap<>(8);
}
 
Example 13
Source File: MiniClusterConfiguration.java    From flink with Apache License 2.0 4 votes vote down vote up
public Time getRpcTimeout() {
	return AkkaUtils.getTimeoutAsTime(configuration);
}
 
Example 14
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 15
Source File: AkkaRpcServiceConfiguration.java    From flink with Apache License 2.0 3 votes vote down vote up
public static AkkaRpcServiceConfiguration fromConfiguration(Configuration configuration) {
	final Time timeout = AkkaUtils.getTimeoutAsTime(configuration);

	final long maximumFramesize = AkkaRpcServiceUtils.extractMaximumFramesize(configuration);

	final boolean captureAskCallStacks = configuration.get(AkkaOptions.CAPTURE_ASK_CALLSTACK);

	return new AkkaRpcServiceConfiguration(configuration, timeout, maximumFramesize, captureAskCallStacks);
}