Search in sources :

Example 1 with ClusterConfigurationParserFactory

use of org.apache.flink.runtime.entrypoint.ClusterConfigurationParserFactory in project flink by apache.

the class ConfigurationParserUtils method loadCommonConfiguration.

/**
 * 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);
}
Also used : FlinkParseException(org.apache.flink.runtime.entrypoint.FlinkParseException) Configuration(org.apache.flink.configuration.Configuration) ClusterConfiguration(org.apache.flink.runtime.entrypoint.ClusterConfiguration) GlobalConfiguration(org.apache.flink.configuration.GlobalConfiguration) ClusterConfigurationParserFactory(org.apache.flink.runtime.entrypoint.ClusterConfigurationParserFactory) ClusterConfiguration(org.apache.flink.runtime.entrypoint.ClusterConfiguration) CommandLineParser(org.apache.flink.runtime.entrypoint.parser.CommandLineParser)

Aggregations

Configuration (org.apache.flink.configuration.Configuration)1 GlobalConfiguration (org.apache.flink.configuration.GlobalConfiguration)1 ClusterConfiguration (org.apache.flink.runtime.entrypoint.ClusterConfiguration)1 ClusterConfigurationParserFactory (org.apache.flink.runtime.entrypoint.ClusterConfigurationParserFactory)1 FlinkParseException (org.apache.flink.runtime.entrypoint.FlinkParseException)1 CommandLineParser (org.apache.flink.runtime.entrypoint.parser.CommandLineParser)1