Search in sources :

Example 1 with ClusterSpecification

use of org.apache.flink.client.deployment.ClusterSpecification in project flink by apache.

the class Fabric8FlinkKubeClientTest method onSetup.

@Override
protected void onSetup() throws Exception {
    super.onSetup();
    KubernetesTestUtils.createTemporyFile("some data", flinkConfDir, CONFIG_FILE_LOGBACK_NAME);
    KubernetesTestUtils.createTemporyFile("some data", flinkConfDir, CONFIG_FILE_LOG4J_NAME);
    final ClusterSpecification clusterSpecification = new ClusterSpecification.ClusterSpecificationBuilder().setMasterMemoryMB(JOB_MANAGER_MEMORY).setTaskManagerMemoryMB(1000).setSlotsPerTaskManager(3).createClusterSpecification();
    final KubernetesJobManagerParameters kubernetesJobManagerParameters = new KubernetesJobManagerParameters(flinkConfig, clusterSpecification);
    this.kubernetesJobManagerSpecification = KubernetesJobManagerFactory.buildKubernetesJobManagerSpecification(new FlinkPod.Builder().build(), kubernetesJobManagerParameters);
}
Also used : ClusterSpecification(org.apache.flink.client.deployment.ClusterSpecification) KubernetesJobManagerParameters(org.apache.flink.kubernetes.kubeclient.parameters.KubernetesJobManagerParameters)

Example 2 with ClusterSpecification

use of org.apache.flink.client.deployment.ClusterSpecification in project flink by apache.

the class KubernetesSessionCliTest method testConfigurationClusterSpecification.

/**
 * Tests that the configuration settings are used to create the {@link ClusterSpecification}.
 */
@Test
public void testConfigurationClusterSpecification() throws Exception {
    final Configuration configuration = new Configuration();
    final int jobManagerMemory = 1337;
    configuration.set(JobManagerOptions.TOTAL_PROCESS_MEMORY, MemorySize.ofMebiBytes(jobManagerMemory));
    final int taskManagerMemory = 7331;
    configuration.set(TaskManagerOptions.TOTAL_PROCESS_MEMORY, MemorySize.ofMebiBytes(taskManagerMemory));
    final int slotsPerTaskManager = 42;
    configuration.setInteger(TaskManagerOptions.NUM_TASK_SLOTS, slotsPerTaskManager);
    final String[] args = { "-e", KubernetesSessionClusterExecutor.NAME };
    final KubernetesSessionCli cli = new KubernetesSessionCli(configuration, tmp.getRoot().getAbsolutePath());
    Configuration executorConfig = cli.getEffectiveConfiguration(args);
    ClusterClientFactory<String> clientFactory = getClusterClientFactory(executorConfig);
    ClusterSpecification clusterSpecification = clientFactory.getClusterSpecification(executorConfig);
    assertThat(clusterSpecification.getMasterMemoryMB(), is(jobManagerMemory));
    assertThat(clusterSpecification.getTaskManagerMemoryMB(), is(taskManagerMemory));
    assertThat(clusterSpecification.getSlotsPerTaskManager(), is(slotsPerTaskManager));
}
Also used : Configuration(org.apache.flink.configuration.Configuration) ClusterSpecification(org.apache.flink.client.deployment.ClusterSpecification) Test(org.junit.Test)

Example 3 with ClusterSpecification

use of org.apache.flink.client.deployment.ClusterSpecification in project flink by apache.

the class KubernetesSessionCliTest method testCorrectSettingOfMaxSlots.

@Test
public void testCorrectSettingOfMaxSlots() throws Exception {
    final String[] params = new String[] { "-e", KubernetesSessionClusterExecutor.NAME, "-D" + TaskManagerOptions.NUM_TASK_SLOTS.key() + "=3" };
    final KubernetesSessionCli cli = createFlinkKubernetesCustomCliWithJmAndTmTotalMemory(1234);
    final Configuration executorConfig = cli.getEffectiveConfiguration(params);
    final ClusterClientFactory<String> clientFactory = getClusterClientFactory(executorConfig);
    final ClusterSpecification clusterSpecification = clientFactory.getClusterSpecification(executorConfig);
    // each task manager has 3 slots but the parallelism is 7. Thus the slots should be
    // increased.
    assertEquals(3, clusterSpecification.getSlotsPerTaskManager());
}
Also used : Configuration(org.apache.flink.configuration.Configuration) ClusterSpecification(org.apache.flink.client.deployment.ClusterSpecification) Test(org.junit.Test)

