org.apache.flink.runtime.taskexecutor.TaskManagerRunner Java Examples

The following examples show how to use org.apache.flink.runtime.taskexecutor.TaskManagerRunner. 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: MiniCluster.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@VisibleForTesting
void startTaskExecutor() throws Exception {
	synchronized (lock) {
		final Configuration configuration = miniClusterConfiguration.getConfiguration();

		final TaskExecutor taskExecutor = TaskManagerRunner.startTaskManager(
			configuration,
			new ResourceID(UUID.randomUUID().toString()),
			taskManagerRpcServiceFactory.createRpcService(),
			haServices,
			heartbeatServices,
			metricRegistry,
			blobCacheService,
			useLocalCommunication(),
			taskManagerTerminatingFatalErrorHandlerFactory.create(taskManagers.size()));

		taskExecutor.start();
		taskManagers.add(taskExecutor);
	}
}
 
Example #2
Source File: MiniCluster.java    From flink with Apache License 2.0 6 votes vote down vote up
@VisibleForTesting
void startTaskExecutor() throws Exception {
	synchronized (lock) {
		final Configuration configuration = miniClusterConfiguration.getConfiguration();

		final TaskExecutor taskExecutor = TaskManagerRunner.startTaskManager(
			configuration,
			new ResourceID(UUID.randomUUID().toString()),
			taskManagerRpcServiceFactory.createRpcService(),
			haServices,
			heartbeatServices,
			metricRegistry,
			blobCacheService,
			useLocalCommunication(),
			taskManagerTerminatingFatalErrorHandlerFactory.create(taskManagers.size()));

		taskExecutor.start();
		taskManagers.add(taskExecutor);
	}
}
 
Example #3
Source File: MiniCluster.java    From flink with Apache License 2.0 6 votes vote down vote up
@VisibleForTesting
void startTaskExecutor() throws Exception {
	synchronized (lock) {
		final Configuration configuration = miniClusterConfiguration.getConfiguration();

		final TaskExecutor taskExecutor = TaskManagerRunner.startTaskManager(
			configuration,
			new ResourceID(UUID.randomUUID().toString()),
			taskManagerRpcServiceFactory.createRpcService(),
			haServices,
			heartbeatServices,
			metricRegistry,
			blobCacheService,
			useLocalCommunication(),
			ExternalResourceInfoProvider.NO_EXTERNAL_RESOURCES,
			taskManagerTerminatingFatalErrorHandlerFactory.create(taskManagers.size()));

		taskExecutor.start();
		taskManagers.add(taskExecutor);
	}
}
 
Example #4
Source File: AbstractTaskManagerProcessFailureRecoveryTest.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
	try {
		final ParameterTool parameterTool = ParameterTool.fromArgs(args);
		Configuration cfg = parameterTool.getConfiguration();

		TaskManagerRunner.runTaskManager(cfg, ResourceID.generate());
	}
	catch (Throwable t) {
		LOG.error("Failed to start TaskManager process", t);
		System.exit(1);
	}
}
 
Example #5
Source File: YarnTaskExecutorRunner.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * The instance entry point for the YARN task executor. Obtains user group information and calls
 * the main work method {@link TaskManagerRunner#runTaskManager(Configuration, ResourceID)}  as a
 * privileged action.
 *
 * @param args The command line arguments.
 */
private static void run(String[] args) {
	try {
		LOG.debug("All environment variables: {}", ENV);

		final String currDir = ENV.get(Environment.PWD.key());
		LOG.info("Current working Directory: {}", currDir);

		final Configuration configuration = GlobalConfiguration.loadConfiguration(currDir);
		FileSystem.initialize(configuration);

		setupConfigurationAndInstallSecurityContext(configuration, currDir, ENV);

		final String containerId = ENV.get(YarnResourceManager.ENV_FLINK_CONTAINER_ID);
		Preconditions.checkArgument(containerId != null,
			"ContainerId variable %s not set", YarnResourceManager.ENV_FLINK_CONTAINER_ID);

		SecurityUtils.getInstalledContext().runSecured((Callable<Void>) () -> {
			TaskManagerRunner.runTaskManager(configuration, new ResourceID(containerId));
			return null;
		});
	}
	catch (Throwable t) {
		final Throwable strippedThrowable = ExceptionUtils.stripException(t, UndeclaredThrowableException.class);
		// make sure that everything whatever ends up in the log
		LOG.error("YARN TaskManager initialization failed.", strippedThrowable);
		System.exit(INIT_ERROR_EXIT_CODE);
	}
}
 
Example #6
Source File: AbstractTaskManagerProcessFailureRecoveryTest.java    From flink with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
	try {
		final ParameterTool parameterTool = ParameterTool.fromArgs(args);
		Configuration cfg = parameterTool.getConfiguration();

		TaskManagerRunner.runTaskManager(cfg, ResourceID.generate());
	}
	catch (Throwable t) {
		LOG.error("Failed to start TaskManager process", t);
		System.exit(1);
	}
}
 
