use of backtype.storm.generated.KillOptions in project jstorm by alibaba.
the class kill_topology method main.
public static void main(String[] args) {
if (args == null || args.length == 0) {
throw new InvalidParameterException("Please input topology name");
}
String topologyName = args[0];
NimbusClient client = null;
try {
Map conf = Utils.readStormConfig();
client = NimbusClient.getConfiguredClient(conf);
if (args.length == 1) {
client.getClient().killTopology(topologyName);
} else {
int delaySeconds = Integer.parseInt(args[1]);
KillOptions options = new KillOptions();
options.set_wait_secs(delaySeconds);
client.getClient().killTopologyWithOpts(topologyName, options);
}
System.out.println("Successfully submit command kill " + topologyName);
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
throw new RuntimeException(e);
} finally {
if (client != null) {
client.close();
}
}
}
use of backtype.storm.generated.KillOptions in project jstorm by alibaba.
the class JStormHelper method cleanCluster.
public static void cleanCluster() {
try {
NimbusClient client = getNimbusClient(null);
ClusterSummary clusterSummary = client.getClient().getClusterInfo();
List<TopologySummary> topologySummaries = clusterSummary.get_topologies();
KillOptions killOption = new KillOptions();
killOption.set_wait_secs(1);
for (TopologySummary topologySummary : topologySummaries) {
client.getClient().killTopologyWithOpts(topologySummary.get_name(), killOption);
LOG.info("Successfully kill " + topologySummary.get_name());
}
} catch (Exception e) {
if (client != null) {
client.close();
client = null;
}
LOG.error("Failed to kill all topology ", e);
}
}
use of backtype.storm.generated.KillOptions in project jstorm by alibaba.
the class JStormHelper method killTopology.
public static void killTopology(Map conf, String topologyName) throws Exception {
NimbusClientWrapper client = new NimbusClientWrapper();
try {
Map clusterConf = Utils.readStormConfig();
clusterConf.putAll(conf);
client.init(clusterConf);
KillOptions killOption = new KillOptions();
killOption.set_wait_secs(1);
client.getClient().killTopologyWithOpts(topologyName, killOption);
} finally {
client.cleanup();
}
}
use of backtype.storm.generated.KillOptions in project storm-hbase by ypf412.
the class StormTestUtil method killToplogy.
/**
* Kill Storm test topology
*
* @throws Exception
*/
private void killToplogy() {
KillOptions opt = new KillOptions();
opt.set_wait_secs(2);
cluster.killTopologyWithOpts(TEST_TOPO_NAME, opt);
Utils.sleep(3000);
}
Aggregations