Search in sources :

Example 1 with DevNull

use of org.apache.apex.malhar.lib.stream.DevNull in project apex-malhar by apache.

the class EventIncrementerApp method populateDAG.

@Override
public void populateDAG(DAG dag, Configuration conf) {
    EventIncrementer eventInc = dag.addOperator("eventInc", new EventIncrementer());
    ArrayList<String> keys = new ArrayList<String>(2);
    ArrayList<Double> low = new ArrayList<Double>(2);
    ArrayList<Double> high = new ArrayList<Double>(2);
    keys.add("x");
    keys.add("y");
    low.add(1.0);
    low.add(1.0);
    high.add(100.0);
    high.add(100.0);
    eventInc.setKeylimits(keys, low, high);
    eventInc.setDelta(1);
    HashMapOperator hmapOper = dag.addOperator("hmapOper", new HashMapOperator());
    dag.addStream("eventIncInput1", hmapOper.hmapList_data, eventInc.seed);
    dag.addStream("eventIncInput2", hmapOper.hmapMap_data, eventInc.increment);
    DevNull<HashMap<String, Integer>> dev1 = dag.addOperator("dev1", new DevNull());
    DevNull<HashMap<String, String>> dev2 = dag.addOperator("dev2", new DevNull());
    dag.addStream("eventIncOutput1", eventInc.count, dev1.data).setLocality(locality);
    dag.addStream("eventIncOutput2", eventInc.data, dev2.data).setLocality(locality);
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) EventIncrementer(org.apache.apex.malhar.lib.testbench.EventIncrementer) DevNull(org.apache.apex.malhar.lib.stream.DevNull)

Example 2 with DevNull

use of org.apache.apex.malhar.lib.stream.DevNull in project apex-malhar by apache.

the class FilteredEventClassifierApp method populateDAG.

@Override
public void populateDAG(DAG dag, Configuration conf) {
    FilteredEventClassifier filterEvent = dag.addOperator("filterEvent", new FilteredEventClassifier());
    HashMap<String, Double> kmap = new HashMap<String, Double>(3);
    kmap.put("a", 1.0);
    kmap.put("b", 4.0);
    kmap.put("c", 5.0);
    ArrayList<Integer> list = new ArrayList<Integer>(3);
    HashMap<String, ArrayList<Integer>> wmap = new HashMap<String, ArrayList<Integer>>(4);
    list.add(60);
    list.add(10);
    list.add(35);
    wmap.put("ia", list);
    list = new ArrayList<Integer>(3);
    list.add(10);
    list.add(75);
    list.add(15);
    wmap.put("ib", list);
    list = new ArrayList<Integer>(3);
    list.add(20);
    list.add(10);
    list.add(70);
    wmap.put("ic", list);
    list = new ArrayList<Integer>(3);
    list.add(50);
    list.add(15);
    list.add(35);
    wmap.put("id", list);
    filterEvent.setKeyMap(kmap);
    filterEvent.setKeyWeights(wmap);
    filterEvent.setPassFilter(10);
    filterEvent.setTotalFilter(100);
    HashMapOperator hmapOper = dag.addOperator("hmapOper", new HashMapOperator());
    DevNull<HashMap<String, Double>> dev = dag.addOperator("dev", new DevNull());
    dag.addStream("filter1", hmapOper.hmap_data, filterEvent.data).setLocality(locality);
    dag.addStream("filer2", filterEvent.filter, dev.data).setLocality(locality);
}
Also used : FilteredEventClassifier(org.apache.apex.malhar.lib.testbench.FilteredEventClassifier) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) DevNull(org.apache.apex.malhar.lib.stream.DevNull)

Example 3 with DevNull

use of org.apache.apex.malhar.lib.stream.DevNull in project apex-malhar by apache.

the class RandomEventGeneratorApp method populateDAG.

@Override
public void populateDAG(DAG dag, Configuration conf) {
    RandomEventGenerator random = dag.addOperator("random", new RandomEventGenerator());
    DevNull<Integer> dev1 = dag.addOperator("dev1", new DevNull());
    DevNull<String> dev2 = dag.addOperator("dev2", new DevNull());
    dag.addStream("random1", random.integer_data, dev1.data).setLocality(locality);
    dag.addStream("random2", random.string_data, dev2.data).setLocality(locality);
}
Also used : DevNull(org.apache.apex.malhar.lib.stream.DevNull) RandomEventGenerator(org.apache.apex.malhar.lib.testbench.RandomEventGenerator)

