Search in sources :

Example 41 with NimbusClient

use of backtype.storm.utils.NimbusClient in project jstorm by alibaba.

the class ClusterAPIController method workers.

@RequestMapping("/supervisor/{host:.+}")
public Map workers(@PathVariable String clusterName, @PathVariable String host, @RequestParam(value = "window", required = false) String window) {
    Map<String, Object> ret = new HashMap<>();
    int win = UIUtils.parseWindow(window);
    NimbusClient client = null;
    try {
        client = NimbusClientManager.getNimbusClient(clusterName);
        SupervisorWorkers supervisorWorkers = client.getClient().getSupervisorWorkers(host);
        ret.put("supervisor", new SupervisorEntity(supervisorWorkers.get_supervisor()));
        // get worker summary
        List<WorkerSummary> workerSummaries = supervisorWorkers.get_workers();
        ret.put("workers", UIUtils.getWorkerEntities(workerSummaries));
        Map<String, MetricInfo> workerMetricInfo = supervisorWorkers.get_workerMetric();
        List<UIWorkerMetric> workerMetrics = UIMetricUtils.getWorkerMetrics(workerMetricInfo, workerSummaries, host, win);
        ret.put("workerMetrics", workerMetrics);
    } catch (Exception e) {
        NimbusClientManager.removeClient(clusterName);
        ret = UIUtils.exceptionJson(e);
        LOG.error(e.getMessage(), e);
    }
    return ret;
}
Also used : HashMap(java.util.HashMap) NimbusClient(backtype.storm.utils.NimbusClient) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 42 with NimbusClient

use of backtype.storm.utils.NimbusClient in project jstorm by alibaba.

the class ClusterAPIController method nimbus.

@RequestMapping("/nimbus/summary")
public Map nimbus(@PathVariable String clusterName) {
    Map ret;
    NimbusClient client = null;
    try {
        client = NimbusClientManager.getNimbusClient(clusterName);
        ClusterSummary clusterSummary = client.getClient().getClusterInfo();
        ret = new HashMap<>();
        ret.put("nimbus", UIUtils.getNimbusEntities(clusterSummary));
    } catch (Exception e) {
        NimbusClientManager.removeClient(clusterName);
        ret = UIUtils.exceptionJson(e);
        LOG.error(e.getMessage(), e);
    }
    return ret;
}
Also used : NimbusClient(backtype.storm.utils.NimbusClient) HashMap(java.util.HashMap) Map(java.util.Map) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

NimbusClient (backtype.storm.utils.NimbusClient)42 Map (java.util.Map)20 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)16 HashMap (java.util.HashMap)9 TException (org.apache.thrift.TException)8 InvalidParameterException (java.security.InvalidParameterException)6 FileNotFoundException (java.io.FileNotFoundException)4 IOException (java.io.IOException)4 ModelMap (org.springframework.ui.ModelMap)4 ClusterSummary (backtype.storm.generated.ClusterSummary)3 KeyAlreadyExistsException (backtype.storm.generated.KeyAlreadyExistsException)3 KeyNotFoundException (backtype.storm.generated.KeyNotFoundException)3 TopologyInfo (backtype.storm.generated.TopologyInfo)3 NimbusInfo (backtype.storm.nimbus.NimbusInfo)3 FileExistsException (org.apache.commons.io.FileExistsException)3 TTransportException (org.apache.thrift.transport.TTransportException)3 KillOptions (backtype.storm.generated.KillOptions)2 MetricInfo (backtype.storm.generated.MetricInfo)2 UITaskMetric (com.alibaba.jstorm.ui.model.UITaskMetric)2 UIWorkerMetric (com.alibaba.jstorm.ui.model.UIWorkerMetric)2