Java Code Examples for org.apache.flink.runtime.util.EnvironmentInformation#logEnvironmentInfo()

The following examples show how to use org.apache.flink.runtime.util.EnvironmentInformation#logEnvironmentInfo() . 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: 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 4
Source File: FlinkZooKeeperQuorumPeer.java    From flink with Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {
	try {
		// startup checks and logging
		EnvironmentInformation.logEnvironmentInfo(LOG, "ZooKeeper Quorum Peer", args);
		
		final ParameterTool params = ParameterTool.fromArgs(args);
		final String zkConfigFile = params.getRequired("zkConfigFile");
		final int peerId = params.getInt("peerId");

		// Run quorum peer
		runFlinkZkQuorumPeer(zkConfigFile, peerId);
	}
	catch (Throwable t) {
		LOG.error("Error running ZooKeeper quorum peer: " + t.getMessage(), t);
		System.exit(-1);
	}
}
 
Example 5
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 6
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 7
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 8
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 9
Source File: CliFrontend.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Submits the job based on the arguments.
 */
public static void main(final String[] args) {
	EnvironmentInformation.logEnvironmentInfo(LOG, "Command Line Client", args);

	// 1. find the configuration directory
	final String configurationDirectory = getConfigurationDirectoryFromEnv();

	// 2. load the global configuration
	final Configuration configuration = GlobalConfiguration.loadConfiguration(configurationDirectory);

	// 3. load the custom command lines
	final List<CustomCommandLine<?>> customCommandLines = loadCustomCommandLines(
		configuration,
		configurationDirectory);

	try {
		final CliFrontend cli = new CliFrontend(
			configuration,
			customCommandLines);

		SecurityUtils.install(new SecurityConfiguration(cli.configuration));
		int retCode = SecurityUtils.getInstalledContext()
				.runSecured(() -> cli.parseParameters(args));
		System.exit(retCode);
	}
	catch (Throwable t) {
		final Throwable strippedThrowable = ExceptionUtils.stripException(t, UndeclaredThrowableException.class);
		LOG.error("Fatal error while running command line interface.", strippedThrowable);
		strippedThrowable.printStackTrace();
		System.exit(31);
	}
}
 
Example 10
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 11
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 12
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 13
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);
}
 
Example 14
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 15
Source File: CliFrontend.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Submits the job based on the arguments.
 */
public static void main(final String[] args) {
	EnvironmentInformation.logEnvironmentInfo(LOG, "Command Line Client", args);

	// 1. find the configuration directory
	final String configurationDirectory = getConfigurationDirectoryFromEnv();

	// 2. load the global configuration
	final Configuration configuration = GlobalConfiguration.loadConfiguration(configurationDirectory);

	// 3. load the custom command lines
	final List<CustomCommandLine<?>> customCommandLines = loadCustomCommandLines(
		configuration,
		configurationDirectory);

	try {
		final CliFrontend cli = new CliFrontend(
			configuration,
			customCommandLines);

		SecurityUtils.install(new SecurityConfiguration(cli.configuration));
		int retCode = SecurityUtils.getInstalledContext()
				.runSecured(() -> cli.parseParameters(args));
		System.exit(retCode);
	}
	catch (Throwable t) {
		final Throwable strippedThrowable = ExceptionUtils.stripException(t, UndeclaredThrowableException.class);
		LOG.error("Fatal error while running command line interface.", strippedThrowable);
		strippedThrowable.printStackTrace();
		System.exit(31);
	}
}
 
Example 16
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 17
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 18
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 19
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 20
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);
}