use of org.apache.flink.configuration.MemorySize in project flink by apache.
the class JobManagerProcessUtilsTest method configWithFineGrainedOptions.
@Override
protected void configWithFineGrainedOptions(Configuration configuration, MemorySize totalFlinkMemorySize) {
MemorySize heapSize = new MemorySize(totalFlinkMemorySize.getBytes() / 2);
MemorySize offHeapSize = totalFlinkMemorySize.subtract(heapSize);
configuration.set(JobManagerOptions.JVM_HEAP_MEMORY, heapSize);
configuration.set(JobManagerOptions.OFF_HEAP_MEMORY, offHeapSize);
}
use of org.apache.flink.configuration.MemorySize in project flink by apache.
the class SsgNetworkMemoryCalculationUtilsTest method testGenerateEnrichedResourceProfile.
@Test
public void testGenerateEnrichedResourceProfile() throws Exception {
SlotSharingGroup slotSharingGroup0 = new SlotSharingGroup();
slotSharingGroup0.setResourceProfile(DEFAULT_RESOURCE);
SlotSharingGroup slotSharingGroup1 = new SlotSharingGroup();
slotSharingGroup1.setResourceProfile(DEFAULT_RESOURCE);
createExecutionGraphAndEnrichNetworkMemory(Arrays.asList(slotSharingGroup0, slotSharingGroup0, slotSharingGroup1));
assertEquals(new MemorySize(TestShuffleMaster.computeRequiredShuffleMemoryBytes(0, 2) + TestShuffleMaster.computeRequiredShuffleMemoryBytes(1, 6)), slotSharingGroup0.getResourceProfile().getNetworkMemory());
assertEquals(new MemorySize(TestShuffleMaster.computeRequiredShuffleMemoryBytes(5, 0)), slotSharingGroup1.getResourceProfile().getNetworkMemory());
}
use of org.apache.flink.configuration.MemorySize in project flink by apache.
the class TaskExecutorProcessUtilsTest method testConfigFrameworkOffHeapMemory.
@Test
public void testConfigFrameworkOffHeapMemory() {
final MemorySize frameworkOffHeapSize = MemorySize.parse("10m");
Configuration conf = new Configuration();
conf.set(TaskManagerOptions.FRAMEWORK_OFF_HEAP_MEMORY, frameworkOffHeapSize);
validateInAllConfigurations(conf, taskExecutorProcessSpec -> assertThat(taskExecutorProcessSpec.getFrameworkOffHeapMemorySize(), is(frameworkOffHeapSize)));
}
use of org.apache.flink.configuration.MemorySize in project flink by apache.
the class TaskExecutorProcessUtilsTest method testConfigNetworkMemoryLegacyRangeFraction.
@Test
public void testConfigNetworkMemoryLegacyRangeFraction() {
final MemorySize networkMin = MemorySize.parse("200m");
final MemorySize networkMax = MemorySize.parse("500m");
final float fraction = 0.2f;
@SuppressWarnings("deprecation") final ConfigOption<String> legacyOptionMin = NettyShuffleEnvironmentOptions.NETWORK_BUFFERS_MEMORY_MIN;
@SuppressWarnings("deprecation") final ConfigOption<String> legacyOptionMax = NettyShuffleEnvironmentOptions.NETWORK_BUFFERS_MEMORY_MAX;
@SuppressWarnings("deprecation") final ConfigOption<Float> legacyOptionFraction = NettyShuffleEnvironmentOptions.NETWORK_BUFFERS_MEMORY_FRACTION;
Configuration conf = new Configuration();
conf.setString(legacyOptionMin, networkMin.getMebiBytes() + "m");
conf.setString(legacyOptionMax, networkMax.getMebiBytes() + "m");
validateInAllConfigurations(conf, taskExecutorProcessSpec -> {
assertThat(taskExecutorProcessSpec.getNetworkMemSize().getBytes(), greaterThanOrEqualTo(networkMin.getBytes()));
assertThat(taskExecutorProcessSpec.getNetworkMemSize().getBytes(), lessThanOrEqualTo(networkMax.getBytes()));
});
conf.setString(legacyOptionMin, "0m");
conf.setString(legacyOptionMax, "1t");
conf.setFloat(legacyOptionFraction, fraction);
validateInConfigWithExplicitTaskHeapAndManagedMem(conf, taskExecutorProcessSpec -> assertThat(taskExecutorProcessSpec.getNetworkMemSize(), is(taskExecutorProcessSpec.getTotalFlinkMemorySize().multiply(fraction))));
}
use of org.apache.flink.configuration.MemorySize in project flink by apache.
the class TaskExecutorProcessUtilsTest method testConfigTotalProcessMemoryLegacySize.
@Test
public void testConfigTotalProcessMemoryLegacySize() {
final MemorySize totalProcessMemorySize = MemorySize.parse("2g");
@SuppressWarnings("deprecation") final ConfigOption<MemorySize> legacyOption = TaskManagerOptions.TOTAL_PROCESS_MEMORY;
Configuration conf = new Configuration();
conf.set(legacyOption, totalProcessMemorySize);
TaskExecutorProcessSpec taskExecutorProcessSpec = TaskExecutorProcessUtils.processSpecFromConfig(conf);
assertThat(taskExecutorProcessSpec.getTotalProcessMemorySize(), is(totalProcessMemorySize));
}
Aggregations