use of com.twitter.heron.api.Config in project heron by twitter.
the class TopologyUtilsTest method testBadTopologyName.
@Test
public void testBadTopologyName() {
int componentParallelism = 2;
Map<String, Integer> spouts = new HashMap<>();
spouts.put("spout", componentParallelism);
Map<String, Integer> bolts = new HashMap<>();
bolts.put("bolt", componentParallelism);
Assert.assertFalse(TopologyUtils.verifyTopology(TopologyTests.createTopology("test.topology", /* Bad topology name */
new Config(), spouts, bolts)));
}
use of com.twitter.heron.api.Config in project heron by twitter.
the class PhysicalPlanUtilTest method getTestTopology.
/**
* Construct the test topology
*/
public static TopologyAPI.Topology getTestTopology() {
TopologyBuilder topologyBuilder = new TopologyBuilder();
topologyBuilder.setSpout("word", new BaseRichSpout() {
private static final long serialVersionUID = 5406114907377311020L;
@Override
public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer) {
outputFieldsDeclarer.declare(new Fields("word"));
}
@Override
public void open(Map<String, Object> map, TopologyContext topologyContext, SpoutOutputCollector spoutOutputCollector) {
}
@Override
public void nextTuple() {
}
}, 2);
topologyBuilder.setBolt("exclaim", new BaseBasicBolt() {
private static final long serialVersionUID = 4398578755681473899L;
@Override
public void execute(Tuple tuple, BasicOutputCollector basicOutputCollector) {
}
@Override
public void declareOutputFields(OutputFieldsDeclarer outputFieldsDeclarer) {
}
}, 2).shuffleGrouping("word");
Config conf = new Config();
conf.setDebug(true);
conf.setMaxSpoutPending(10);
conf.put(Config.TOPOLOGY_WORKER_CHILDOPTS, "-XX:+HeapDumpOnOutOfMemoryError");
conf.setComponentRam("word", ByteAmount.fromMegabytes(500));
conf.setComponentRam("exclaim", ByteAmount.fromGigabytes(1));
conf.setMessageTimeoutSecs(1);
return topologyBuilder.createTopology().setName("topology-name").setConfig(conf).setState(TopologyAPI.TopologyState.RUNNING).getTopology();
}
use of com.twitter.heron.api.Config in project streaming-samples by ashvina.
the class AckingWordCount2StageTopology method main.
public static void main(String[] args) throws Exception {
TopologyArgParser parser = new TopologyArgParser(args, SPOUT, COUNT);
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout(SPOUT, new AckingRandomWordSpout(), parser.get(SPOUT));
builder.setBolt(COUNT, new WordCount(), parser.get(COUNT)).fieldsGrouping(SPOUT, new Fields(WordCountTopologyHelper.FIELD_WORD));
Config conf = new Config();
conf.setDebug(false);
conf.setNumStmgrs(parser.getNumWorkers());
conf.setEnableAcking(true);
conf.setMaxSpoutPending(Integer.MAX_VALUE);
HeronSubmitter.submitTopology(args[0], conf, builder.createTopology());
}
use of com.twitter.heron.api.Config in project streaming-samples by ashvina.
the class AckingWordCountTopology method main.
public static void main(String[] args) throws Exception {
TopologyArgParser parser = new TopologyArgParser(args, SPOUT, SPLIT, COUNT);
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout(SPOUT, new AckingStormRandomSentenceSpout(), parser.get(SPOUT));
builder.setBolt(SPLIT, new SplitSentence(), parser.get(SPLIT)).shuffleGrouping(SPOUT);
builder.setBolt(COUNT, new WordCount(), parser.get(COUNT)).fieldsGrouping(SPLIT, new Fields(WordCountTopologyHelper.FIELD_WORD));
Config conf = new Config();
conf.setDebug(false);
conf.setNumStmgrs(parser.getNumWorkers());
conf.setEnableAcking(true);
conf.setMaxSpoutPending(Integer.MAX_VALUE);
HeronSubmitter.submitTopology(args[0], conf, builder.createTopology());
}
use of com.twitter.heron.api.Config in project streaming-samples by ashvina.
the class NoAckWordCountTopology method main.
public static void main(String[] args) throws Exception {
TopologyArgParser parser = new TopologyArgParser(args, SPOUT, SPLIT, COUNT);
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout(SPOUT, new NoAckStormRandomSentenceSpout(), parser.get(SPOUT));
builder.setBolt(SPLIT, new SplitSentence(), parser.get(SPLIT)).shuffleGrouping(SPOUT);
builder.setBolt(COUNT, new WordCount(), parser.get(COUNT)).fieldsGrouping(SPLIT, new Fields(WordCountTopologyHelper.FIELD_WORD));
Config conf = new Config();
conf.setDebug(false);
conf.setEnableAcking(false);
conf.setNumStmgrs(parser.getNumWorkers());
HeronSubmitter.submitTopology(args[0], conf, builder.createTopology());
}
Aggregations