Search in sources :

Example 41 with MemorySize

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);
}
Also used : MemorySize(org.apache.flink.configuration.MemorySize) Configuration(org.apache.flink.configuration.Configuration) Test(org.junit.Test)

Example 42 with MemorySize

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)));
}
Also used : MemorySize(org.apache.flink.configuration.MemorySize) Configuration(org.apache.flink.configuration.Configuration) Test(org.junit.Test)

Example 43 with MemorySize

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);
}
Also used : MemorySize(org.apache.flink.configuration.MemorySize) Configuration(org.apache.flink.configuration.Configuration) Test(org.junit.Test)

Example 44 with MemorySize

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))));
}
Also used : MemorySize(org.apache.flink.configuration.MemorySize) ExecutionJobVertex(org.apache.flink.runtime.executiongraph.ExecutionJobVertex) SlotSharingGroup(org.apache.flink.runtime.jobmanager.scheduler.SlotSharingGroup) DefaultExecutionGraph(org.apache.flink.runtime.executiongraph.DefaultExecutionGraph) IntermediateResultPartitionTest(org.apache.flink.runtime.executiongraph.IntermediateResultPartitionTest) Test(org.junit.Test)

Example 45 with MemorySize

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));
}
Also used : MemorySize(org.apache.flink.configuration.MemorySize) Configuration(org.apache.flink.configuration.Configuration) Test(org.junit.Test)

Aggregations

MemorySize (org.apache.flink.configuration.MemorySize)81 Test (org.junit.Test)56 Configuration (org.apache.flink.configuration.Configuration)51 IllegalConfigurationException (org.apache.flink.configuration.IllegalConfigurationException)6 Path (org.apache.flink.core.fs.Path)5 File (java.io.File)4 ArrayList (java.util.ArrayList)3 CPUResource (org.apache.flink.api.common.resources.CPUResource)3 FileSourceSplit (org.apache.flink.connector.file.src.FileSourceSplit)2 BulkFormat (org.apache.flink.connector.file.src.reader.BulkFormat)2 ExecutionJobVertex (org.apache.flink.runtime.executiongraph.ExecutionJobVertex)2 IntermediateResultPartitionTest (org.apache.flink.runtime.executiongraph.IntermediateResultPartitionTest)2 SlotSharingGroup (org.apache.flink.runtime.jobmanager.scheduler.SlotSharingGroup)2 TaskExecutorFlinkMemory (org.apache.flink.runtime.util.config.memory.taskmanager.TaskExecutorFlinkMemory)2 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)2 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 UUID (java.util.UUID)1 ResourceSpec (org.apache.flink.api.common.operators.ResourceSpec)1