org.apache.flink.runtime.util.JvmShutdownSafeguard Java Examples

The following examples show how to use org.apache.flink.runtime.util.JvmShutdownSafeguard. 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: MesosJobClusterEntrypoint.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {
	// startup checks and logging
	EnvironmentInformation.logEnvironmentInfo(LOG, MesosJobClusterEntrypoint.class.getSimpleName(), args);
	SignalHandler.register(LOG);
	JvmShutdownSafeguard.installAsShutdownHook(LOG);

	// load configuration incl. dynamic properties
	CommandLineParser parser = new PosixParser();
	CommandLine cmd;
	try {
		cmd = parser.parse(ALL_OPTIONS, args);
	}
	catch (Exception e){
		LOG.error("Could not parse the command-line options.", e);
		System.exit(STARTUP_FAILURE_RETURN_CODE);
		return;
	}

	Configuration dynamicProperties = BootstrapTools.parseDynamicProperties(cmd);
	Configuration configuration = MesosEntrypointUtils.loadConfiguration(dynamicProperties, LOG);

	MesosJobClusterEntrypoint clusterEntrypoint = new MesosJobClusterEntrypoint(configuration, dynamicProperties);

	ClusterEntrypoint.runClusterEntrypoint(clusterEntrypoint);
}
 
Example #2
Source File: StandaloneSessionClusterEntrypoint.java    From flink with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {
	// startup checks and logging
	EnvironmentInformation.logEnvironmentInfo(LOG, StandaloneSessionClusterEntrypoint.class.getSimpleName(), args);
	SignalHandler.register(LOG);
	JvmShutdownSafeguard.installAsShutdownHook(LOG);

	EntrypointClusterConfiguration entrypointClusterConfiguration = null;
	final CommandLineParser<EntrypointClusterConfiguration> commandLineParser = new CommandLineParser<>(new EntrypointClusterConfigurationParserFactory());

	try {
		entrypointClusterConfiguration = commandLineParser.parse(args);
	} catch (FlinkParseException e) {
		LOG.error("Could not parse command line arguments {}.", args, e);
		commandLineParser.printHelp(StandaloneSessionClusterEntrypoint.class.getSimpleName());
		System.exit(1);
	}

	Configuration configuration = loadConfiguration(entrypointClusterConfiguration);

	StandaloneSessionClusterEntrypoint entrypoint = new StandaloneSessionClusterEntrypoint(configuration);

	ClusterEntrypoint.runClusterEntrypoint(entrypoint);
}
 
Example #3
Source File: TaskManagerRunner.java    From flink with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
	// startup checks and logging
	EnvironmentInformation.logEnvironmentInfo(LOG, "TaskManager", args);
	SignalHandler.register(LOG);
	JvmShutdownSafeguard.installAsShutdownHook(LOG);

	long maxOpenFileHandles = EnvironmentInformation.getOpenFileHandlesLimit();

	if (maxOpenFileHandles != -1L) {
		LOG.info("Maximum number of open file descriptors is {}.", maxOpenFileHandles);
	} else {
		LOG.info("Cannot determine the maximum number of open file descriptors");
	}

	runTaskManagerSecurely(args);
}
 
Example #4
Source File: YarnJobClusterEntrypoint.java    From flink with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {
	// startup checks and logging
	EnvironmentInformation.logEnvironmentInfo(LOG, YarnJobClusterEntrypoint.class.getSimpleName(), args);
	SignalHandler.register(LOG);
	JvmShutdownSafeguard.installAsShutdownHook(LOG);

	Map<String, String> env = System.getenv();

	final String workingDirectory = env.get(ApplicationConstants.Environment.PWD.key());
	Preconditions.checkArgument(
		workingDirectory != null,
		"Working directory variable (%s) not set",
		ApplicationConstants.Environment.PWD.key());

	try {
		YarnEntrypointUtils.logYarnEnvironmentInformation(env, LOG);
	} catch (IOException e) {
		LOG.warn("Could not log YARN environment information.", e);
	}

	Configuration configuration = YarnEntrypointUtils.loadConfiguration(workingDirectory, env);

	YarnJobClusterEntrypoint yarnJobClusterEntrypoint = new YarnJobClusterEntrypoint(configuration);

	ClusterEntrypoint.runClusterEntrypoint(yarnJobClusterEntrypoint);
}
 
