use of org.apache.flink.client.deployment.ClusterClientServiceLoader in project flink by apache.
the class RestClusterClientTest method testRESTManualConfigurationOverride.
/**
* 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();
final String manualHostname = "123.123.123.123";
final int manualPort = 4321;
final String[] args = { "-m", manualHostname + ':' + manualPort };
CommandLine commandLine = defaultCLI.parseCommandLineOptions(args, false);
final ClusterClientServiceLoader serviceLoader = new DefaultClusterClientServiceLoader();
final Configuration executorConfig = defaultCLI.toConfiguration(commandLine);
final ClusterClientFactory<StandaloneClusterId> clusterFactory = serviceLoader.getClusterClientFactory(executorConfig);
checkState(clusterFactory != null);
final ClusterDescriptor<StandaloneClusterId> clusterDescriptor = clusterFactory.createClusterDescriptor(executorConfig);
final RestClusterClient<?> clusterClient = (RestClusterClient<?>) clusterDescriptor.retrieve(clusterFactory.getClusterId(executorConfig)).getClusterClient();
URL webMonitorBaseUrl = clusterClient.getWebMonitorBaseUrl().get();
assertThat(webMonitorBaseUrl.getHost(), equalTo(manualHostname));
assertThat(webMonitorBaseUrl.getPort(), equalTo(manualPort));
}
use of org.apache.flink.client.deployment.ClusterClientServiceLoader in project flink by apache.
the class CliFrontendRunWithYarnTest method testRun.
@Test
public void testRun() throws Exception {
String testJarPath = getTestJarPath("BatchWordCount.jar").getAbsolutePath();
Configuration configuration = new Configuration();
configuration.setString(JobManagerOptions.ADDRESS, "localhost");
configuration.setInteger(JobManagerOptions.PORT, 8081);
configuration.set(TaskManagerOptions.TOTAL_FLINK_MEMORY, MemorySize.parse("1g"));
final ClusterClientServiceLoader testServiceLoader = new DefaultClusterClientServiceLoader();
final FlinkYarnSessionCli yarnCLI = new FlinkYarnSessionCli(configuration, testServiceLoader, tmp.getRoot().getAbsolutePath(), "y", "yarn", true);
// test detached mode
{
String[] parameters = { "-m", "yarn-cluster", "-p", "2", "-d", testJarPath };
verifyCliFrontend(configuration, testServiceLoader, yarnCLI, parameters, 2, true);
}
// test detached mode
{
String[] parameters = { "-m", "yarn-cluster", "-p", "2", "-yd", testJarPath };
verifyCliFrontend(configuration, testServiceLoader, yarnCLI, parameters, 2, true);
}
}
use of org.apache.flink.client.deployment.ClusterClientServiceLoader in project flink by apache.
the class KubernetesClusterClientFactoryTest method testKubernetesClusterClientFactoryDiscoveryHelper.
private void testKubernetesClusterClientFactoryDiscoveryHelper(final String targetName) {
final Configuration configuration = new Configuration();
configuration.setString(DeploymentOptions.TARGET, targetName);
final ClusterClientServiceLoader serviceLoader = new DefaultClusterClientServiceLoader();
final ClusterClientFactory<String> factory = serviceLoader.getClusterClientFactory(configuration);
assertTrue(factory instanceof KubernetesClusterClientFactory);
}
use of org.apache.flink.client.deployment.ClusterClientServiceLoader in project flink by apache.
the class YarnClusterClientFactoryTest method testYarnClusterClientFactoryDiscoveryHelper.
private void testYarnClusterClientFactoryDiscoveryHelper(final String targetName) {
final Configuration configuration = new Configuration();
configuration.setString(DeploymentOptions.TARGET, targetName);
final ClusterClientServiceLoader serviceLoader = new DefaultClusterClientServiceLoader();
final ClusterClientFactory<ApplicationId> factory = serviceLoader.getClusterClientFactory(configuration);
assertTrue(factory instanceof YarnClusterClientFactory);
}
Aggregations