static AbstractCustomCommandLine<?> getCli(Configuration configuration) { return new DefaultCLI(configuration); } }
public static List<CustomCommandLine<?>> loadCustomCommandLines(Configuration configuration, String configurationDirectory) { List<CustomCommandLine<?>> customCommandLines = new ArrayList<>(2); // Command line interface of the YARN session, with a special initialization here // to prefix all options with y/yarn. // Tips: DefaultCLI must be added at last, because getActiveCustomCommandLine(..) will get the // active CustomCommandLine in order and DefaultCLI isActive always return true. final String flinkYarnSessionCLI = "org.apache.flink.yarn.cli.FlinkYarnSessionCli"; try { customCommandLines.add( loadCustomCommandLine(flinkYarnSessionCLI, configuration, configurationDirectory, "y", "yarn")); } catch (NoClassDefFoundError | Exception e) { LOG.warn("Could not load CLI class {}.", flinkYarnSessionCLI, e); } customCommandLines.add(new DefaultCLI(configuration)); return customCommandLines; }
@Before public void setup() throws Exception { final Configuration configuration = new Configuration(); frontend = new CliFrontend( configuration, Collections.singletonList(new DefaultCLI(configuration))); }
/** * Tests that command line options override the configuration settings. */ @Test public void testRESTManualConfigurationOverride() throws Exception { final String configuredHostname = "localhost"; final int configuredPort = 1234; final Configuration configuration = new Configuration(); configuration.setString(JobManagerOptions.ADDRESS, configuredHostname); configuration.setInteger(JobManagerOptions.PORT, configuredPort); configuration.setString(RestOptions.ADDRESS, configuredHostname); configuration.setInteger(RestOptions.PORT, configuredPort); final DefaultCLI defaultCLI = new DefaultCLI(configuration); final String manualHostname = "123.123.123.123"; final int manualPort = 4321; final String[] args = {"-m", manualHostname + ':' + manualPort}; CommandLine commandLine = defaultCLI.parseCommandLineOptions(args, false); final StandaloneClusterDescriptor clusterDescriptor = defaultCLI.createClusterDescriptor(commandLine); final RestClusterClient<?> clusterClient = clusterDescriptor.retrieve(defaultCLI.getClusterId(commandLine)); URL webMonitorBaseUrl = clusterClient.getWebMonitorBaseUrl().get(); assertThat(webMonitorBaseUrl.getHost(), equalTo(manualHostname)); assertThat(webMonitorBaseUrl.getPort(), equalTo(manualPort)); }
public static List<CustomCommandLine<?>> loadCustomCommandLines(Configuration configuration, String configurationDirectory) { List<CustomCommandLine<?>> customCommandLines = new ArrayList<>(2); // Command line interface of the YARN session, with a special initialization here // to prefix all options with y/yarn. // Tips: DefaultCLI must be added at last, because getActiveCustomCommandLine(..) will get the // active CustomCommandLine in order and DefaultCLI isActive always return true. final String flinkYarnSessionCLI = "org.apache.flink.yarn.cli.FlinkYarnSessionCli"; try { customCommandLines.add( loadCustomCommandLine(flinkYarnSessionCLI, configuration, configurationDirectory, "y", "yarn")); } catch (NoClassDefFoundError | Exception e) { LOG.warn("Could not load CLI class {}.", flinkYarnSessionCLI, e); } customCommandLines.add(new DefaultCLI(configuration)); return customCommandLines; }
customCommandLines.add(new DefaultCLI(configuration)); } else { customCommandLines.add(new LegacyCLI(configuration));