Example #5
Source File: YarnSessionClusterEntrypoint.java    From flink with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {
	// startup checks and logging
	EnvironmentInformation.logEnvironmentInfo(LOG, YarnSessionClusterEntrypoint.class.getSimpleName(), args);
	SignalHandler.register(LOG);
	JvmShutdownSafeguard.installAsShutdownHook(LOG);

	Map<String, String> env = System.getenv();

	final String workingDirectory = env.get(ApplicationConstants.Environment.PWD.key());
	Preconditions.checkArgument(
		workingDirectory != null,
		"Working directory variable (%s) not set",
		ApplicationConstants.Environment.PWD.key());

	try {
		YarnEntrypointUtils.logYarnEnvironmentInformation(env, LOG);
	} catch (IOException e) {
		LOG.warn("Could not log YARN environment information.", e);
	}

	Configuration configuration = YarnEntrypointUtils.loadConfiguration(workingDirectory, env);

	YarnSessionClusterEntrypoint yarnSessionClusterEntrypoint = new YarnSessionClusterEntrypoint(configuration);

	ClusterEntrypoint.runClusterEntrypoint(yarnSessionClusterEntrypoint);
}
 
Example #6
Source File: MesosJobClusterEntrypoint.java    From flink with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {
	// startup checks and logging
	EnvironmentInformation.logEnvironmentInfo(LOG, MesosJobClusterEntrypoint.class.getSimpleName(), args);
	SignalHandler.register(LOG);
	JvmShutdownSafeguard.installAsShutdownHook(LOG);

	// load configuration incl. dynamic properties
	CommandLineParser parser = new PosixParser();
	CommandLine cmd;
	try {
		cmd = parser.parse(ALL_OPTIONS, args);
	}
	catch (Exception e){
		LOG.error("Could not parse the command-line options.", e);
		System.exit(STARTUP_FAILURE_RETURN_CODE);
		return;
	}

	Configuration dynamicProperties = BootstrapTools.parseDynamicProperties(cmd);
	Configuration configuration = MesosUtils.loadConfiguration(dynamicProperties, LOG);

	MesosJobClusterEntrypoint clusterEntrypoint = new MesosJobClusterEntrypoint(configuration);

	ClusterEntrypoint.runClusterEntrypoint(clusterEntrypoint);
}
 
Example #7
Source File: MesosSessionClusterEntrypoint.java    From flink with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {
	// startup checks and logging
	EnvironmentInformation.logEnvironmentInfo(LOG, MesosSessionClusterEntrypoint.class.getSimpleName(), args);
	SignalHandler.register(LOG);
	JvmShutdownSafeguard.installAsShutdownHook(LOG);

	// load configuration incl. dynamic properties
	CommandLineParser parser = new PosixParser();
	CommandLine cmd;
	try {
		cmd = parser.parse(ALL_OPTIONS, args);
	}
	catch (Exception e){
		LOG.error("Could not parse the command-line options.", e);
		System.exit(STARTUP_FAILURE_RETURN_CODE);
		return;
	}

	Configuration dynamicProperties = BootstrapTools.parseDynamicProperties(cmd);
	Configuration configuration = MesosUtils.loadConfiguration(dynamicProperties, LOG);

	MesosSessionClusterEntrypoint clusterEntrypoint = new MesosSessionClusterEntrypoint(configuration);

	ClusterEntrypoint.runClusterEntrypoint(clusterEntrypoint);
}
 