Example 4 with ClusterSpecification

use of org.apache.flink.client.deployment.ClusterSpecification in project flink by apache.

the class KubernetesSessionCliTest method testHeapMemoryPropertyWithConfigDefaultValue.

/**
 * Tests the specifying heap memory with config default value for job manager and task manager.
 */
@Test
public void testHeapMemoryPropertyWithConfigDefaultValue() throws Exception {
    final String[] args = new String[] { "-e", KubernetesSessionClusterExecutor.NAME };
    final KubernetesSessionCli cli = createFlinkKubernetesCustomCliWithJmAndTmTotalMemory(1024);
    final Configuration executorConfig = cli.getEffectiveConfiguration(args);
    final ClusterClientFactory<String> clientFactory = getClusterClientFactory(executorConfig);
    final ClusterSpecification clusterSpecification = clientFactory.getClusterSpecification(executorConfig);
    assertThat(clusterSpecification.getMasterMemoryMB(), is(1024));
    assertThat(clusterSpecification.getTaskManagerMemoryMB(), is(1024));
}
Also used : Configuration(org.apache.flink.configuration.Configuration) ClusterSpecification(org.apache.flink.client.deployment.ClusterSpecification) Test(org.junit.Test)

Example 5 with ClusterSpecification

use of org.apache.flink.client.deployment.ClusterSpecification in project flink by apache.

the class KubernetesSessionCliTest method testHeapMemoryPropertyWithArbitraryUnit.

/**
 * Tests the specifying heap memory with arbitrary unit for job manager and task manager.
 */
@Test
public void testHeapMemoryPropertyWithArbitraryUnit() throws Exception {
    final String[] args = new String[] { "-e", KubernetesSessionClusterExecutor.NAME, "-D" + JobManagerOptions.TOTAL_PROCESS_MEMORY.key() + "=1g", "-D" + TaskManagerOptions.TOTAL_PROCESS_MEMORY.key() + "=3g" };
    final KubernetesSessionCli cli = createFlinkKubernetesCustomCliWithJmAndTmTotalMemory(1024);
    final Configuration executorConfig = cli.getEffectiveConfiguration(args);
    final ClusterClientFactory<String> clientFactory = getClusterClientFactory(executorConfig);
    final ClusterSpecification clusterSpecification = clientFactory.getClusterSpecification(executorConfig);
    assertThat(clusterSpecification.getMasterMemoryMB(), is(1024));
    assertThat(clusterSpecification.getTaskManagerMemoryMB(), is(3072));
}
Also used : Configuration(org.apache.flink.configuration.Configuration) ClusterSpecification(org.apache.flink.client.deployment.ClusterSpecification) Test(org.junit.Test)

Aggregations

ClusterSpecification (org.apache.flink.client.deployment.ClusterSpecification)28 Configuration (org.apache.flink.configuration.Configuration)20 Test (org.junit.Test)17 ApplicationId (org.apache.hadoop.yarn.api.records.ApplicationId)15 CommandLine (org.apache.commons.cli.CommandLine)9 CustomCommandLine (org.apache.flink.client.cli.CustomCommandLine)8 FlinkYarnSessionCli (org.apache.flink.yarn.cli.FlinkYarnSessionCli)8 File (java.io.File)5 ClusterDeploymentException (org.apache.flink.client.deployment.ClusterDeploymentException)4 JobGraph (org.apache.flink.runtime.jobgraph.JobGraph)4 FlinkException (org.apache.flink.util.FlinkException)4 Path (org.apache.hadoop.fs.Path)4 IOException (java.io.IOException)3 ClusterRetrieveException (org.apache.flink.client.deployment.ClusterRetrieveException)3 ApplicationConfiguration (org.apache.flink.client.deployment.application.ApplicationConfiguration)3 IllegalConfigurationException (org.apache.flink.configuration.IllegalConfigurationException)3 KubernetesJobManagerParameters (org.apache.flink.kubernetes.kubeclient.parameters.KubernetesJobManagerParameters)3 ClusterEntrypoint (org.apache.flink.runtime.entrypoint.ClusterEntrypoint)3 ApplicationReport (org.apache.hadoop.yarn.api.records.ApplicationReport)3 YarnConfiguration (org.apache.hadoop.yarn.conf.YarnConfiguration)3