use of org.apache.flink.api.common.resources.CPUResource in project flink by apache.
the class TaskExecutorProcessUtilsTest method testConfigCpuCores.
@Test
public void testConfigCpuCores() {
final double cpuCores = 1.0;
Configuration conf = new Configuration();
conf.setDouble(TaskManagerOptions.CPU_CORES, cpuCores);
validateInAllConfigurations(conf, taskExecutorProcessSpec -> assertThat(taskExecutorProcessSpec.getCpuCores(), is(new CPUResource(cpuCores))));
}
use of org.apache.flink.api.common.resources.CPUResource in project flink by apache.
the class TaskExecutorProcessSpecTest method testEquals.
@Test
public void testEquals() {
TaskExecutorProcessSpec spec1 = new TaskExecutorProcessSpec(new CPUResource(1.0), MemorySize.parse("1m"), MemorySize.parse("2m"), MemorySize.parse("3m"), MemorySize.parse("4m"), MemorySize.parse("5m"), MemorySize.parse("6m"), MemorySize.parse("7m"), MemorySize.parse("8m"), Collections.singleton(new ExternalResource(EXTERNAL_RESOURCE_NAME, 1)));
TaskExecutorProcessSpec spec2 = new TaskExecutorProcessSpec(new CPUResource(1.0), MemorySize.parse("1m"), MemorySize.parse("2m"), MemorySize.parse("3m"), MemorySize.parse("4m"), MemorySize.parse("5m"), MemorySize.parse("6m"), MemorySize.parse("7m"), MemorySize.parse("8m"), Collections.singleton(new ExternalResource(EXTERNAL_RESOURCE_NAME, 1)));
assertThat(spec1, is(spec2));
}
use of org.apache.flink.api.common.resources.CPUResource in project flink by apache.
the class YarnWorkerResourceSpecFactoryTest method testGetCpuCoresNumSlots.
@Test
public void testGetCpuCoresNumSlots() {
final Configuration configuration = new Configuration();
configuration.setInteger(TaskManagerOptions.NUM_TASK_SLOTS, 3);
assertThat(YarnWorkerResourceSpecFactory.getDefaultCpus(configuration), is(new CPUResource(3.0)));
}
use of org.apache.flink.api.common.resources.CPUResource in project flink by apache.
the class YarnWorkerResourceSpecFactoryTest method testGetCpuRoundUp.
@Test
public void testGetCpuRoundUp() {
final Configuration configuration = new Configuration();
configuration.setDouble(TaskManagerOptions.CPU_CORES, 0.5);
assertThat(YarnWorkerResourceSpecFactory.getDefaultCpus(configuration), is(new CPUResource(1.0)));
}
Aggregations