org.apache.flink.runtime.entrypoint.parser.CommandLineParser Java Examples

The following examples show how to use org.apache.flink.runtime.entrypoint.parser.CommandLineParser. 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: TaskManagerRunner.java    From Flink-CEPplus with Apache License 2.0 6 votes vote down vote up
@VisibleForTesting
static Configuration loadConfiguration(String[] args) throws FlinkParseException {
	final CommandLineParser<ClusterConfiguration> commandLineParser = new CommandLineParser<>(new ClusterConfigurationParserFactory());

	final ClusterConfiguration clusterConfiguration;

	try {
		clusterConfiguration = commandLineParser.parse(args);
	} catch (FlinkParseException e) {
		LOG.error("Could not parse the command line options.", e);
		commandLineParser.printHelp(TaskManagerRunner.class.getSimpleName());
		throw e;
	}

	final Configuration dynamicProperties = ConfigurationUtils.createConfiguration(clusterConfiguration.getDynamicProperties());
	return GlobalConfiguration.loadConfiguration(clusterConfiguration.getConfigDir(), dynamicProperties);
}
 
Example #2
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 #3
Source File: TaskManagerRunner.java    From flink with Apache License 2.0 6 votes vote down vote up
@VisibleForTesting
static Configuration loadConfiguration(String[] args) throws FlinkParseException {
	final CommandLineParser<ClusterConfiguration> commandLineParser = new CommandLineParser<>(new ClusterConfigurationParserFactory());

	final ClusterConfiguration clusterConfiguration;

	try {
		clusterConfiguration = commandLineParser.parse(args);
	} catch (FlinkParseException e) {
		LOG.error("Could not parse the command line options.", e);
		commandLineParser.printHelp(TaskManagerRunner.class.getSimpleName());
		throw e;
	}

	final Configuration dynamicProperties = ConfigurationUtils.createConfiguration(clusterConfiguration.getDynamicProperties());
	return GlobalConfiguration.loadConfiguration(clusterConfiguration.getConfigDir(), dynamicProperties);
}
 
Example #4
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 #5
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 #6
Source File: ConfigurationParserUtils.java    From flink with Apache License 2.0 6 votes vote down vote up
/**
 * Generate configuration from only the config file and dynamic properties.
 * @param args the commandline arguments
 * @param cmdLineSyntax the syntax for this application
 * @return generated configuration
 * @throws FlinkParseException if the configuration cannot be generated
 */
public static Configuration loadCommonConfiguration(String[] args, String cmdLineSyntax) throws FlinkParseException {
	final CommandLineParser<ClusterConfiguration> commandLineParser = new CommandLineParser<>(new ClusterConfigurationParserFactory());

	final ClusterConfiguration clusterConfiguration;

	try {
		clusterConfiguration = commandLineParser.parse(args);
	} catch (FlinkParseException e) {
		LOG.error("Could not parse the command line options.", e);
		commandLineParser.printHelp(cmdLineSyntax);
		throw e;
	}

	final Configuration dynamicProperties = ConfigurationUtils.createConfiguration(clusterConfiguration.getDynamicProperties());
	return GlobalConfiguration.loadConfiguration(clusterConfiguration.getConfigDir(), dynamicProperties);
}
 
Example #7
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 #8
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 #9
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 #10
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 #11
Source File: ClusterEntrypoint.java    From Flink-CEPplus with Apache License 2.0 4 votes vote down vote up
protected static EntrypointClusterConfiguration parseArguments(String[] args) throws FlinkParseException {
	final CommandLineParser<EntrypointClusterConfiguration> clusterConfigurationParser = new CommandLineParser<>(new EntrypointClusterConfigurationParserFactory());

	return clusterConfigurationParser.parse(args);
}
 
Example #12
Source File: ClusterEntrypoint.java    From flink with Apache License 2.0 4 votes vote down vote up
protected static EntrypointClusterConfiguration parseArguments(String[] args) throws FlinkParseException {
	final CommandLineParser<EntrypointClusterConfiguration> clusterConfigurationParser = new CommandLineParser<>(new EntrypointClusterConfigurationParserFactory());

	return clusterConfigurationParser.parse(args);
}
 
Example #13
Source File: ClusterEntrypoint.java    From flink with Apache License 2.0 4 votes vote down vote up
protected static EntrypointClusterConfiguration parseArguments(String[] args) throws FlinkParseException {
	final CommandLineParser<EntrypointClusterConfiguration> clusterConfigurationParser = new CommandLineParser<>(new EntrypointClusterConfigurationParserFactory());

	return clusterConfigurationParser.parse(args);
}