Example #8
Source File: StandaloneSessionClusterEntrypoint.java    From flink with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {
	// startup checks and logging
	EnvironmentInformation.logEnvironmentInfo(LOG, StandaloneSessionClusterEntrypoint.class.getSimpleName(), args);
	SignalHandler.register(LOG);
	JvmShutdownSafeguard.installAsShutdownHook(LOG);

	EntrypointClusterConfiguration entrypointClusterConfiguration = null;
	final CommandLineParser<EntrypointClusterConfiguration> commandLineParser = new CommandLineParser<>(new EntrypointClusterConfigurationParserFactory());

	try {
		entrypointClusterConfiguration = commandLineParser.parse(args);
	} catch (FlinkParseException e) {
		LOG.error("Could not parse command line arguments {}.", args, e);
		commandLineParser.printHelp(StandaloneSessionClusterEntrypoint.class.getSimpleName());
		System.exit(1);
	}

	Configuration configuration = loadConfiguration(entrypointClusterConfiguration);

	StandaloneSessionClusterEntrypoint entrypoint = new StandaloneSessionClusterEntrypoint(configuration);

	ClusterEntrypoint.runClusterEntrypoint(entrypoint);
}
 
Example #9
Source File: MesosJobClusterEntrypoint.java    From flink with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {
	// startup checks and logging
	EnvironmentInformation.logEnvironmentInfo(LOG, MesosJobClusterEntrypoint.class.getSimpleName(), args);
	SignalHandler.register(LOG);
	JvmShutdownSafeguard.installAsShutdownHook(LOG);

	// load configuration incl. dynamic properties
	CommandLineParser parser = new PosixParser();
	CommandLine cmd;
	try {
		cmd = parser.parse(ALL_OPTIONS, args);
	}
	catch (Exception e){
		LOG.error("Could not parse the command-line options.", e);
		System.exit(STARTUP_FAILURE_RETURN_CODE);
		return;
	}

	Configuration dynamicProperties = BootstrapTools.parseDynamicProperties(cmd);
	Configuration configuration = MesosEntrypointUtils.loadConfiguration(dynamicProperties, LOG);

	MesosJobClusterEntrypoint clusterEntrypoint = new MesosJobClusterEntrypoint(configuration, dynamicProperties);

	ClusterEntrypoint.runClusterEntrypoint(clusterEntrypoint);
}
 
Example #10
Source File: MesosSessionClusterEntrypoint.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {
	// startup checks and logging
	EnvironmentInformation.logEnvironmentInfo(LOG, MesosSessionClusterEntrypoint.class.getSimpleName(), args);
	SignalHandler.register(LOG);
	JvmShutdownSafeguard.installAsShutdownHook(LOG);

	// load configuration incl. dynamic properties
	CommandLineParser parser = new PosixParser();
	CommandLine cmd;
	try {
		cmd = parser.parse(ALL_OPTIONS, args);
	}
	catch (Exception e){
		LOG.error("Could not parse the command-line options.", e);
		System.exit(STARTUP_FAILURE_RETURN_CODE);
		return;
	}

	Configuration dynamicProperties = BootstrapTools.parseDynamicProperties(cmd);
	Configuration configuration = MesosEntrypointUtils.loadConfiguration(dynamicProperties, LOG);

	MesosSessionClusterEntrypoint clusterEntrypoint = new MesosSessionClusterEntrypoint(configuration, dynamicProperties);

	ClusterEntrypoint.runClusterEntrypoint(clusterEntrypoint);
}
 
Example #11
Source File: StandaloneSessionClusterEntrypoint.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {
	// startup checks and logging
	EnvironmentInformation.logEnvironmentInfo(LOG, StandaloneSessionClusterEntrypoint.class.getSimpleName(), args);
	SignalHandler.register(LOG);
	JvmShutdownSafeguard.installAsShutdownHook(LOG);

	EntrypointClusterConfiguration entrypointClusterConfiguration = null;
	final CommandLineParser<EntrypointClusterConfiguration> commandLineParser = new CommandLineParser<>(new EntrypointClusterConfigurationParserFactory());

	try {
		entrypointClusterConfiguration = commandLineParser.parse(args);
	} catch (FlinkParseException e) {
		LOG.error("Could not parse command line arguments {}.", args, e);
		commandLineParser.printHelp(StandaloneSessionClusterEntrypoint.class.getSimpleName());
		System.exit(1);
	}

	Configuration configuration = loadConfiguration(entrypointClusterConfiguration);

	StandaloneSessionClusterEntrypoint entrypoint = new StandaloneSessionClusterEntrypoint(configuration);

	ClusterEntrypoint.runClusterEntrypoint(entrypoint);
}
 
