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