public void rebalance() { int rebalanceDelay = 20; int activateDelay = 10; save(); // deactivate(); // timer.schedule(new ActivateTask(this), (rebalanceDelay + activateDelay) * 1000); // prevent nimbus from getting confused // if (localCluster != null) { // deactivate(); // timer.schedule(new ActivateTask(this), (rebalanceDelay + activateDelay) * 1000); // } LOG.info("parallelism rebalance " + System.currentTimeMillis()); for (String component : parallelism.keySet()) { LOG.info("parallelism " + component + " " + parallelism.get(component)); } RebalanceOptions options = new RebalanceOptions(); options.set_num_executors(parallelism); options.set_wait_secs(rebalanceDelay); try { System.out.println("REBALANCING: " + parallelism); if (localCluster != null) { localCluster.rebalance(topologyName, options); } else { NimbusClient client = NimbusClient.getConfiguredClient(stormConf); client.getClient().rebalance(topologyName, options); } } catch (Exception e) { System.out.println("rebalance() exception: " + e.toString()); } }
public void activate() { try { if (localCluster != null) { localCluster.activate(topologyName); } else { NimbusClient client = NimbusClient.getConfiguredClient(stormConf); client.getClient().activate(topologyName); } } catch (Exception e) { System.out.println("activate() exception: " + e); } }
public ClusterSummary getClusterInfo() { try { if (localCluster != null) { return localCluster.getClusterInfo(); } else { NimbusClient client = NimbusClient.getConfiguredClient(stormConf); return client.getClient().getClusterInfo(); } } catch (Exception e) { System.out.println("getClusterInfo() exception: " + e); return null; } }
public String topologyStatus() { try { if (localCluster != null) { return localCluster.getTopologyInfo(topologyContext.getStormId()).get_status(); } else { NimbusClient client = NimbusClient.getConfiguredClient(stormConf); return client.getClient().getTopologyInfo(topologyContext.getStormId()).get_status(); } } catch (Exception e) { System.out.println("topologyStatus() exception: " + e); return null; } }