Example #12
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 #13
Source File: StandaloneJobClusterEntryPoint.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
	// startup checks and logging
	EnvironmentInformation.logEnvironmentInfo(LOG, StandaloneJobClusterEntryPoint.class.getSimpleName(), args);
	SignalHandler.register(LOG);
	JvmShutdownSafeguard.installAsShutdownHook(LOG);

	final CommandLineParser<StandaloneJobClusterConfiguration> commandLineParser = new CommandLineParser<>(new StandaloneJobClusterConfigurationParserFactory());
	StandaloneJobClusterConfiguration clusterConfiguration = null;

	try {
		clusterConfiguration = commandLineParser.parse(args);
	} catch (Exception e) {
		LOG.error("Could not parse command line arguments {}.", args, e);
		commandLineParser.printHelp(StandaloneJobClusterEntryPoint.class.getSimpleName());
		System.exit(1);
	}

	Configuration configuration = loadConfiguration(clusterConfiguration);

	configuration.setString(ClusterEntrypoint.EXECUTION_MODE, ExecutionMode.DETACHED.toString());

	StandaloneJobClusterEntryPoint entrypoint = new StandaloneJobClusterEntryPoint(
		configuration,
		resolveJobIdForCluster(Optional.ofNullable(clusterConfiguration.getJobId()), configuration),
		clusterConfiguration.getSavepointRestoreSettings(),
		clusterConfiguration.getArgs(),
		clusterConfiguration.getJobClassName());

	ClusterEntrypoint.runClusterEntrypoint(entrypoint);
}
 
Example #14
Source File: YarnTaskExecutorRunner.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * The entry point for the YARN task executor runner.
 *
 * @param args The command line arguments.
 */
public static void main(String[] args) {
	EnvironmentInformation.logEnvironmentInfo(LOG, "YARN TaskExecutor runner", args);
	SignalHandler.register(LOG);
	JvmShutdownSafeguard.installAsShutdownHook(LOG);

	run(args);
}
 
Example #15
Source File: YarnSessionClusterEntrypoint.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
	// startup checks and logging
	EnvironmentInformation.logEnvironmentInfo(LOG, YarnSessionClusterEntrypoint.class.getSimpleName(), args);
	SignalHandler.register(LOG);
	JvmShutdownSafeguard.installAsShutdownHook(LOG);

	Map<String, String> env = System.getenv();

	final String workingDirectory = env.get(ApplicationConstants.Environment.PWD.key());
	Preconditions.checkArgument(
		workingDirectory != null,
		"Working directory variable (%s) not set",
		ApplicationConstants.Environment.PWD.key());

	try {
		YarnEntrypointUtils.logYarnEnvironmentInformation(env, LOG);
	} catch (IOException e) {
		LOG.warn("Could not log YARN environment information.", e);
	}

	Configuration configuration = YarnEntrypointUtils.loadConfiguration(workingDirectory, env, LOG);

	YarnSessionClusterEntrypoint yarnSessionClusterEntrypoint = new YarnSessionClusterEntrypoint(
		configuration,
		workingDirectory);

	ClusterEntrypoint.runClusterEntrypoint(yarnSessionClusterEntrypoint);
}
 
Example #16
Source File: YarnTaskExecutorRunner.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * The entry point for the YARN task executor runner.
 *
 * @param args The command line arguments.
 */
public static void main(String[] args) {
	EnvironmentInformation.logEnvironmentInfo(LOG, "YARN TaskExecutor runner", args);
	SignalHandler.register(LOG);
	JvmShutdownSafeguard.installAsShutdownHook(LOG);

	runTaskManagerSecurely(args);
}
 
Example #17
Source File: YarnJobClusterEntrypoint.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
	// startup checks and logging
	EnvironmentInformation.logEnvironmentInfo(LOG, YarnJobClusterEntrypoint.class.getSimpleName(), args);
	SignalHandler.register(LOG);
	JvmShutdownSafeguard.installAsShutdownHook(LOG);

	Map<String, String> env = System.getenv();

	final String workingDirectory = env.get(ApplicationConstants.Environment.PWD.key());
	Preconditions.checkArgument(
		workingDirectory != null,
		"Working directory variable (%s) not set",
		ApplicationConstants.Environment.PWD.key());

	try {
		YarnEntrypointUtils.logYarnEnvironmentInformation(env, LOG);
	} catch (IOException e) {
		LOG.warn("Could not log YARN environment information.", e);
	}

	Configuration configuration = YarnEntrypointUtils.loadConfiguration(workingDirectory, env, LOG);

	YarnJobClusterEntrypoint yarnJobClusterEntrypoint = new YarnJobClusterEntrypoint(
		configuration,
		workingDirectory);

	ClusterEntrypoint.runClusterEntrypoint(yarnJobClusterEntrypoint);
}
 
