use of org.apache.flink.configuration.MemorySize in project flink by apache.
the class JobManagerProcessUtilsTest method testJvmHeapExceedsTotalFlinkMemoryFailure.
@Test
public void testJvmHeapExceedsTotalFlinkMemoryFailure() {
MemorySize totalFlinkMemory = MemorySize.ofMebiBytes(100);
MemorySize jvmHeap = MemorySize.ofMebiBytes(150);
Configuration conf = new Configuration();
conf.set(JobManagerOptions.TOTAL_FLINK_MEMORY, totalFlinkMemory);
conf.set(JobManagerOptions.JVM_HEAP_MEMORY, jvmHeap);
validateFail(conf);
}
use of org.apache.flink.configuration.MemorySize in project flink by apache.
the class JobManagerProcessUtilsTest method testConfigOffHeapMemory.
@Test
public void testConfigOffHeapMemory() {
MemorySize offHeapMemory = MemorySize.parse("100m");
Configuration conf = new Configuration();
conf.set(JobManagerOptions.OFF_HEAP_MEMORY, offHeapMemory);
validateInAllConfigurationsWithoutExplicitTotalFlinkAndJvmHeapMem(conf, jobManagerProcessSpec -> assertThat(jobManagerProcessSpec.getJvmDirectMemorySize(), is(offHeapMemory)));
}
use of org.apache.flink.configuration.MemorySize in project flink by apache.
the class JobManagerProcessUtilsTest method testFlinkInternalMemorySizeAddUpFailure.
@Test
public void testFlinkInternalMemorySizeAddUpFailure() {
MemorySize totalFlinkMemory = MemorySize.parse("199m");
MemorySize jvmHeap = MemorySize.parse("100m");
MemorySize offHeapMemory = MemorySize.parse("100m");
Configuration conf = new Configuration();
conf.set(JobManagerOptions.TOTAL_FLINK_MEMORY, totalFlinkMemory);
conf.set(JobManagerOptions.JVM_HEAP_MEMORY, jvmHeap);
conf.set(JobManagerOptions.OFF_HEAP_MEMORY, offHeapMemory);
validateFail(conf);
}
use of org.apache.flink.configuration.MemorySize in project flink by apache.
the class SsgNetworkMemoryCalculationUtilsTest method testGenerateEnrichedResourceProfileForDynamicGraph.
@Test
public void testGenerateEnrichedResourceProfileForDynamicGraph() throws Exception {
List<SlotSharingGroup> slotSharingGroups = Arrays.asList(new SlotSharingGroup(), new SlotSharingGroup(), new SlotSharingGroup());
for (SlotSharingGroup group : slotSharingGroups) {
group.setResourceProfile(DEFAULT_RESOURCE);
}
DefaultExecutionGraph executionGraph = createDynamicExecutionGraph(slotSharingGroups, 20);
Iterator<ExecutionJobVertex> jobVertices = executionGraph.getVerticesTopologically().iterator();
ExecutionJobVertex source = jobVertices.next();
ExecutionJobVertex map = jobVertices.next();
ExecutionJobVertex sink = jobVertices.next();
executionGraph.initializeJobVertex(source, 0L);
triggerComputeNumOfSubpartitions(source.getProducedDataSets()[0]);
map.setParallelism(5);
executionGraph.initializeJobVertex(map, 0L);
triggerComputeNumOfSubpartitions(map.getProducedDataSets()[0]);
sink.setParallelism(7);
executionGraph.initializeJobVertex(sink, 0L);
assertNetworkMemory(slotSharingGroups, Arrays.asList(new MemorySize(TestShuffleMaster.computeRequiredShuffleMemoryBytes(0, 5)), new MemorySize(TestShuffleMaster.computeRequiredShuffleMemoryBytes(5, 20)), new MemorySize(TestShuffleMaster.computeRequiredShuffleMemoryBytes(15, 0))));
}
use of org.apache.flink.configuration.MemorySize in project flink by apache.
the class BashJavaUtilsTest method testJmLegacyHeapOptionSetsNewJvmHeap.
@Test
public void testJmLegacyHeapOptionSetsNewJvmHeap() {
Configuration configuration = new Configuration();
MemorySize heapSize = MemorySize.ofMebiBytes(10);
configuration.set(JobManagerOptions.JOB_MANAGER_HEAP_MEMORY, heapSize);
String jvmArgsLine = BashJavaUtils.getJmResourceParams(configuration).get(0);
Map<String, String> jvmArgs = ConfigurationUtils.parseJvmArgString(jvmArgsLine);
String heapSizeStr = Long.toString(heapSize.getBytes());
assertThat(jvmArgs.get("-Xmx"), is(heapSizeStr));
assertThat(jvmArgs.get("-Xms"), is(heapSizeStr));
}
Aggregations