Example 4 with DevNull

use of org.apache.apex.malhar.lib.stream.DevNull in project apex-malhar by apache.

the class AbstractWindowedOperatorBenchmarkApp method populateDAG.

@Override
public void populateDAG(DAG dag, Configuration conf) {
    TestStatsListener sl = new TestStatsListener();
    sl.adjustRate = conf.getBoolean("dt.ManagedStateBenchmark.adjustRate", false);
    G generator = createGenerator();
    dag.addOperator("Generator", generator);
    // generator.setRange(timeRange);
    dag.setAttribute(generator, OperatorContext.STATS_LISTENERS, Lists.newArrayList((StatsListener) sl));
    O windowedOperator = createWindowedOperator(conf);
    dag.addOperator("windowedOperator", windowedOperator);
    dag.setAttribute(windowedOperator, OperatorContext.STATS_LISTENERS, Lists.newArrayList((StatsListener) sl));
    // dag.addStream("Data", generator.data, windowedOperator.input).setLocality(Locality.CONTAINER_LOCAL);
    connectGeneratorToWindowedOperator(dag, generator, windowedOperator);
    // WatermarkGenerator watermarkGenerator = new WatermarkGenerator();
    // dag.addOperator("WatermarkGenerator", watermarkGenerator);
    // dag.addStream("Control", watermarkGenerator.control, windowedOperator.controlInput)
    // .setLocality(Locality.CONTAINER_LOCAL);
    DevNull output = dag.addOperator("output", new DevNull());
    dag.addStream("output", windowedOperator.output, output.data).setLocality(Locality.CONTAINER_LOCAL);
}
Also used : DAG(com.datatorrent.api.DAG) DevNull(org.apache.apex.malhar.lib.stream.DevNull) StatsListener(com.datatorrent.api.StatsListener)

Example 5 with DevNull

use of org.apache.apex.malhar.lib.stream.DevNull in project apex-malhar by apache.

the class EventGeneratorApp method populateDAG.

@Override
public void populateDAG(DAG dag, Configuration conf) {
    EventGenerator eventGenerator = dag.addOperator("eventGenerator", new EventGenerator());
    dag.getMeta(eventGenerator).getMeta(eventGenerator.count).getAttributes().put(PortContext.QUEUE_CAPACITY, QUEUE_CAPACITY);
    DevNull<String> devString = dag.addOperator("devString", new DevNull());
    DevNull<HashMap<String, Double>> devMap = dag.addOperator("devMap", new DevNull());
    DevNull<HashMap<String, Number>> devInt = dag.addOperator("devInt", new DevNull());
    dag.addStream("EventGenString", eventGenerator.string_data, devString.data).setLocality(locality);
    dag.addStream("EventGenMap", eventGenerator.hash_data, devMap.data).setLocality(locality);
    dag.addStream("EventGenInt", eventGenerator.count, devInt.data).setLocality(locality);
}
Also used : EventGenerator(org.apache.apex.malhar.lib.testbench.EventGenerator) HashMap(java.util.HashMap) DevNull(org.apache.apex.malhar.lib.stream.DevNull)

Aggregations

DevNull (org.apache.apex.malhar.lib.stream.DevNull)11 HashMap (java.util.HashMap)7 ArrayList (java.util.ArrayList)4 DAG (com.datatorrent.api.DAG)1 StatsListener (com.datatorrent.api.StatsListener)1 StreamDuplicater (org.apache.apex.malhar.lib.stream.StreamDuplicater)1 EventClassifier (org.apache.apex.malhar.lib.testbench.EventClassifier)1 EventGenerator (org.apache.apex.malhar.lib.testbench.EventGenerator)1 EventIncrementer (org.apache.apex.malhar.lib.testbench.EventIncrementer)1 FilterClassifier (org.apache.apex.malhar.lib.testbench.FilterClassifier)1 FilteredEventClassifier (org.apache.apex.malhar.lib.testbench.FilteredEventClassifier)1 RandomEventGenerator (org.apache.apex.malhar.lib.testbench.RandomEventGenerator)1 SeedEventGenerator (org.apache.apex.malhar.lib.testbench.SeedEventGenerator)1 ThroughputCounter (org.apache.apex.malhar.lib.testbench.ThroughputCounter)1 KeyValPair (org.apache.apex.malhar.lib.util.KeyValPair)1