Example #18
Source File: TaskManagerRunner.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
	// startup checks and logging
	EnvironmentInformation.logEnvironmentInfo(LOG, "TaskManager", args);
	SignalHandler.register(LOG);
	JvmShutdownSafeguard.installAsShutdownHook(LOG);

	long maxOpenFileHandles = EnvironmentInformation.getOpenFileHandlesLimit();

	if (maxOpenFileHandles != -1L) {
		LOG.info("Maximum number of open file descriptors is {}.", maxOpenFileHandles);
	} else {
		LOG.info("Cannot determine the maximum number of open file descriptors");
	}

	final Configuration configuration = loadConfiguration(args);

	try {
		FileSystem.initialize(configuration);
	} catch (IOException e) {
		throw new IOException("Error while setting the default " +
			"filesystem scheme from configuration.", e);
	}

	SecurityUtils.install(new SecurityConfiguration(configuration));

	try {
		SecurityUtils.getInstalledContext().runSecured(new Callable<Void>() {
			@Override
			public Void call() throws Exception {
				runTaskManager(configuration, ResourceID.generate());
				return null;
			}
		});
	} catch (Throwable t) {
		final Throwable strippedThrowable = ExceptionUtils.stripException(t, UndeclaredThrowableException.class);
		LOG.error("TaskManager initialization failed.", strippedThrowable);
		System.exit(STARTUP_FAILURE_RETURN_CODE);
	}
}
 
Example #19
Source File: KubernetesSessionClusterEntrypoint.java    From flink with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
	// startup checks and logging
	EnvironmentInformation.logEnvironmentInfo(LOG, KubernetesSessionClusterEntrypoint.class.getSimpleName(), args);
	SignalHandler.register(LOG);
	JvmShutdownSafeguard.installAsShutdownHook(LOG);

	final ClusterEntrypoint entrypoint = new KubernetesSessionClusterEntrypoint(
		KubernetesEntrypointUtils.loadConfiguration());
	ClusterEntrypoint.runClusterEntrypoint(entrypoint);
}
 
Example #20
Source File: MesosSessionClusterEntrypoint.java    From flink with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
	// startup checks and logging
	EnvironmentInformation.logEnvironmentInfo(LOG, MesosSessionClusterEntrypoint.class.getSimpleName(), args);
	SignalHandler.register(LOG);
	JvmShutdownSafeguard.installAsShutdownHook(LOG);

	// load configuration incl. dynamic properties
	CommandLineParser parser = new PosixParser();
	CommandLine cmd;
	try {
		cmd = parser.parse(ALL_OPTIONS, args);
	}
	catch (Exception e){
		LOG.error("Could not parse the command-line options.", e);
		System.exit(STARTUP_FAILURE_RETURN_CODE);
		return;
	}

	Configuration dynamicProperties = BootstrapTools.parseDynamicProperties(cmd);
	Configuration configuration = MesosEntrypointUtils.loadConfiguration(dynamicProperties, LOG);

	MesosSessionClusterEntrypoint clusterEntrypoint = new MesosSessionClusterEntrypoint(configuration, dynamicProperties);

	ClusterEntrypoint.runClusterEntrypoint(clusterEntrypoint);
}
 
