List<String> topologyNames = cmd.getArgList(); ClusterSummary clusterSummary = client.getClusterInfo(); for (TopologySummary topologySummary: clusterSummary.get_topologies()) { if (topologyNames.isEmpty() || topologyNames.contains(topologySummary.get_name())) {
/** * /api/v1/cluster/summary -> cluster summary. */ @GET @Path("/cluster/summary") @AuthNimbusOp("getClusterInfo") @Produces("application/json") public Response getClusterSummary(@QueryParam(callbackParameterName) String callback) throws TException { clusterSummaryRequestMeter.mark(); try (NimbusClient nimbusClient = NimbusClient.getConfiguredClient(config)) { String user = servletRequest.getRemoteUser(); return UIHelpers.makeStandardResponse( UIHelpers.getClusterSummary( nimbusClient.getClient().getClusterInfo(), user, config), callback ); } }
List<String> topologyNames = cmd.getArgList(); ClusterSummary clusterSummary = client.getClusterInfo(); for (TopologySummary topologySummary: clusterSummary.get_topologies()) { if (topologyNames.isEmpty() || topologyNames.contains(topologySummary.get_name())) {
ClusterSummary stormCluster = nimbus.getClusterInfo(); int totalNumWorkers = stormCluster.get_supervisors().stream() .mapToInt(SupervisorSummary::get_num_workers).sum();
private void outputMetrics(Nimbus.Iface client, Collection<String> names) throws Exception { ClusterSummary summary = client.getClusterInfo(); Set<String> ids = new HashSet<>(); for (TopologySummary ts: summary.get_topologies()) {
ClusterSummary summary = client.getClusterInfo(); for (TopologySummary topo : summary.get_topologies()) { if (topologyName.equals(topo.get_name())) {
ClusterSummary clusterSummary = client.getClusterInfo(); TopologySummary topologySummary = null; for (TopologySummary ts : clusterSummary.get_topologies()) {
public static void printMetrics(Nimbus.Iface client, String name) throws Exception { ClusterSummary summary = client.getClusterInfo(); String id = null; for (TopologySummary ts : summary.get_topologies()) {
public static void printMetrics(Nimbus.Iface client, String name) throws Exception { ClusterSummary summary = client.getClusterInfo(); String id = null; for (TopologySummary ts : summary.get_topologies()) {
static void printMetrics(Nimbus.Iface client, String name) throws Exception { ClusterSummary summary = client.getClusterInfo(); String id = null; for (TopologySummary ts : summary.get_topologies()) {
/** * Get a specific owner resource summary. * @param ownerResourceSummaries Result from thrift call. * @param client client * @param id Owner id. * @param config Storm conf. * @return prettified owner resource summary. */ public static Map<String, Object> getOwnerResourceSummary( List<OwnerResourceSummary> ownerResourceSummaries, Nimbus.Iface client, String id, Map<String, Object> config) throws TException { Map<String, Object> result = new HashMap(); result.put("schedulerDisplayResource", config.get(DaemonConfig.SCHEDULER_DISPLAY_RESOURCE)); if (ownerResourceSummaries.isEmpty()) { return unpackOwnerResourceSummary(new OwnerResourceSummary(id)); } List<TopologySummary> topologies = null; topologies = client.getClusterInfo().get_topologies(); List<Map> topologySummaries = getTopologiesMap(id, topologies); result.putAll(unpackOwnerResourceSummary(ownerResourceSummaries.get(0))); result.put("topologies", topologySummaries); return result; }
/** * /api/v1/supervisor/summary -> topo history. */ @GET @Path("/supervisor/summary") @AuthNimbusOp("getClusterInfo") @Produces("application/json") public Response getSupervisorSummary(@Context SecurityContext securityContext, @QueryParam(callbackParameterName) String callback) throws TException { supervisorSummaryRequestMeter.mark(); try (NimbusClient nimbusClient = NimbusClient.getConfiguredClient(config)) { return UIHelpers.makeStandardResponse( UIHelpers.getSupervisorSummary( nimbusClient.getClient().getClusterInfo().get_supervisors(), securityContext, config ), callback ); } }
private HashSet<String> getComponents(Nimbus.Iface client, String topology) throws Exception { HashSet<String> components = new HashSet<>(); ClusterSummary clusterSummary = client.getClusterInfo(); TopologySummary topologySummary = null; for (TopologySummary ts : clusterSummary.get_topologies()) { if (topology.equals(ts.get_name())) { topologySummary = ts; break; } } if (topologySummary == null) { throw new IllegalArgumentException("topology: " + topology + " not found"); } else { String id = topologySummary.get_id(); GetInfoOptions getInfoOpts = new GetInfoOptions(); getInfoOpts.set_num_err_choice(NumErrorsChoice.NONE); TopologyInfo info = client.getTopologyInfoWithOpts(id, getInfoOpts); for (ExecutorSummary es : info.get_executors()) { components.add(es.get_component_id()); } } return components; }
/** * /api/v1/topology/summary -> topo history. */ @GET @Path("/topology/summary") @AuthNimbusOp("getClusterInfo") @Produces("application/json") public Response getTopologySummary(@Context SecurityContext securityContext, @QueryParam(callbackParameterName) String callback) throws TException { allTopologiesSummaryRequestMeter.mark(); try (NimbusClient nimbusClient = NimbusClient.getConfiguredClient(config)) { return UIHelpers.makeStandardResponse( UIHelpers.getAllTopologiesSummary( nimbusClient.getClient().getClusterInfo().get_topologies(), config ), callback ); } }
@Override public void run(Nimbus.Iface nimbus) throws Exception { List<TopologySummary> topologies = nimbus.getClusterInfo().get_topologies(); if (topologies == null || topologies.isEmpty()) { System.out.println("No topologies running."); } else { System.out.printf(MSG_FORMAT, "Topology_name", "Status", "Num_tasks", "Num_workers", "Uptime_secs", "Topology_Id", "Owner"); System.out.println("----------------------------------------------------------------------------------------"); for (TopologySummary topology : topologies) { System.out.printf(MSG_FORMAT, topology.get_name(), topology.get_status(), topology.get_num_tasks(), topology.get_num_workers(), topology.get_uptime_secs(), topology.get_id(), topology.get_owner()); } } } });
/** * /api/v1/nimbus/summary -> nimbus summary. */ @GET @Path("/nimbus/summary") @AuthNimbusOp("getClusterInfo") @Produces("application/json") public Response getNimbusSummary(@QueryParam(callbackParameterName) String callback) throws TException { nimbusSummaryRequestMeter.mark(); try (NimbusClient nimbusClient = NimbusClient.getConfiguredClient(config)) { return UIHelpers.makeStandardResponse( UIHelpers.getNimbusSummary( nimbusClient.getClient().getClusterInfo(), config), callback ); } }
public static String getTopologyId(String name, Nimbus.Iface client) { try { ClusterSummary summary = client.getClusterInfo(); for (TopologySummary s : summary.get_topologies()) { if (s.get_name().equals(name)) { return s.get_id(); } } } catch (Exception e) { throw new RuntimeException(e); } return null; }
public static MetricsSample factory(Nimbus.Iface client, String topologyName) throws Exception { // "************ Sampling Metrics ***************** ClusterSummary clusterSummary = client.getClusterInfo(); // get topology info TopologySummary topSummary = getTopologySummary(clusterSummary, topologyName); int topologyExecutors = topSummary.get_num_executors(); int topologyWorkers = topSummary.get_num_workers(); int topologyTasks = topSummary.get_num_tasks(); TopologyInfo topInfo = client.getTopologyInfo(topSummary.get_id()); MetricsSample sample = getMetricsSample(topInfo); sample.numWorkers = topologyWorkers; sample.numExecutors = topologyExecutors; sample.numTasks = topologyTasks; return sample; }