Search in sources :

Example 11 with ClusterSpecification

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

the class FlinkYarnSessionCliTest method testMemoryPropertyWithUnitMB.

/**
 * Tests the specifying total process memory with unit (MB) for job manager and task manager.
 */
@Test
public void testMemoryPropertyWithUnitMB() throws Exception {
    final String[] args = new String[] { "-yjm", "1024m", "-ytm", "2048m" };
    final FlinkYarnSessionCli flinkYarnSessionCli = createFlinkYarnSessionCli();
    final CommandLine commandLine = flinkYarnSessionCli.parseCommandLineOptions(args, false);
    final Configuration executorConfig = flinkYarnSessionCli.toConfiguration(commandLine);
    final ClusterClientFactory<ApplicationId> clientFactory = getClusterClientFactory(executorConfig);
    final ClusterSpecification clusterSpecification = clientFactory.getClusterSpecification(executorConfig);
    assertThat(clusterSpecification.getMasterMemoryMB(), is(1024));
    assertThat(clusterSpecification.getTaskManagerMemoryMB(), is(2048));
}
Also used : CustomCommandLine(org.apache.flink.client.cli.CustomCommandLine) CommandLine(org.apache.commons.cli.CommandLine) Configuration(org.apache.flink.configuration.Configuration) ClusterSpecification(org.apache.flink.client.deployment.ClusterSpecification) ApplicationId(org.apache.hadoop.yarn.api.records.ApplicationId) FlinkYarnSessionCli(org.apache.flink.yarn.cli.FlinkYarnSessionCli) Test(org.junit.Test)

Example 12 with ClusterSpecification

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

the class KubernetesSessionCliTest method testCommandLineClusterSpecification.

/**
 * Tests that the command line arguments override the configuration settings when the {@link
 * ClusterSpecification} is created.
 */
@Test
public void testCommandLineClusterSpecification() throws Exception {
    final Configuration configuration = new Configuration();
    final int jobManagerMemory = 1337;
    final int taskManagerMemory = 7331;
    final int slotsPerTaskManager = 30;
    configuration.set(JobManagerOptions.TOTAL_PROCESS_MEMORY, MemorySize.ofMebiBytes(jobManagerMemory));
    configuration.set(TaskManagerOptions.TOTAL_PROCESS_MEMORY, MemorySize.ofMebiBytes(taskManagerMemory));
    configuration.setInteger(TaskManagerOptions.NUM_TASK_SLOTS, slotsPerTaskManager);
    final String[] args = { "-e", KubernetesSessionClusterExecutor.NAME, "-D" + JobManagerOptions.TOTAL_PROCESS_MEMORY.key() + "=" + jobManagerMemory + "m", "-D" + TaskManagerOptions.TOTAL_PROCESS_MEMORY.key() + "=" + taskManagerMemory + "m", "-D" + TaskManagerOptions.NUM_TASK_SLOTS.key() + "=" + slotsPerTaskManager };
    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 13 with ClusterSpecification

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

the class KubernetesSessionCliTest method testHeapMemoryPropertyWithUnitMB.

/**
 * Tests the specifying heap memory with unit (MB) for job manager and task manager.
 */
@Test
public void testHeapMemoryPropertyWithUnitMB() throws Exception {
    final String[] args = new String[] { "-e", KubernetesSessionClusterExecutor.NAME, "-D" + JobManagerOptions.TOTAL_PROCESS_MEMORY.key() + "=1024m", "-D" + TaskManagerOptions.TOTAL_PROCESS_MEMORY.key() + "=2048m" };
    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(2048));
}
Also used : Configuration(org.apache.flink.configuration.Configuration) ClusterSpecification(org.apache.flink.client.deployment.ClusterSpecification) Test(org.junit.Test)

Example 14 with ClusterSpecification

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

the class KubernetesSessionCliTest method testHeapMemoryPropertyWithOldConfigKey.

/**
 * Tests the specifying heap memory with old config key for job manager and task manager.
 */
@Test
public void testHeapMemoryPropertyWithOldConfigKey() throws Exception {
    Configuration configuration = new Configuration();
    configuration.set(DeploymentOptions.TARGET, KubernetesSessionClusterExecutor.NAME);
    configuration.setInteger(JobManagerOptions.JOB_MANAGER_HEAP_MEMORY_MB, 2048);
    configuration.setInteger(TaskManagerOptions.TASK_MANAGER_HEAP_MEMORY_MB, 4096);
    final KubernetesSessionCli cli = new KubernetesSessionCli(configuration, tmp.getRoot().getAbsolutePath());
    final Configuration executorConfig = cli.getEffectiveConfiguration(new String[] {});
    final ClusterClientFactory<String> clientFactory = getClusterClientFactory(executorConfig);
    final ClusterSpecification clusterSpecification = clientFactory.getClusterSpecification(executorConfig);
    assertThat(clusterSpecification.getMasterMemoryMB(), is(2048));
    assertThat(clusterSpecification.getTaskManagerMemoryMB(), is(4096));
}
Also used : Configuration(org.apache.flink.configuration.Configuration) ClusterSpecification(org.apache.flink.client.deployment.ClusterSpecification) Test(org.junit.Test)

Example 15 with ClusterSpecification

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

the class KubernetesJobManagerTestBase method onSetup.

@Override
protected void onSetup() throws Exception {
    final ClusterSpecification clusterSpecification = new ClusterSpecification.ClusterSpecificationBuilder().setMasterMemoryMB(JOB_MANAGER_MEMORY).setTaskManagerMemoryMB(1024).setSlotsPerTaskManager(3).createClusterSpecification();
    this.kubernetesJobManagerParameters = new KubernetesJobManagerParameters(flinkConfig, clusterSpecification);
}
Also used : ClusterSpecification(org.apache.flink.client.deployment.ClusterSpecification) KubernetesJobManagerParameters(org.apache.flink.kubernetes.kubeclient.parameters.KubernetesJobManagerParameters)

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