Example #21
Source File: StatefulFunctionsClusterEntryPoint.java    From flink-statefun with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
  EnvironmentInformation.logEnvironmentInfo(
      LOG, StatefulFunctionsClusterEntryPoint.class.getSimpleName(), args);
  SignalHandler.register(LOG);
  JvmShutdownSafeguard.installAsShutdownHook(LOG);

  final CommandLineParser<StatefulFunctionsClusterConfiguration> commandLineParser =
      new CommandLineParser<>(new StatefulFunctionsClusterConfigurationParserFactory());
  StatefulFunctionsClusterConfiguration clusterConfiguration = null;

  try {
    clusterConfiguration = commandLineParser.parse(args);
  } catch (Exception e) {
    LOG.error("Could not parse command line arguments {}.", args, e);
    commandLineParser.printHelp(StatefulFunctionsClusterEntryPoint.class.getSimpleName());
    System.exit(1);
  }

  Configuration configuration = loadConfiguration(clusterConfiguration);
  addStatefulFunctionsConfiguration(configuration);
  setDefaultExecutionModeIfNotConfigured(configuration);

  StatefulFunctionsClusterEntryPoint entrypoint =
      new StatefulFunctionsClusterEntryPoint(
          configuration,
          resolveJobIdForCluster(
              Optional.ofNullable(clusterConfiguration.getJobId()), configuration),
          clusterConfiguration.getSavepointRestoreSettings(),
          clusterConfiguration.getParallelism(),
          clusterConfiguration.getArgs());

  ClusterEntrypoint.runClusterEntrypoint(entrypoint);
}
 
Example #22
Source File: StatefulFunctionsClusterEntryPoint.java    From stateful-functions with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
  EnvironmentInformation.logEnvironmentInfo(
      LOG, StatefulFunctionsClusterEntryPoint.class.getSimpleName(), args);
  SignalHandler.register(LOG);
  JvmShutdownSafeguard.installAsShutdownHook(LOG);

  final CommandLineParser<StatefulFunctionsClusterConfiguration> commandLineParser =
      new CommandLineParser<>(new StatefulFunctionsClusterConfigurationParserFactory());
  StatefulFunctionsClusterConfiguration clusterConfiguration = null;

  try {
    clusterConfiguration = commandLineParser.parse(args);
  } catch (Exception e) {
    LOG.error("Could not parse command line arguments {}.", args, e);
    commandLineParser.printHelp(StatefulFunctionsClusterEntryPoint.class.getSimpleName());
    System.exit(1);
  }

  Configuration configuration = loadConfiguration(clusterConfiguration);
  addStatefulFunctionsConfiguration(configuration);
  setDefaultExecutionModeIfNotConfigured(configuration);

  StatefulFunctionsClusterEntryPoint entrypoint =
      new StatefulFunctionsClusterEntryPoint(
          configuration,
          resolveJobIdForCluster(
              Optional.ofNullable(clusterConfiguration.getJobId()), configuration),
          clusterConfiguration.getSavepointRestoreSettings(),
          clusterConfiguration.getArgs());

  ClusterEntrypoint.runClusterEntrypoint(entrypoint);
}
 
Example #23
Source File: TaskManagerRunner.java    From flink with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
	// startup checks and logging
	EnvironmentInformation.logEnvironmentInfo(LOG, "TaskManager", args);
	SignalHandler.register(LOG);
	JvmShutdownSafeguard.installAsShutdownHook(LOG);

	long maxOpenFileHandles = EnvironmentInformation.getOpenFileHandlesLimit();

	if (maxOpenFileHandles != -1L) {
		LOG.info("Maximum number of open file descriptors is {}.", maxOpenFileHandles);
	} else {
		LOG.info("Cannot determine the maximum number of open file descriptors");
	}

	final Configuration configuration = loadConfiguration(args);

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

	SecurityUtils.install(new SecurityConfiguration(configuration));

	try {
		SecurityUtils.getInstalledContext().runSecured(new Callable<Void>() {
			@Override
			public Void call() throws Exception {
				runTaskManager(configuration, ResourceID.generate());
				return null;
			}
		});
	} catch (Throwable t) {
		final Throwable strippedThrowable = ExceptionUtils.stripException(t, UndeclaredThrowableException.class);
		LOG.error("TaskManager initialization failed.", strippedThrowable);
		System.exit(STARTUP_FAILURE_RETURN_CODE);
	}
}
 
