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));
}
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));
}
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));
}
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));
}
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);
}
Aggregations