use of org.apache.flink.configuration.MemorySize in project flink by apache.
the class ProcessMemoryUtilsTestBase method testConfigTotalFlinkMemory.
@Test
public void testConfigTotalFlinkMemory() {
MemorySize totalFlinkMemorySize = MemorySize.parse("1g");
Configuration conf = new Configuration();
conf.set(options.getTotalFlinkMemoryOption(), totalFlinkMemorySize);
T processSpec = processSpecFromConfig(conf);
assertThat(processSpec.getTotalFlinkMemorySize(), is(totalFlinkMemorySize));
}
use of org.apache.flink.configuration.MemorySize in project flink by apache.
the class TaskExecutorResourceUtilsTest method testNetworkMinAdjustForLocalExecutionIfMaxSet.
@Test
public void testNetworkMinAdjustForLocalExecutionIfMaxSet() {
MemorySize networkMemorySize = MemorySize.ofMebiBytes(1);
Configuration configuration = new Configuration();
configuration.set(TaskManagerOptions.NETWORK_MEMORY_MAX, networkMemorySize);
TaskExecutorResourceUtils.adjustForLocalExecution(configuration);
assertThat(configuration.get(TaskManagerOptions.NETWORK_MEMORY_MIN), is(networkMemorySize));
assertThat(configuration.get(TaskManagerOptions.NETWORK_MEMORY_MAX), is(networkMemorySize));
}
use of org.apache.flink.configuration.MemorySize in project flink by apache.
the class TaskExecutorResourceUtilsTest method testCalculateTotalFlinkMemoryWithAllFactorsBeingSet.
@Test
public void testCalculateTotalFlinkMemoryWithAllFactorsBeingSet() {
Configuration config = new Configuration();
config.set(TaskManagerOptions.FRAMEWORK_HEAP_MEMORY, new MemorySize(1));
config.set(TaskManagerOptions.TASK_HEAP_MEMORY, new MemorySize(2));
config.set(TaskManagerOptions.FRAMEWORK_OFF_HEAP_MEMORY, new MemorySize(3));
config.set(TaskManagerOptions.TASK_OFF_HEAP_MEMORY, new MemorySize(4));
config.set(TaskManagerOptions.NETWORK_MEMORY_MAX, new MemorySize(6));
config.set(TaskManagerOptions.NETWORK_MEMORY_MIN, new MemorySize(6));
config.set(TaskManagerOptions.MANAGED_MEMORY_SIZE, new MemorySize(7));
assertThat(TaskExecutorResourceUtils.calculateTotalFlinkMemoryFromComponents(config), is(23L));
}
use of org.apache.flink.configuration.MemorySize in project flink by apache.
the class TaskExecutorResourceUtilsTest method testNetworkMaxAdjustForLocalExecutionIfMinSet.
@Test
public void testNetworkMaxAdjustForLocalExecutionIfMinSet() {
MemorySize networkMemorySize = MemorySize.ofMebiBytes(1);
Configuration configuration = new Configuration();
configuration.set(TaskManagerOptions.NETWORK_MEMORY_MIN, networkMemorySize);
TaskExecutorResourceUtils.adjustForLocalExecution(configuration);
assertThat(configuration.get(TaskManagerOptions.NETWORK_MEMORY_MIN), is(networkMemorySize));
assertThat(configuration.get(TaskManagerOptions.NETWORK_MEMORY_MAX), is(networkMemorySize));
}
use of org.apache.flink.configuration.MemorySize in project flink by apache.
the class TaskExecutorResourceUtilsTest method setAllRequiredOptionsExceptOne.
private static Configuration setAllRequiredOptionsExceptOne(ConfigOption<?> optionToNotSet) {
Configuration configuration = new Configuration();
if (!TaskManagerOptions.CPU_CORES.equals(optionToNotSet)) {
configuration.set(TaskManagerOptions.CPU_CORES, 1.0);
}
// skip network to exclude min/max mismatch config failure
MemorySize network = MemorySize.ofMebiBytes(3);
configuration.set(TaskManagerOptions.NETWORK_MEMORY_MIN, network);
configuration.set(TaskManagerOptions.NETWORK_MEMORY_MAX, network);
// noinspection unchecked
TaskExecutorResourceUtils.CONFIG_OPTIONS.stream().filter(option -> !option.equals(TaskManagerOptions.CPU_CORES)).filter(option -> !option.equals(optionToNotSet)).forEach(option -> configuration.set((ConfigOption<MemorySize>) option, MemorySize.ofMebiBytes(1)));
return configuration;
}
Aggregations