Search in sources :

Example 1 with RandomEventGenerator

use of org.apache.apex.malhar.lib.testbench.RandomEventGenerator 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 2 with RandomEventGenerator

use of org.apache.apex.malhar.lib.testbench.RandomEventGenerator in project apex-malhar by apache.

the class RubyOperatorBenchmarkApplication method populateDAG.

@Override
public void populateDAG(DAG dag, Configuration conf) {
    RandomEventGenerator rand = dag.addOperator("rand", new RandomEventGenerator());
    rand.setMaxvalue(3000);
    rand.setTuplesBlast(120);
    RandomMapOutput randMap = dag.addOperator("randMap", new RandomMapOutput());
    randMap.setKey("val");
    RubyOperator ruby = dag.addOperator("ruby", new RubyOperator());
    String setupScript = "def square(val)\n";
    setupScript += "  return val*val\nend\n";
    ruby.addSetupScript(setupScript);
    ruby.setInvoke("square");
    ruby.setPassThru(true);
    ConsoleOutputOperator console = dag.addOperator("console", new ConsoleOutputOperator());
    dag.getMeta(console).getMeta(console.input).getAttributes().put(PortContext.QUEUE_CAPACITY, QUEUE_CAPACITY);
    dag.getMeta(ruby).getMeta(ruby.result).getAttributes().put(PortContext.QUEUE_CAPACITY, QUEUE_CAPACITY);
    dag.addStream("rand_randMap", rand.integer_data, randMap.input).setLocality(Locality.THREAD_LOCAL);
    dag.addStream("randMap_ruby", randMap.map_data, ruby.inBindings).setLocality(locality);
    dag.addStream("ruby_console", ruby.result, console.input).setLocality(locality);
}
Also used : ConsoleOutputOperator(org.apache.apex.malhar.lib.io.ConsoleOutputOperator) RandomMapOutput(org.apache.apex.benchmark.RandomMapOutput) RubyOperator(org.apache.apex.malhar.contrib.ruby.RubyOperator) RandomEventGenerator(org.apache.apex.malhar.lib.testbench.RandomEventGenerator)

Example 3 with RandomEventGenerator

use of org.apache.apex.malhar.lib.testbench.RandomEventGenerator in project apex-malhar by apache.

the class CassandraOutputBenchmarkApplication method populateDAG.

@Override
public void populateDAG(DAG dag, Configuration conf) {
    int maxValue = 1000;
    RandomEventGenerator rand = dag.addOperator("rand", new RandomEventGenerator());
    rand.setMinvalue(0);
    rand.setMaxvalue(maxValue);
    rand.setTuplesBlast(200);
    CassandraOutputOperator cassandra = dag.addOperator("cassandra", new CassandraOutputOperator());
    CassandraTransactionalStore store = new CassandraTransactionalStore();
    store.setKeyspace("test");
    store.setNode("127.0.0.1");
    cassandra.setStore(store);
    dag.addStream("rand_cassandra", rand.integer_data, cassandra.input).setLocality(locality);
}
Also used : RandomEventGenerator(org.apache.apex.malhar.lib.testbench.RandomEventGenerator) CassandraTransactionalStore(org.apache.apex.malhar.contrib.cassandra.CassandraTransactionalStore)

Example 4 with RandomEventGenerator

use of org.apache.apex.malhar.lib.testbench.RandomEventGenerator in project apex-malhar by apache.

the class TestNiFiOutputApplication method populateDAG.

@Override
public void populateDAG(DAG dag, Configuration conf) {
    final SiteToSiteClientConfig clientConfig = new SiteToSiteClient.Builder().url("http://localhost:8080/nifi").portName("Apex").buildConfig();
    final int batchSize = 1;
    final SiteToSiteClient.Builder builder = new SiteToSiteClient.Builder().fromConfig(clientConfig);
    final NiFiDataPacketBuilder<String> dataPacketBuilder = new StringNiFiDataPacketBuilder();
    final WindowDataManager windowDataManager = new WindowDataManager.NoopWindowDataManager();
    RandomEventGenerator rand = dag.addOperator("rand", new RandomEventGenerator());
    NiFiSinglePortOutputOperator nifi = dag.addOperator("nifi", new NiFiSinglePortOutputOperator(builder, dataPacketBuilder, windowDataManager, batchSize));
    dag.addStream("rand_nifi", rand.string_data, nifi.inputPort).setLocality(null);
}
Also used : SiteToSiteClient(org.apache.nifi.remote.client.SiteToSiteClient) NiFiSinglePortOutputOperator(org.apache.apex.malhar.contrib.nifi.NiFiSinglePortOutputOperator) SiteToSiteClientConfig(org.apache.nifi.remote.client.SiteToSiteClientConfig) WindowDataManager(org.apache.apex.malhar.lib.wal.WindowDataManager) RandomEventGenerator(org.apache.apex.malhar.lib.testbench.RandomEventGenerator)

Example 5 with RandomEventGenerator

use of org.apache.apex.malhar.lib.testbench.RandomEventGenerator in project apex-malhar by apache.

the class CouchBaseAppOutput method populateDAG.

@Override
public void populateDAG(DAG dag, Configuration conf) {
    int maxValue = 1000;
    RandomEventGenerator rand = dag.addOperator("rand", new RandomEventGenerator());
    rand.setMinvalue(0);
    rand.setMaxvalue(maxValue);
    rand.setTuplesBlast(200);
    CouchBaseOutputOperator couchbaseOutput = dag.addOperator("couchbaseOutput", new CouchBaseOutputOperator());
    // couchbaseOutput.getStore().setBucket("default");
    // couchbaseOutput.getStore().setPassword("");
    dag.addStream("ss", rand.integer_data, couchbaseOutput.input).setLocality(locality);
}
Also used : RandomEventGenerator(org.apache.apex.malhar.lib.testbench.RandomEventGenerator)

Aggregations

RandomEventGenerator (org.apache.apex.malhar.lib.testbench.RandomEventGenerator)14 ConsoleOutputOperator (org.apache.apex.malhar.lib.io.ConsoleOutputOperator)6 RandomMapOutput (org.apache.apex.benchmark.RandomMapOutput)2 Counter (org.apache.apex.malhar.lib.stream.Counter)2 Operator (com.datatorrent.api.Operator)1 StatsListener (com.datatorrent.api.StatsListener)1 DefaultDelayOperator (com.datatorrent.common.util.DefaultDelayOperator)1 URI (java.net.URI)1 SQLException (java.sql.SQLException)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 Random (java.util.Random)1 AerospikeTransactionalStore (org.apache.apex.malhar.contrib.aerospike.AerospikeTransactionalStore)1 CassandraTransactionalStore (org.apache.apex.malhar.contrib.cassandra.CassandraTransactionalStore)1 NiFiSinglePortOutputOperator (org.apache.apex.malhar.contrib.nifi.NiFiSinglePortOutputOperator)1 RubyOperator (org.apache.apex.malhar.contrib.ruby.RubyOperator)1 HiveOperator (org.apache.apex.malhar.hive.HiveOperator)1 HiveStore (org.apache.apex.malhar.hive.HiveStore)1 UniqueCounter (org.apache.apex.malhar.lib.algo.UniqueCounter)1 AppDataSnapshotServerMap (org.apache.apex.malhar.lib.appdata.snapshot.AppDataSnapshotServerMap)1