Search in sources :

Example 6 with Executor

use of org.apache.flink.table.client.gateway.Executor in project flink by apache.

the class DefaultContext method createExecutionConfig.

private static Configuration createExecutionConfig(CommandLine commandLine, Options commandLineOptions, List<CustomCommandLine> availableCommandLines, List<URL> dependencies) throws FlinkException {
    LOG.debug("Available commandline options: {}", commandLineOptions);
    List<String> options = Stream.of(commandLine.getOptions()).map(o -> o.getOpt() + "=" + o.getValue()).collect(Collectors.toList());
    LOG.debug("Instantiated commandline args: {}, options: {}", commandLine.getArgList(), options);
    final CustomCommandLine activeCommandLine = findActiveCommandLine(availableCommandLines, commandLine);
    LOG.debug("Available commandlines: {}, active commandline: {}", availableCommandLines, activeCommandLine);
    Configuration executionConfig = activeCommandLine.toConfiguration(commandLine);
    try {
        final ProgramOptions programOptions = ProgramOptions.create(commandLine);
        final ExecutionConfigAccessor executionConfigAccessor = ExecutionConfigAccessor.fromProgramOptions(programOptions, dependencies);
        executionConfigAccessor.applyToConfiguration(executionConfig);
    } catch (CliArgsException e) {
        throw new SqlExecutionException("Invalid deployment run options.", e);
    }
    LOG.info("Executor config: {}", executionConfig);
    return executionConfig;
}
Also used : Executor(org.apache.flink.table.client.gateway.Executor) FlinkException(org.apache.flink.util.FlinkException) CliFrontendParser(org.apache.flink.client.cli.CliFrontendParser) Logger(org.slf4j.Logger) CliArgsException(org.apache.flink.client.cli.CliArgsException) ProgramOptions(org.apache.flink.client.cli.ProgramOptions) URL(java.net.URL) CustomCommandLine(org.apache.flink.client.cli.CustomCommandLine) ExecutionConfigAccessor(org.apache.flink.client.cli.ExecutionConfigAccessor) Configuration(org.apache.flink.configuration.Configuration) Options(org.apache.commons.cli.Options) LoggerFactory(org.slf4j.LoggerFactory) SqlExecutionException(org.apache.flink.table.client.gateway.SqlExecutionException) Collectors(java.util.stream.Collectors) List(java.util.List) Stream(java.util.stream.Stream) FileSystem(org.apache.flink.core.fs.FileSystem) PluginUtils(org.apache.flink.core.plugin.PluginUtils) CommandLine(org.apache.commons.cli.CommandLine) CustomCommandLine(org.apache.flink.client.cli.CustomCommandLine) SqlExecutionException(org.apache.flink.table.client.gateway.SqlExecutionException) Configuration(org.apache.flink.configuration.Configuration) ExecutionConfigAccessor(org.apache.flink.client.cli.ExecutionConfigAccessor) CliArgsException(org.apache.flink.client.cli.CliArgsException) ProgramOptions(org.apache.flink.client.cli.ProgramOptions)

Aggregations

Executor (org.apache.flink.table.client.gateway.Executor)6 URL (java.net.URL)3 Test (org.junit.Test)3 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Configuration (org.apache.flink.configuration.Configuration)2 ResultDescriptor (org.apache.flink.table.client.gateway.ResultDescriptor)2 DefaultContext (org.apache.flink.table.client.gateway.context.DefaultContext)2 LocalExecutor (org.apache.flink.table.client.gateway.local.LocalExecutor)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 InputStream (java.io.InputStream)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Stream (java.util.stream.Stream)1 CommandLine (org.apache.commons.cli.CommandLine)1 Options (org.apache.commons.cli.Options)1 CliArgsException (org.apache.flink.client.cli.CliArgsException)1 CliFrontendParser (org.apache.flink.client.cli.CliFrontendParser)1 CustomCommandLine (org.apache.flink.client.cli.CustomCommandLine)1