Search in sources :

Example 6 with DefaultDelayOperator

use of com.datatorrent.common.util.DefaultDelayOperator in project apex-core by apache.

the class DelayOperatorTest method testFibonacciRecovery1.

@Test(timeout = 60000)
public void testFibonacciRecovery1() throws Exception {
    LogicalPlan dag = StramTestSupport.createDAG(testMeta);
    TestGeneratorInputOperator dummyInput = dag.addOperator("DUMMY", TestGeneratorInputOperator.class);
    FailableFibonacciOperator fib = dag.addOperator("FIB", FailableFibonacciOperator.class);
    DefaultDelayOperator opDelay = dag.addOperator("opDelay", DefaultDelayOperator.class);
    fib.failableOperator = new FailableOperator(fib, 3, true);
    dag.addStream("dummy_to_operator", dummyInput.outport, fib.dummyInputPort);
    dag.addStream("operator_to_delay", fib.output, opDelay.input);
    dag.addStream("delay_to_operator", opDelay.output, fib.input);
    dag.getAttributes().put(LogicalPlan.CHECKPOINT_WINDOW_COUNT, 2);
    dag.getAttributes().put(LogicalPlan.STREAMING_WINDOW_SIZE_MILLIS, 300);
    dag.getAttributes().put(LogicalPlan.HEARTBEAT_INTERVAL_MILLIS, 50);
    final StramLocalCluster localCluster = new StramLocalCluster(dag);
    localCluster.setPerContainerBufferServer(true);
    localCluster.run(new ExitCondition(30, FailableOperator.isFailureSimulated));
    assertFalse(ExitCondition.message, ExitCondition.failed);
    assertTrue(FibonacciOperator.results.size() >= 30);
    assertFibonacci();
}
Also used : TestGeneratorInputOperator(com.datatorrent.stram.engine.TestGeneratorInputOperator) DefaultDelayOperator(com.datatorrent.common.util.DefaultDelayOperator) StramLocalCluster(com.datatorrent.stram.StramLocalCluster) Test(org.junit.Test)

Example 7 with DefaultDelayOperator

use of com.datatorrent.common.util.DefaultDelayOperator in project apex-core by apache.

the class DelayOperatorTest method testFibonacci.

@Test(timeout = 60000)
public void testFibonacci() throws Exception {
    LogicalPlan dag = new LogicalPlan();
    TestGeneratorInputOperator dummyInput = dag.addOperator("DUMMY", TestGeneratorInputOperator.class);
    FibonacciOperator fib = dag.addOperator("FIB", FibonacciOperator.class);
    DefaultDelayOperator opDelay = dag.addOperator("opDelay", DefaultDelayOperator.class);
    dag.addStream("dummy_to_operator", dummyInput.outport, fib.dummyInputPort);
    dag.addStream("operator_to_delay", fib.output, opDelay.input);
    dag.addStream("delay_to_operator", opDelay.output, fib.input);
    new StramLocalCluster(dag).run(new ExitCondition(10, null));
    assertFalse(ExitCondition.message, ExitCondition.failed);
    assertFibonacci();
}
Also used : TestGeneratorInputOperator(com.datatorrent.stram.engine.TestGeneratorInputOperator) DefaultDelayOperator(com.datatorrent.common.util.DefaultDelayOperator) StramLocalCluster(com.datatorrent.stram.StramLocalCluster) Test(org.junit.Test)

Aggregations

DefaultDelayOperator (com.datatorrent.common.util.DefaultDelayOperator)7 Test (org.junit.Test)6 TestGeneratorInputOperator (com.datatorrent.stram.engine.TestGeneratorInputOperator)5 GenericTestOperator (com.datatorrent.stram.engine.GenericTestOperator)4 StramLocalCluster (com.datatorrent.stram.StramLocalCluster)2 OperatorMeta (com.datatorrent.stram.plan.logical.LogicalPlan.OperatorMeta)2 InputOperator (com.datatorrent.api.InputOperator)1 Operator (com.datatorrent.api.Operator)1 BaseOperator (com.datatorrent.common.util.BaseOperator)1 UpdateCheckpointsContext (com.datatorrent.stram.StreamingContainerManager.UpdateCheckpointsContext)1 Checkpoint (com.datatorrent.stram.api.Checkpoint)1 PTOperator (com.datatorrent.stram.plan.physical.PTOperator)1 PhysicalPlan (com.datatorrent.stram.plan.physical.PhysicalPlan)1 MemoryStorageAgent (com.datatorrent.stram.support.StramTestSupport.MemoryStorageAgent)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Set (java.util.Set)1 ValidationException (javax.validation.ValidationException)1 RandomEventGenerator (org.apache.apex.malhar.lib.testbench.RandomEventGenerator)1 Clock (org.apache.hadoop.yarn.util.Clock)1