Пример #1
0
  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());
    }
  }
Пример #2
0
 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);
   }
 }
Пример #3
0
 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;
   }
 }
Пример #4
0
 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;
   }
 }