Example #7
Source File: YarnTaskExecutorRunner.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * The instance entry point for the YARN task executor. Obtains user group information and calls
 * the main work method {@link TaskManagerRunner#runTaskManager(Configuration, ResourceID)}  as a
 * privileged action.
 *
 * @param args The command line arguments.
 */
private static void run(String[] args) {
	try {
		LOG.debug("All environment variables: {}", ENV);

		final String currDir = ENV.get(Environment.PWD.key());
		LOG.info("Current working Directory: {}", currDir);

		final Configuration configuration = GlobalConfiguration.loadConfiguration(currDir);

		FileSystem.initialize(configuration, PluginUtils.createPluginManagerFromRootFolder(configuration));

		setupConfigurationAndInstallSecurityContext(configuration, currDir, ENV);

		final String containerId = ENV.get(YarnResourceManager.ENV_FLINK_CONTAINER_ID);
		Preconditions.checkArgument(containerId != null,
			"ContainerId variable %s not set", YarnResourceManager.ENV_FLINK_CONTAINER_ID);

		SecurityUtils.getInstalledContext().runSecured((Callable<Void>) () -> {
			TaskManagerRunner.runTaskManager(configuration, new ResourceID(containerId));
			return null;
		});
	}
	catch (Throwable t) {
		final Throwable strippedThrowable = ExceptionUtils.stripException(t, UndeclaredThrowableException.class);
		// make sure that everything whatever ends up in the log
		LOG.error("YARN TaskManager initialization failed.", strippedThrowable);
		System.exit(INIT_ERROR_EXIT_CODE);
	}
}
 
Example #8
Source File: AbstractTaskManagerProcessFailureRecoveryTest.java    From flink with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
	try {
		final ParameterTool parameterTool = ParameterTool.fromArgs(args);
		Configuration cfg = parameterTool.getConfiguration();
		final PluginManager pluginManager = PluginUtils.createPluginManagerFromRootFolder(cfg);

		TaskManagerRunner.runTaskManager(cfg, pluginManager);
	}
	catch (Throwable t) {
		LOG.error("Failed to start TaskManager process", t);
		System.exit(1);
	}
}
 
Example #9
Source File: KubernetesTaskExecutorRunner.java    From flink with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
	EnvironmentInformation.logEnvironmentInfo(LOG, "Kubernetes TaskExecutor runner", args);
	SignalHandler.register(LOG);
	JvmShutdownSafeguard.installAsShutdownHook(LOG);

	TaskManagerRunner.runTaskManagerSecurely(args);
}
 
Example #10
Source File: YarnTaskExecutorRunner.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * The instance entry point for the YARN task executor. Obtains user group information and calls
 * the main work method {@link TaskManagerRunner#runTaskManager(Configuration, PluginManager)} as a
 * privileged action.
 *
 * @param args The command line arguments.
 */
private static void runTaskManagerSecurely(String[] args) {
	try {
		LOG.debug("All environment variables: {}", ENV);

		final String currDir = ENV.get(Environment.PWD.key());
		LOG.info("Current working Directory: {}", currDir);

		final Configuration configuration = TaskManagerRunner.loadConfiguration(args);

		final PluginManager pluginManager = PluginUtils.createPluginManagerFromRootFolder(configuration);

		FileSystem.initialize(configuration, pluginManager);

		setupConfigurationAndInstallSecurityContext(configuration, currDir, ENV);

		SecurityUtils.getInstalledContext().runSecured((Callable<Void>) () -> {
			TaskManagerRunner.runTaskManager(configuration, pluginManager);
			return null;
		});
	}
	catch (Throwable t) {
		final Throwable strippedThrowable = ExceptionUtils.stripException(t, UndeclaredThrowableException.class);
		// make sure that everything whatever ends up in the log
		LOG.error("YARN TaskManager initialization failed.", strippedThrowable);
		System.exit(INIT_ERROR_EXIT_CODE);
	}
}
 
Example #11
Source File: TaskManagerLoadingDynamicPropertiesITCase.java    From flink with Apache License 2.0 4 votes vote down vote up
public static void main(String[] args) throws FlinkParseException {
	final Configuration flinkConfig = TaskManagerRunner.loadConfiguration(args);
	assertThat(
		flinkConfig.toMap().values(),
		Matchers.containsInAnyOrder(VALUE_A, VALUE_B, VALUE_C, VALUE_D, VALUE_E, VALUE_F));
}