Search in sources :

Example 26 with FSWindowDataManager

use of org.apache.apex.malhar.lib.wal.FSWindowDataManager in project apex-malhar by apache.

the class FileSplitterTest method testIdempotencyWithBlocksThreshold.

@Test
public void testIdempotencyWithBlocksThreshold() throws InterruptedException {
    FSWindowDataManager fsWindowDataManager = new FSWindowDataManager();
    testMeta.fileSplitter.setWindowDataManager(fsWindowDataManager);
    testMeta.fileSplitter.setBlocksThreshold(10);
    testMeta.fileSplitter.scanner.setScanIntervalMillis(500);
    testMeta.fileSplitter.setup(testMeta.context);
    testBlocksThreshold();
    testMeta.fileMetadataSink.clear();
    testMeta.blockMetadataSink.clear();
    testMeta.fileSplitter.setup(testMeta.context);
    for (int i = 1; i < 8; i++) {
        testMeta.fileSplitter.beginWindow(i);
    }
    Assert.assertEquals("Files", 12, testMeta.fileMetadataSink.collectedTuples.size());
    Assert.assertEquals("Blocks", 62, testMeta.blockMetadataSink.collectedTuples.size());
}
Also used : FSWindowDataManager(org.apache.apex.malhar.lib.wal.FSWindowDataManager) Test(org.junit.Test)

Example 27 with FSWindowDataManager

use of org.apache.apex.malhar.lib.wal.FSWindowDataManager in project apex-malhar by apache.

the class ExactlyOnceJdbcOutputApp method populateDAG.

@Override
public void populateDAG(DAG dag, Configuration conf) {
    KafkaSinglePortStringInputOperator kafkaInput = dag.addOperator("kafkaInput", new KafkaSinglePortStringInputOperator());
    kafkaInput.setWindowDataManager(new FSWindowDataManager());
    UniqueCounterFlat count = dag.addOperator("count", new UniqueCounterFlat());
    CountStoreOperator store = dag.addOperator("store", new CountStoreOperator());
    store.setStore(new JdbcTransactionalStore());
    ConsoleOutputOperator cons = dag.addOperator("console", new ConsoleOutputOperator());
    dag.addStream("words", kafkaInput.outputPort, count.data);
    dag.addStream("counts", count.counts, store.input, cons.input);
}
Also used : ConsoleOutputOperator(org.apache.apex.malhar.lib.io.ConsoleOutputOperator) JdbcTransactionalStore(org.apache.apex.malhar.lib.db.jdbc.JdbcTransactionalStore) FSWindowDataManager(org.apache.apex.malhar.lib.wal.FSWindowDataManager)

Example 28 with FSWindowDataManager

use of org.apache.apex.malhar.lib.wal.FSWindowDataManager in project apex-malhar by apache.

the class AbstractUpsertOutputOperator method setup.

// end of input port implementation
@Override
public void setup(Context.OperatorContext context) {
    super.setup(context);
    windowDataManager = getWindowDataManager();
    if (windowDataManager == null) {
        windowDataManager = new FSWindowDataManager();
    }
    windowDataManager.setup(context);
}
Also used : FSWindowDataManager(org.apache.apex.malhar.lib.wal.FSWindowDataManager)

Aggregations

FSWindowDataManager (org.apache.apex.malhar.lib.wal.FSWindowDataManager)28 Test (org.junit.Test)14 File (java.io.File)9 CollectorTestSink (org.apache.apex.malhar.lib.testbench.CollectorTestSink)6 Path (org.apache.hadoop.fs.Path)6 Attribute (com.datatorrent.api.Attribute)5 LineByLineFileInputOperator (org.apache.apex.malhar.lib.fs.LineByLineFileInputOperator)5 DAG (com.datatorrent.api.DAG)4 LocalMode (com.datatorrent.api.LocalMode)4 BlockMetadata (org.apache.apex.malhar.lib.io.block.BlockMetadata)3 OperatorContext (com.datatorrent.api.Context.OperatorContext)2 IOException (java.io.IOException)2 CountDownLatch (java.util.concurrent.CountDownLatch)2 MockSiteToSiteClient (org.apache.apex.malhar.contrib.nifi.mock.MockSiteToSiteClient)2 OperatorContextTestHelper.mockOperatorContext (org.apache.apex.malhar.lib.helper.OperatorContextTestHelper.mockOperatorContext)2 ConsoleOutputOperator (org.apache.apex.malhar.lib.io.ConsoleOutputOperator)2 Before (org.junit.Before)2 DefaultPartition (com.datatorrent.api.DefaultPartition)1 Partitioner (com.datatorrent.api.Partitioner)1 Partition (com.datatorrent.api.Partitioner.Partition)1