Example #24
Source File: YarnJobClusterEntrypoint.java    From flink with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
	// startup checks and logging
	EnvironmentInformation.logEnvironmentInfo(LOG, YarnJobClusterEntrypoint.class.getSimpleName(), args);
	SignalHandler.register(LOG);
	JvmShutdownSafeguard.installAsShutdownHook(LOG);

	Map<String, String> env = System.getenv();

	final String workingDirectory = env.get(ApplicationConstants.Environment.PWD.key());
	Preconditions.checkArgument(
		workingDirectory != null,
		"Working directory variable (%s) not set",
		ApplicationConstants.Environment.PWD.key());

	try {
		YarnEntrypointUtils.logYarnEnvironmentInformation(env, LOG);
	} catch (IOException e) {
		LOG.warn("Could not log YARN environment information.", e);
	}

	Configuration configuration = YarnEntrypointUtils.loadConfiguration(workingDirectory, env, LOG);

	YarnJobClusterEntrypoint yarnJobClusterEntrypoint = new YarnJobClusterEntrypoint(
		configuration,
		workingDirectory);

	ClusterEntrypoint.runClusterEntrypoint(yarnJobClusterEntrypoint);
}
 
Example #25
Source File: YarnSessionClusterEntrypoint.java    From flink with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
	// startup checks and logging
	EnvironmentInformation.logEnvironmentInfo(LOG, YarnSessionClusterEntrypoint.class.getSimpleName(), args);
	SignalHandler.register(LOG);
	JvmShutdownSafeguard.installAsShutdownHook(LOG);

	Map<String, String> env = System.getenv();

	final String workingDirectory = env.get(ApplicationConstants.Environment.PWD.key());
	Preconditions.checkArgument(
		workingDirectory != null,
		"Working directory variable (%s) not set",
		ApplicationConstants.Environment.PWD.key());

	try {
		YarnEntrypointUtils.logYarnEnvironmentInformation(env, LOG);
	} catch (IOException e) {
		LOG.warn("Could not log YARN environment information.", e);
	}

	Configuration configuration = YarnEntrypointUtils.loadConfiguration(workingDirectory, env, LOG);

	YarnSessionClusterEntrypoint yarnSessionClusterEntrypoint = new YarnSessionClusterEntrypoint(
		configuration,
		workingDirectory);

	ClusterEntrypoint.runClusterEntrypoint(yarnSessionClusterEntrypoint);
}
 
Example #26
Source File: YarnTaskExecutorRunner.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * The entry point for the YARN task executor runner.
 *
 * @param args The command line arguments.
 */
public static void main(String[] args) {
	EnvironmentInformation.logEnvironmentInfo(LOG, "YARN TaskExecutor runner", args);
	SignalHandler.register(LOG);
	JvmShutdownSafeguard.installAsShutdownHook(LOG);

	run(args);
}
 
Example #27
Source File: StandaloneJobClusterEntryPoint.java    From flink with Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) {
	// startup checks and logging
	EnvironmentInformation.logEnvironmentInfo(LOG, StandaloneJobClusterEntryPoint.class.getSimpleName(), args);
	SignalHandler.register(LOG);
	JvmShutdownSafeguard.installAsShutdownHook(LOG);

	final CommandLineParser<StandaloneJobClusterConfiguration> commandLineParser = new CommandLineParser<>(new StandaloneJobClusterConfigurationParserFactory());
	StandaloneJobClusterConfiguration clusterConfiguration = null;

	try {
		clusterConfiguration = commandLineParser.parse(args);
	} catch (Exception e) {
		LOG.error("Could not parse command line arguments {}.", args, e);
		commandLineParser.printHelp(StandaloneJobClusterEntryPoint.class.getSimpleName());
		System.exit(1);
	}

	Configuration configuration = loadConfiguration(clusterConfiguration);
	setDefaultExecutionModeIfNotConfigured(configuration);

	StandaloneJobClusterEntryPoint entrypoint = new StandaloneJobClusterEntryPoint(
		configuration,
		resolveJobIdForCluster(Optional.ofNullable(clusterConfiguration.getJobId()), configuration),
		clusterConfiguration.getSavepointRestoreSettings(),
		clusterConfiguration.getArgs(),
		clusterConfiguration.getJobClassName());

	ClusterEntrypoint.runClusterEntrypoint(entrypoint);
}