Search in sources :

Example 1 with ApplicationClusterDeployer

use of org.apache.flink.client.deployment.application.cli.ApplicationClusterDeployer in project flink by apache.

the class CliFrontend method runApplication.

// --------------------------------------------------------------------------------------------
// Execute Actions
// --------------------------------------------------------------------------------------------
protected void runApplication(String[] args) throws Exception {
    LOG.info("Running 'run-application' command.");
    final Options commandOptions = CliFrontendParser.getRunCommandOptions();
    final CommandLine commandLine = getCommandLine(commandOptions, args, true);
    if (commandLine.hasOption(HELP_OPTION.getOpt())) {
        CliFrontendParser.printHelpForRunApplication(customCommandLines);
        return;
    }
    final CustomCommandLine activeCommandLine = validateAndGetActiveCommandLine(checkNotNull(commandLine));
    final ApplicationDeployer deployer = new ApplicationClusterDeployer(clusterClientServiceLoader);
    final ProgramOptions programOptions;
    final Configuration effectiveConfiguration;
    // No need to set a jarFile path for Pyflink job.
    if (ProgramOptionsUtils.isPythonEntryPoint(commandLine)) {
        programOptions = ProgramOptionsUtils.createPythonProgramOptions(commandLine);
        effectiveConfiguration = getEffectiveConfiguration(activeCommandLine, commandLine, programOptions, Collections.emptyList());
    } else {
        programOptions = new ProgramOptions(commandLine);
        programOptions.validate();
        final URI uri = PackagedProgramUtils.resolveURI(programOptions.getJarFilePath());
        effectiveConfiguration = getEffectiveConfiguration(activeCommandLine, commandLine, programOptions, Collections.singletonList(uri.toString()));
    }
    final ApplicationConfiguration applicationConfiguration = new ApplicationConfiguration(programOptions.getProgramArgs(), programOptions.getEntryPointClassName());
    deployer.run(effectiveConfiguration, applicationConfiguration);
}
Also used : JobManagerOptions(org.apache.flink.configuration.JobManagerOptions) Options(org.apache.commons.cli.Options) RestOptions(org.apache.flink.configuration.RestOptions) CoreOptions(org.apache.flink.configuration.CoreOptions) CommandLine(org.apache.commons.cli.CommandLine) ApplicationConfiguration(org.apache.flink.client.deployment.application.ApplicationConfiguration) SecurityConfiguration(org.apache.flink.runtime.security.SecurityConfiguration) Configuration(org.apache.flink.configuration.Configuration) GlobalConfiguration(org.apache.flink.configuration.GlobalConfiguration) ApplicationClusterDeployer(org.apache.flink.client.deployment.application.cli.ApplicationClusterDeployer) URI(java.net.URI) ApplicationConfiguration(org.apache.flink.client.deployment.application.ApplicationConfiguration)

Aggregations

URI (java.net.URI)1 CommandLine (org.apache.commons.cli.CommandLine)1 Options (org.apache.commons.cli.Options)1 ApplicationConfiguration (org.apache.flink.client.deployment.application.ApplicationConfiguration)1 ApplicationClusterDeployer (org.apache.flink.client.deployment.application.cli.ApplicationClusterDeployer)1 Configuration (org.apache.flink.configuration.Configuration)1 CoreOptions (org.apache.flink.configuration.CoreOptions)1 GlobalConfiguration (org.apache.flink.configuration.GlobalConfiguration)1 JobManagerOptions (org.apache.flink.configuration.JobManagerOptions)1 RestOptions (org.apache.flink.configuration.RestOptions)1 SecurityConfiguration (org.apache.flink.runtime.security.SecurityConfiguration)1