Search in sources :

Example 46 with MemoryManager

use of org.apache.flink.runtime.memory.MemoryManager in project flink by apache.

the class DriverTestBase method shutdownAll.

// --------------------------------------------------------------------------------------------
@After
public void shutdownAll() throws Exception {
    // 1st, shutdown sorters
    for (UnilateralSortMerger<?> sorter : this.sorters) {
        if (sorter != null) {
            sorter.close();
        }
    }
    this.sorters.clear();
    // 2nd, shutdown I/O
    this.ioManager.shutdown();
    Assert.assertTrue("I/O Manager has not properly shut down.", this.ioManager.isProperlyShutDown());
    // last, verify all memory is returned and shutdown mem manager
    MemoryManager memMan = getMemoryManager();
    if (memMan != null) {
        Assert.assertTrue("Memory Manager managed memory was not completely freed.", memMan.verifyEmpty());
        memMan.shutdown();
    }
}
Also used : MemoryManager(org.apache.flink.runtime.memory.MemoryManager) After(org.junit.After)

Example 47 with MemoryManager

use of org.apache.flink.runtime.memory.MemoryManager in project flink by apache.

the class SpillingResettableIteratorTest method startup.

@Before
public void startup() {
    // set up IO and memory manager
    this.memman = new MemoryManager(MEMORY_CAPACITY, 1, 32 * 1024, MemoryType.HEAP, true);
    this.ioman = new IOManagerAsync();
    // create test objects
    ArrayList<IntValue> objects = new ArrayList<IntValue>(NUM_TESTRECORDS);
    for (int i = 0; i < NUM_TESTRECORDS; ++i) {
        IntValue tmp = new IntValue(i);
        objects.add(tmp);
    }
    this.reader = objects.iterator();
}
Also used : IOManagerAsync(org.apache.flink.runtime.io.disk.iomanager.IOManagerAsync) ArrayList(java.util.ArrayList) MemoryManager(org.apache.flink.runtime.memory.MemoryManager) IntValue(org.apache.flink.types.IntValue) Before(org.junit.Before)

Example 48 with MemoryManager

use of org.apache.flink.runtime.memory.MemoryManager in project flink by apache.

the class SpillingResettableMutableObjectIteratorTest method startup.

@Before
public void startup() {
    // set up IO and memory manager
    this.memman = new MemoryManager(MEMORY_CAPACITY, 1);
    this.ioman = new IOManagerAsync();
    // create test objects
    final ArrayList<Record> objects = new ArrayList<Record>(NUM_TESTRECORDS);
    for (int i = 0; i < NUM_TESTRECORDS; ++i) {
        Record tmp = new Record(new IntValue(i));
        objects.add(tmp);
    }
    this.reader = new MutableObjectIteratorWrapper(objects.iterator());
}
Also used : IOManagerAsync(org.apache.flink.runtime.io.disk.iomanager.IOManagerAsync) MutableObjectIteratorWrapper(org.apache.flink.runtime.operators.testutils.MutableObjectIteratorWrapper) ArrayList(java.util.ArrayList) Record(org.apache.flink.types.Record) MemoryManager(org.apache.flink.runtime.memory.MemoryManager) IntValue(org.apache.flink.types.IntValue) Before(org.junit.Before)

Example 49 with MemoryManager

use of org.apache.flink.runtime.memory.MemoryManager in project flink by apache.

the class CombiningUnilateralSortMergerITCase method beforeTest.

@SuppressWarnings("unchecked")
@Before
public void beforeTest() {
    this.memoryManager = new MemoryManager(MEMORY_SIZE, 1);
    this.ioManager = new IOManagerAsync();
    this.serializerFactory1 = TestData.getIntStringTupleSerializerFactory();
    this.comparator1 = TestData.getIntStringTupleComparator();
    this.serializerFactory2 = TestData.getIntIntTupleSerializerFactory();
    this.comparator2 = TestData.getIntIntTupleComparator();
}
Also used : IOManagerAsync(org.apache.flink.runtime.io.disk.iomanager.IOManagerAsync) MemoryManager(org.apache.flink.runtime.memory.MemoryManager) Before(org.junit.Before)

Example 50 with MemoryManager

use of org.apache.flink.runtime.memory.MemoryManager in project flink by apache.

the class HashVsSortMiniBenchmark method beforeTest.

@SuppressWarnings("unchecked")
@Before
public void beforeTest() {
    this.serializer1 = TestData.getIntStringTupleSerializerFactory();
    this.serializer2 = TestData.getIntStringTupleSerializerFactory();
    this.comparator1 = TestData.getIntStringTupleComparator();
    this.comparator2 = TestData.getIntStringTupleComparator();
    this.pairComparator11 = new GenericPairComparator(this.comparator1, this.comparator2);
    this.memoryManager = new MemoryManager(MEMORY_SIZE, 1, PAGE_SIZE, MemoryType.HEAP, true);
    this.ioManager = new IOManagerAsync();
}
Also used : IOManagerAsync(org.apache.flink.runtime.io.disk.iomanager.IOManagerAsync) GenericPairComparator(org.apache.flink.api.common.typeutils.GenericPairComparator) MemoryManager(org.apache.flink.runtime.memory.MemoryManager) Before(org.junit.Before)

Aggregations

MemoryManager (org.apache.flink.runtime.memory.MemoryManager)53 IOManagerAsync (org.apache.flink.runtime.io.disk.iomanager.IOManagerAsync)33 Before (org.junit.Before)22 IOManager (org.apache.flink.runtime.io.disk.iomanager.IOManager)19 ExecutionConfig (org.apache.flink.api.common.ExecutionConfig)12 DummyInvokable (org.apache.flink.runtime.operators.testutils.DummyInvokable)12 Test (org.junit.Test)10 IOException (java.io.IOException)9 ArrayList (java.util.ArrayList)8 Tuple2 (org.apache.flink.api.java.tuple.Tuple2)8 MemorySegment (org.apache.flink.core.memory.MemorySegment)8 TupleTypeInfo (org.apache.flink.api.java.typeutils.TupleTypeInfo)7 File (java.io.File)6 GenericPairComparator (org.apache.flink.api.common.typeutils.GenericPairComparator)6 IntValue (org.apache.flink.types.IntValue)6 Configuration (org.apache.flink.configuration.Configuration)5 AbstractInvokable (org.apache.flink.runtime.jobgraph.tasks.AbstractInvokable)5 BufferedReader (java.io.BufferedReader)4 FileReader (java.io.FileReader)4 Random (java.util.Random)4