public static void SetLocalTopology() throws Exception { TopologyBuilder builder = new TopologyBuilder(); conf.put(TOPOLOGY_BOLT_PARALLELISM_HINT, 1); SetBuilder(builder, conf); LOG.debug("test"); LOG.info("Submit log"); LocalCluster cluster = new LocalCluster(); cluster.submitTopology("SplitMerge", conf, builder.createTopology()); Thread.sleep(60000); cluster.killTopology("SplitMerge"); cluster.shutdown(); }
public static void runTopologyLocally(StormTopology topology, String topologyName, Config conf, int runtimeInSeconds, Callback callback) throws Exception { LocalCluster cluster = new LocalCluster(); cluster.submitTopology(topologyName, conf, topology); if (runtimeInSeconds < 120) { JStormUtils.sleepMs(120 * 1000); } else { JStormUtils.sleepMs(runtimeInSeconds * 1000); } if (callback != null) { callback.execute(topologyName); } cluster.killTopology(topologyName); cluster.shutdown(); }
@Override public void run() { LOGGER.info("Shutting down the cluster..."); localCluster.killTopology(Constants.TOPOLOGY_NAME); localCluster.shutdown(); } });
@Override public void run() { cluster.killTopology(TOPOLOGY_NAME); cluster.shutdown(); } });
public static void submitLocal(String topologyName,Map conf, StormTopology stormTopology)throws Exception{ LOG.info("Submit Local"); LocalCluster cluster = new LocalCluster(); cluster.submitTopology(topologyName, conf, stormTopology); Thread.sleep(60000); cluster.killTopology(topologyName); cluster.shutdown(); LOG.info("shut down local cluster"); }
public void run() { if (storm.run.getLocalCluster() == null) { log.info("No local cluster started, nothing to shut down..."); return; } for (String topo : topologies) { log.info("Killing topology '{}'", topo); storm.run.getLocalCluster().killTopology(topo); } log.info("Shutting down local cluster..."); storm.run.stopLocalCluster(); } }
public static void submitLocal(String topologyName,Map conf, StormTopology stormTopology)throws Exception{ LOG.info("Submit Local"); LocalCluster cluster = new LocalCluster(); cluster.submitTopology(topologyName, conf, stormTopology); Thread.sleep(60000); cluster.killTopology(topologyName); cluster.shutdown(); } public static void main(String[] args) throws Exception {
/** * Run the topology locally * @param topology The topology to be executed * @param topologyName The name of the topology * @param conf The configurations for the execution * @param runtimeInSeconds For how much time the topology will run * @throws InterruptedException */ public static void runTopologyLocally(StormTopology topology, String topologyName, Config conf, int runtimeInSeconds) throws InterruptedException { LOG.info("Starting Storm on local mode to run for {} seconds", runtimeInSeconds); LocalCluster cluster = new LocalCluster(); LOG.info("Topology {} submitted", topologyName); cluster.submitTopology(topologyName, conf, topology); Thread.sleep((long) runtimeInSeconds * 1000); cluster.killTopology(topologyName); LOG.info("Topology {} finished", topologyName); cluster.shutdown(); LOG.info("Local Storm cluster was shutdown", topologyName); }
@Override public void finish(StormToolOptions options) throws Exception { try { if (sleepTime < 0) { logger.debug("Waiting forever"); while (true) { Utils.sleep(DEFAULT_SLEEP_TIME); } } else { logger.debug("Waiting " + sleepTime + " milliseconds"); Utils.sleep(sleepTime); } } finally { logger.debug("Killing topology"); cluster.killTopology(options.topologyName()); logger.debug("Shutting down cluster"); cluster.shutdown(); options.topologyCleanup(); } }
protected static void stopTopology() { if (cluster != null) { cluster.killTopology(TEST_TOPOLOGY_NAME); cluster.shutdown(); cluster = null; } } }
@Override public void finish(StormToolOptions options) throws Exception { try { if (sleepTime < 0) { logger.debug("Waiting forever"); while (true) { Utils.sleep(DEFAULT_SLEEP_TIME); } } else { logger.debug("Waiting " + sleepTime + " milliseconds"); Utils.sleep(sleepTime); } } finally { logger.debug("Killing topology"); cluster.killTopology(options.topologyName()); logger.debug("Shutting down cluster"); cluster.shutdown(); options.topologyCleanup(); } }
cluster.killTopology(topId);
public static void main(String[] args) throws InterruptedException { Config config = new Config(); config.setDebug(true); config.setNumWorkers(2); LocalCluster cluster = new LocalCluster(); cluster.submitTopology("test", config, createTopology()); LATCH.await(); System.out.println("Processing complete"); cluster.killTopology("test"); cluster.shutdown(); }
cluster.killTopology("exclamation");
cluster.killTopology("exclamation");
cluster.killTopology("exclamation");
cluster.killTopology("exclamation");
cluster.killTopology("exclamation");
public static void main(String[] args) { final Config conf = new Config(); conf.setDebug(false); conf.setNumWorkers(2); conf.setMaxSpoutPending(1); conf.setFallBackOnJavaSerialization(false); conf.setSkipMissingKryoRegistrations(false); final LocalCluster cluster = new LocalCluster(); final TopologyBuilder builder = new TopologyBuilder(); builder.setSpout("randomSpout1", new RandomFieldSpout(2, 0, 0, 1)); // (nfields,seed,min,max) builder.setSpout("randomSpout2", new RandomFieldSpout(2, 10, 0, 1)); // (nfields,seed,min,max) JoinBolt.connectNewBolt(builder); final StormTopology topology = builder.createTopology(); cluster.submitTopology("playTopology", conf, topology); Utils.sleep(10000); cluster.killTopology("playTopology"); cluster.shutdown(); } }
public static void main(String[] args) { final Config conf = new Config(); conf.setDebug(false); conf.setNumWorkers(2); conf.setMaxSpoutPending(1); conf.setFallBackOnJavaSerialization(false); conf.setSkipMissingKryoRegistrations(false); final LocalCluster cluster = new LocalCluster(); final TopologyBuilder builder = new TopologyBuilder(); builder.setSpout("randomSpout1", new RandomFieldSpout(2, 0, 0, 1)); // (nfields,seed,min,max) builder.setSpout("randomSpout2", new RandomFieldSpout(2, 10, 0, 1)); // (nfields,seed,min,max) JoinBolt.connectNewBolt(builder); final StormTopology topology = builder.createTopology(); cluster.submitTopology("playTopology", conf, topology); Utils.sleep(10000); cluster.killTopology("playTopology"); cluster.shutdown(); } }