use of org.apache.heron.api.Config in project heron by twitter.
the class ComponentJVMOptionsTopology method main.
public static void main(String[] args) throws Exception {
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout("word", new TestWordSpout(), 2);
builder.setBolt("exclaim1", new ExclamationBolt(), 2).shuffleGrouping("word").addConfiguration("test-config", // Sample adding component-specific config
"test-key");
Config conf = new Config();
conf.setDebug(true);
conf.setMaxSpoutPending(10);
// TOPOLOGY_WORKER_CHILDOPTS will be a global one
conf.put(Config.TOPOLOGY_WORKER_CHILDOPTS, "-XX:+HeapDumpOnOutOfMemoryError");
// For each component, both the global and if any the component one will be appended.
// And the component one will take precedence
conf.setComponentJvmOptions("word", "-XX:NewSize=300m");
conf.setComponentJvmOptions("exclaim1", "-XX:NewSize=300m");
// component resource configuration
conf.setComponentCpu("word", 0.5);
conf.setComponentRam("word", ByteAmount.fromMegabytes(512));
conf.setComponentDisk("word", ByteAmount.fromMegabytes(512));
conf.setComponentCpu("exclaim1", 0.5);
conf.setComponentRam("exclaim1", ByteAmount.fromMegabytes(512));
conf.setComponentDisk("exclaim1", ByteAmount.fromMegabytes(512));
// container resource configuration
conf.setContainerDiskRequested(ByteAmount.fromGigabytes(2));
conf.setContainerRamRequested(ByteAmount.fromGigabytes(3));
conf.setContainerCpuRequested(2);
// Specify the size of RAM padding to per container.
// Notice, this config will be considered as a hint,
// and it's up to the packing algorithm to determine whether to apply this hint
conf.setContainerRamPadding(ByteAmount.fromGigabytes(2));
if (args != null && args.length > 0) {
conf.setNumStmgrs(2);
HeronSubmitter.submitTopology(args[0], conf, builder.createTopology());
} else {
Simulator simulator = new Simulator();
simulator.submitTopology("test", conf, builder.createTopology());
Utils.sleep(10000);
simulator.killTopology("test");
simulator.shutdown();
}
}
use of org.apache.heron.api.Config in project heron by twitter.
the class SentenceWordCountTopology method main.
public static void main(String[] args) throws Exception {
String name = "fast-word-count-topology";
if (args != null && args.length > 0) {
name = args[0];
}
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout("spout", new FastRandomSentenceSpout(), 1);
builder.setBolt("split", new SplitSentence(), 2).shuffleGrouping("spout");
builder.setBolt("count", new WordCount(), 2).fieldsGrouping("split", new Fields("word"));
Config conf = new Config();
// component resource configuration
conf.setComponentRam("spout", ByteAmount.fromMegabytes(512));
conf.setComponentRam("split", ByteAmount.fromMegabytes(512));
conf.setComponentRam("count", ByteAmount.fromMegabytes(512));
// container resource configuration
conf.setContainerDiskRequested(ByteAmount.fromGigabytes(3));
conf.setContainerRamRequested(ByteAmount.fromGigabytes(4));
conf.setContainerCpuRequested(4);
conf.setNumStmgrs(2);
HeronSubmitter.submitTopology(name, conf, builder.createTopology());
}
use of org.apache.heron.api.Config in project heron by twitter.
the class ConfigUtils method translateComponentConfig.
/**
* Translate storm config to heron config for components
* @param stormConfig the storm config
* @return a heron config
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public static Config translateComponentConfig(Map stormConfig) {
Config heronConfig;
if (stormConfig != null) {
heronConfig = new Config((Map<String, Object>) stormConfig);
} else {
heronConfig = new Config();
}
doStormTranslation(heronConfig);
return heronConfig;
}
use of org.apache.heron.api.Config in project heron by twitter.
the class TopologyTestTopologyBuilder method createTopology.
@Override
public HeronTopology createTopology() {
TopologyAPI.Topology.Builder topologyBlr = super.createTopology().setConfig(new Config()).setName("").setState(TopologyAPI.TopologyState.RUNNING).getTopology().toBuilder();
// Clear unnecessary fields to make the state of TopologyAPI.Topology.Builder clean
topologyBlr.clearTopologyConfig().clearName().clearState();
// We wrap it to the new topologyBuilder
return new HeronTopology(topologyBlr);
}
use of org.apache.heron.api.Config in project heron by twitter.
the class StreamletWithSplitAndWithStream method main.
public static void main(String[] args) throws Exception {
Config conf = new Config();
StreamletWithSplitAndWithStream topology = new StreamletWithSplitAndWithStream(args);
topology.submit(conf);
}
Aggregations