use of org.apache.apex.malhar.lib.stream.DevNull in project apex-malhar by apache.
the class FilterClassifierApp method populateDAG.
@Override
public void populateDAG(DAG dag, Configuration conf) {
FilterClassifier filter = dag.addOperator("filter", new FilterClassifier());
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);
filter.setKeyMap(kmap);
filter.setKeyWeights(wmap);
filter.setPassFilter(10);
filter.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, filter.data).setLocality(locality);
dag.addStream("filer2", filter.filter, dev.data).setLocality(locality);
}
use of org.apache.apex.malhar.lib.stream.DevNull in project apex-malhar by apache.
the class App method populateDAG.
@Override
public void populateDAG(DAG dag, Configuration conf) {
Gen gen = dag.addOperator("gen", Gen.class);
DevNull devNull = dag.addOperator("devNull", DevNull.class);
dag.addStream("data", gen.out, devNull.data);
}
use of org.apache.apex.malhar.lib.stream.DevNull in project apex-malhar by apache.
the class SeedEventGeneratorApp method populateDAG.
@Override
public void populateDAG(DAG dag, Configuration conf) {
SeedEventGenerator seedEvent = dag.addOperator("seedEvent", new SeedEventGenerator());
seedEvent.addKeyData("x", 0, 9);
seedEvent.addKeyData("y", 0, 9);
seedEvent.addKeyData("gender", 0, 1);
seedEvent.addKeyData("age", 10, 19);
DevNull<HashMap<String, String>> devString = dag.addOperator("devString", new DevNull<HashMap<String, String>>());
DevNull<HashMap<String, ArrayList<KeyValPair>>> devKeyVal = dag.addOperator("devKeyVal", new DevNull());
DevNull<HashMap<String, String>> devVal = dag.addOperator("devVal", new DevNull<HashMap<String, String>>());
DevNull<HashMap<String, ArrayList<Integer>>> devList = dag.addOperator("devList", new DevNull());
dag.getMeta(seedEvent).getMeta(seedEvent.string_data).getAttributes().put(PortContext.QUEUE_CAPACITY, QUEUE_CAPACITY);
dag.addStream("SeedEventGeneratorString", seedEvent.string_data, devString.data).setLocality(locality);
dag.getMeta(seedEvent).getMeta(seedEvent.keyvalpair_list).getAttributes().put(PortContext.QUEUE_CAPACITY, QUEUE_CAPACITY);
dag.addStream("SeedEventGeneratorKeyVal", seedEvent.keyvalpair_list, devKeyVal.data).setLocality(locality);
dag.getMeta(seedEvent).getMeta(seedEvent.val_data).getAttributes().put(PortContext.QUEUE_CAPACITY, QUEUE_CAPACITY);
dag.addStream("SeedEventGeneratorVal", seedEvent.val_data, devVal.data).setLocality(locality);
dag.getMeta(seedEvent).getMeta(seedEvent.val_list).getAttributes().put(PortContext.QUEUE_CAPACITY, QUEUE_CAPACITY);
dag.addStream("SeedEventGeneratorValList", seedEvent.val_list, devList.data).setLocality(locality);
}
use of org.apache.apex.malhar.lib.stream.DevNull in project apex-malhar by apache.
the class StreamDuplicaterApp method populateDAG.
@Override
public void populateDAG(DAG dag, Configuration conf) {
// RandomEventGenerator rand = dag.addOperator("rand", new RandomEventGenerator());
// rand.setMinvalue(0);
// rand.setMaxvalue(999999);
// rand.setTuplesBlastIntervalMillis(50);
// dag.getMeta(rand).getMeta(rand.integer_data).getAttributes().put(PortContext.QUEUE_CAPACITY, QUEUE_CAPACITY);
IntegerOperator intInput = dag.addOperator("intInput", new IntegerOperator());
StreamDuplicater stream = dag.addOperator("stream", new StreamDuplicater());
dag.getMeta(stream).getMeta(stream.data).getAttributes().put(PortContext.QUEUE_CAPACITY, QUEUE_CAPACITY);
dag.addStream("streamdup1", intInput.integer_data, stream.data).setLocality(locality);
DevNull<Integer> dev1 = dag.addOperator("dev1", new DevNull());
DevNull<Integer> dev2 = dag.addOperator("dev2", new DevNull());
dag.addStream("streamdup2", stream.out1, dev1.data).setLocality(locality);
dag.addStream("streamdup3", stream.out2, dev2.data).setLocality(locality);
}
use of org.apache.apex.malhar.lib.stream.DevNull in project apex-malhar by apache.
the class EventClassifierApp method populateDAG.
@Override
public void populateDAG(DAG dag, Configuration conf) {
HashMap<String, Double> keymap = new HashMap<String, Double>();
keymap.put("a", 1.0);
keymap.put("b", 4.0);
keymap.put("c", 5.0);
HashMap<String, ArrayList<Integer>> wmap = new HashMap<String, ArrayList<Integer>>();
ArrayList<Integer> list = new ArrayList<Integer>(3);
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);
HashMapOperator hmapOper = dag.addOperator("hmapOper", new HashMapOperator());
dag.getMeta(hmapOper).getMeta(hmapOper.hmap_data).getAttributes().put(PortContext.QUEUE_CAPACITY, QUEUE_CAPACITY);
EventClassifier eventClassifier = dag.addOperator("eventClassifier", new EventClassifier());
eventClassifier.setKeyMap(keymap);
eventClassifier.setOperationReplace();
eventClassifier.setKeyWeights(wmap);
dag.getMeta(eventClassifier).getMeta(eventClassifier.data).getAttributes().put(PortContext.QUEUE_CAPACITY, QUEUE_CAPACITY);
dag.addStream("eventtest1", hmapOper.hmap_data, eventClassifier.event).setLocality(locality);
DevNull<HashMap<String, Double>> dev = dag.addOperator("dev", new DevNull());
dag.addStream("eventtest2", eventClassifier.data, dev.data).setLocality(locality);
}
Aggregations