Search in sources :

Example 6 with TopologySummary

use of backtype.storm.generated.TopologySummary 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);
    }
    return;
}
Also used : ClusterSummary(backtype.storm.generated.ClusterSummary) NimbusClient(backtype.storm.utils.NimbusClient) TopologySummary(backtype.storm.generated.TopologySummary) KillOptions(backtype.storm.generated.KillOptions)

Example 7 with TopologySummary

use of backtype.storm.generated.TopologySummary in project jstorm by alibaba.

the class ServiceHandler method getClusterInfo.

/**
     * get cluster's summary, it will contain SupervisorSummary and TopologySummary
     *
     * @return ClusterSummary
     */
@Override
public ClusterSummary getClusterInfo() throws TException {
    long start = System.nanoTime();
    try {
        StormClusterState stormClusterState = data.getStormClusterState();
        Map<String, Assignment> assignments = new HashMap<String, Assignment>();
        // get TopologySummary
        List<TopologySummary> topologySummaries = NimbusUtils.getTopologySummary(stormClusterState, assignments);
        // all supervisors
        Map<String, SupervisorInfo> supervisorInfos = Cluster.get_all_SupervisorInfo(stormClusterState, null);
        // generate SupervisorSummaries
        List<SupervisorSummary> supervisorSummaries = NimbusUtils.mkSupervisorSummaries(supervisorInfos, assignments);
        NimbusSummary nimbusSummary = NimbusUtils.getNimbusSummary(stormClusterState, supervisorSummaries, data);
        return new ClusterSummary(nimbusSummary, supervisorSummaries, topologySummaries);
    } catch (TException e) {
        LOG.info("Failed to get ClusterSummary ", e);
        throw e;
    } catch (Exception e) {
        LOG.info("Failed to get ClusterSummary ", e);
        throw new TException(e);
    } finally {
        long end = System.nanoTime();
        SimpleJStormMetric.updateNimbusHistogram("getClusterInfo", (end - start) / TimeUtils.NS_PER_US);
    }
}
Also used : TException(org.apache.thrift.TException) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) ClusterSummary(backtype.storm.generated.ClusterSummary) SupervisorSummary(backtype.storm.generated.SupervisorSummary) NimbusSummary(backtype.storm.generated.NimbusSummary) SupervisorInfo(com.alibaba.jstorm.daemon.supervisor.SupervisorInfo) InvalidParameterException(java.security.InvalidParameterException) FailedAssignTopologyException(com.alibaba.jstorm.utils.FailedAssignTopologyException) KeyNotFoundException(backtype.storm.generated.KeyNotFoundException) TException(org.apache.thrift.TException) IOException(java.io.IOException) AlreadyAliveException(backtype.storm.generated.AlreadyAliveException) TopologyAssignException(backtype.storm.generated.TopologyAssignException) FileNotFoundException(java.io.FileNotFoundException) NotAliveException(backtype.storm.generated.NotAliveException) InvalidTopologyException(backtype.storm.generated.InvalidTopologyException) KeyAlreadyExistsException(backtype.storm.generated.KeyAlreadyExistsException) Assignment(com.alibaba.jstorm.schedule.Assignment) StormClusterState(com.alibaba.jstorm.cluster.StormClusterState) TopologySummary(backtype.storm.generated.TopologySummary)

Aggregations

TopologySummary (backtype.storm.generated.TopologySummary)7 ClusterSummary (backtype.storm.generated.ClusterSummary)5 NotAliveException (backtype.storm.generated.NotAliveException)3 Assignment (com.alibaba.jstorm.schedule.Assignment)3 AlreadyAliveException (backtype.storm.generated.AlreadyAliveException)2 InvalidTopologyException (backtype.storm.generated.InvalidTopologyException)2 KeyAlreadyExistsException (backtype.storm.generated.KeyAlreadyExistsException)2 KeyNotFoundException (backtype.storm.generated.KeyNotFoundException)2 SupervisorSummary (backtype.storm.generated.SupervisorSummary)2 TopologyAssignException (backtype.storm.generated.TopologyAssignException)2 StormBase (com.alibaba.jstorm.cluster.StormBase)2 StormClusterState (com.alibaba.jstorm.cluster.StormClusterState)2 FailedAssignTopologyException (com.alibaba.jstorm.utils.FailedAssignTopologyException)2 FileNotFoundException (java.io.FileNotFoundException)2 IOException (java.io.IOException)2 InvalidParameterException (java.security.InvalidParameterException)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 TException (org.apache.thrift.TException)2