Package backtype.storm.generated

Examples of backtype.storm.generated.TopologyInfo


        final String topologyConf = client.getTopologyConf(topologyID);
        sb.append("Topology configuration is \n");
        sb.append(topologyConf);
        sb.append("\n");

        final TopologyInfo topologyInfo = client.getTopologyInfo(topologyID);

        // print more about each task
        final Iterator<ExecutorSummary> execIter = topologyInfo.get_executors_iterator();
        boolean globalFailed = false;
        while (execIter.hasNext()) {
          final ExecutorSummary execSummary = execIter.next();
          final String componentId = execSummary.get_component_id();
          sb.append("component_id:").append(componentId).append(", ");
          final ExecutorInfo execInfo = execSummary.get_executor_info();
          final int taskStart = execInfo.get_task_start();
          final int taskEnd = execInfo.get_task_end();
          sb.append("task_id(s) for this executor:").append(taskStart).append("-")
              .append(taskEnd).append(", ");
          final String host = execSummary.get_host();
          sb.append("host:").append(host).append(", ");
          final int port = execSummary.get_port();
          sb.append("port:").append(port).append(", ");
          final int uptime = execSummary.get_uptime_secs();
          sb.append("uptime:").append(uptime).append("\n");
          sb.append("\n");

          // printing failing statistics, if there are failed tuples
          final ExecutorStats es = execSummary.get_stats();
          if (es == null)
            sb.append("No info about failed tuples\n");
          else {
            final ExecutorSpecificStats stats = es.get_specific();
            boolean isEmpty;
            Object objFailed;
            if (stats.is_set_spout()) {
              final Map<String, Map<String, Long>> failed = stats.get_spout()
                  .get_failed();
              objFailed = failed;
              isEmpty = isEmptyMapMap(failed);
            } else {
              final Map<String, Map<GlobalStreamId, Long>> failed = stats.get_bolt()
                  .get_failed();
              objFailed = failed;
              isEmpty = isEmptyMapMap(failed);
            }
            if (!isEmpty) {
              sb.append("ERROR: There are some failed tuples: ").append(objFailed)
                  .append("\n");
              globalFailed = true;
            }
          }
        }

        // is there at least one component where something failed
        if (!globalFailed)
          sb.append("OK: No tuples failed so far.\n");
        else
          sb.append("ERROR: Some tuples failed!\n");

        // print topology errors
        final Map<String, List<ErrorInfo>> errors = topologyInfo.get_errors();
        if (!isEmptyMap(errors))
          sb.append("ERROR: There are some errors in topology: ").append(errors)
              .append("\n");
        else
          sb.append("OK: No errors in the topology.\n");
View Full Code Here


                String topologyConf = client.getTopologyConf(topologyID);
                sb.append("Topology configuration is \n");
                sb.append(topologyConf);
                sb.append("\n");

                TopologyInfo topologyInfo = client.getTopologyInfo(topologyID);

                //print more about each task
                Iterator<ExecutorSummary> execIter = topologyInfo.get_executors_iterator();
                boolean globalFailed = false;
                while(execIter.hasNext()){
                    ExecutorSummary execSummary = execIter.next();
                    String componentId = execSummary.get_component_id();
                    sb.append("component_id:").append(componentId).append(", ");
                    ExecutorInfo execInfo = execSummary.get_executor_info();
                    int taskStart = execInfo.get_task_start();
                    int taskEnd = execInfo.get_task_end();
                    sb.append("task_id(s) for this executor:").append(taskStart).append("-").append(taskEnd).append(", ");
                    String host = execSummary.get_host();
                    sb.append("host:").append(host).append(", ");
                    int port = execSummary.get_port();
                    sb.append("port:").append(port).append(", ");
                    int uptime = execSummary.get_uptime_secs();
                    sb.append("uptime:").append(uptime).append("\n");
                    sb.append("\n");
                   
                    //printing failing statistics, if there are failed tuples
                    ExecutorStats es = execSummary.get_stats();
            if(es == null){
              sb.append("No info about failed tuples\n");
            }else{
              ExecutorSpecificStats stats = es.get_specific();
              boolean isEmpty;
              Object objFailed;
              if(stats.is_set_spout()){
              Map<String, Map<String, Long>> failed = stats.get_spout().get_failed();
              objFailed = failed;
              isEmpty = isEmptyMapMap(failed);
                }else{
                Map<String, Map<GlobalStreamId, Long>> failed = stats.get_bolt().get_failed();
                  objFailed = failed;
                  isEmpty = isEmptyMapMap(failed);
                }
                if(!isEmpty){
               sb.append("ERROR: There are some failed tuples: ").append(objFailed).append("\n");
                  globalFailed = true;
                  }  
              }
                }
               
                //is there at least one component where something failed
                if(!globalFailed){
                    sb.append("OK: No tuples failed so far.\n");
                }else{
                    sb.append("ERROR: Some tuples failed!\n");
                }
               
                //print topology errors
                Map<String, List<ErrorInfo>> errors = topologyInfo.get_errors();
                if(!isEmptyMap(errors)){
                    sb.append("ERROR: There are some errors in topology: ").append(errors).append("\n");
                }else{
                    sb.append("OK: No errors in the topology.\n");
                }
View Full Code Here

   @return TopologyInfo
         */
  @Override
  public TopologyInfo getTopologyInfo(String topologyIdthrows NotAliveException, TException {
   
    TopologyInfo topologyInfo=null;
   
    StormClusterState stormClusterState = data.getStormClusterState();
   
    //���topology��������Ϣ�� ����ID �� componentid
    HashMap<Integer, String> taskInfo = Common.topology_task_info(stormClusterState, topologyId);// <taskid,componentid>
   
    //���topology��name������ʱ���״̬
    StormBase base = stormClusterState.storm_base(topologyId, null);
   
    //���topology�����������Ϣ
    Assignment assignment = stormClusterState.assignment_info(topologyId,null);
   
    if (base != null && assignment != null) {
      List<TaskSummary> taskSummarys = new ArrayList<TaskSummary>();
      Set<Entry<Integer, String>> taskInfoSet = taskInfo.entrySet();
      for (Iterator<Entry<Integer, String>> it = taskInfoSet.iterator(); it.hasNext();) {
        Entry<Integer, String> entry =  it.next();
        Integer taskId =  entry.getKey();
        String componentId =  entry.getValue();
        NodePort np = (NodePort) assignment.getTaskToNodeport().get(taskId);
        //���ָ��task��������Ϣ
        TaskHeartbeat heartbeat = stormClusterState.task_heartbeat(topologyId, taskId);
        if (np == null || heartbeat == null) {
          continue;
        }
        String host = (String) assignment.getNodeHost().get(np.getNode());
        List<TaskError> errors = stormClusterState.task_errors(topologyId, taskId);
        List<ErrorInfo> newErrors = new ArrayList<ErrorInfo>();

        if (errors != null) {
          int size = errors.size();
          for (int i = 0; i < size; i++) {
            TaskError e = (TaskError) errors.get(i);
            newErrors.add(new ErrorInfo(e.getError(), e.getTimSecs()));
          }
        }
        BaseStatsData status = (BaseStatsData) heartbeat.getStats();
        TaskStats tkStatus = status.getTaskStats();
        int uptimeSecs = heartbeat.getUptimeSecs();
        TaskSummary taskSummary = new TaskSummary(taskId, componentId,
            host, np.getPort(), uptimeSecs, newErrors);
        taskSummary.set_stats(tkStatus);
        taskSummarys.add(taskSummary);
      }
      topologyInfo = new TopologyInfo(topologyId,base.getStormName(), TimeUtils.time_delta(base.getLanchTimeSecs()), taskSummarys,extractStatusStr(base));
    }
   
    return topologyInfo;
  }
View Full Code Here

    long totalTransferred = 0;
    int totalExecutors = 0;
    int executorsWithMetrics = 0;
    for (TopologySummary ts: summary.get_topologies()) {
      String id = ts.get_id();
      TopologyInfo info = client.getTopologyInfo(id);
      for (ExecutorSummary es: info.get_executors()) {
        ExecutorStats stats = es.get_stats();
        totalExecutors++;
        if (stats != null) {
          Map<String,Map<String,Long>> transferred = stats.get_transferred();
          if ( transferred != null) {
View Full Code Here

   */
  @Override
  public TopologyInfo getTopologyInfo(String topologyId)
      throws NotAliveException, TException {

    TopologyInfo topologyInfo = new TopologyInfo();

    StormClusterState stormClusterState = data.getStormClusterState();

    try {

      // get topology's StormBase
      StormBase base = stormClusterState.storm_base(topologyId, null);
      if (base == null) {
        throw new NotAliveException("No topology of " + topologyId);
      }
      topologyInfo.set_id(topologyId);
      topologyInfo.set_name(base.getStormName());
      topologyInfo.set_uptime_secs(TimeUtils.time_delta(base
          .getLanchTimeSecs()));
      topologyInfo.set_status(base.getStatusString());

      // get topology's Assignment
      Assignment assignment = stormClusterState.assignment_info(
          topologyId, null);
      if (assignment == null) {
        throw new TException("Failed to get StormBase from ZK of "
            + topologyId);
      }

      // get topology's map<taskId, componentId>
      Map<Integer, String> taskInfo = Cluster.topology_task_info(
          stormClusterState, topologyId);

      Map<Integer, TaskSummary> tasks = NimbusUtils.mkTaskSummary(
          stormClusterState, assignment, taskInfo, topologyId);
      List<TaskSummary> taskSumms = new ArrayList<TaskSummary>();
      for (Entry<Integer, TaskSummary> entry : tasks.entrySet()) {
        taskSumms.add(entry.getValue());
      }
      topologyInfo.set_tasks(taskSumms);
      List<WorkerSummary> workers = NimbusUtils.mkWorkerSummary(
          topologyId, assignment, tasks);
      topologyInfo.set_workers(workers);

      return topologyInfo;
    } catch (TException e) {
      LOG.info("Failed to get topologyInfo " + topologyId, e);
      throw e;
View Full Code Here

      if(clusterName != null  && !(clusterName.equals(""))) {
        UIUtils.getClusterInfoByName(conf, clusterName);
      }
      client = NimbusClient.getConfiguredClient(conf);

      TopologyInfo summ = client.getClient().getTopologyInfo(topologyid);
      StormTopology topology = client.getClient().getTopology(topologyid);
      TopologyMetricInfo topologyMetricInfo = client.getClient().getTopologyMetric(topologyid);

      String type = UIUtils.componentType(topology, componentid);

      List<TaskSummary> ts = UIUtils.getTaskList(summ.get_tasks(),
          componentid);

      coms = getComponentSummaries(summ, ts);

      cts = getComponentTasks(ts, window);
View Full Code Here

        if (ctx.getExternalContext().getRequestParameterMap().get("topologyId") != null) {
            topologyId = ctx.getExternalContext().getRequestParameterMap()
                .get("topologyId");
          }
        NimbusClient client = NimbusClient.getConfiguredClient(conf);
        TopologyInfo summ = client.getClient().getTopologyInfo(topologyId);
        logFileName = JStormUtils.genLogName(summ.get_name(), Integer.valueOf(workerPort));
      }
      return;
    }

    String topologyid = null;
    String taskid = null;
    String clusterName = null;

    // resolve the arguments
    if (ctx.getExternalContext().getRequestParameterMap().get("clusterName") != null) {
      clusterName = (String) ctx.getExternalContext()
          .getRequestParameterMap().get("clusterName");
    }
    if (ctx.getExternalContext().getRequestParameterMap().get("topologyid") != null) {
      topologyid = ctx.getExternalContext().getRequestParameterMap()
          .get("topologyid");
    }
    if (ctx.getExternalContext().getRequestParameterMap().get("taskid") != null) {
      taskid = ctx.getExternalContext().getRequestParameterMap()
          .get("taskid");
    }

    if (topologyid == null) {
      throw new NotAliveException("Input topologyId is null ");
    }
    if (taskid == null) {
      throw new NotAliveException("Input taskId is null ");
    }

    NimbusClient client = null;

    try {
      if(clusterName != null && !(clusterName.equals(""))) {
        UIUtils.getClusterInfoByName(conf, clusterName);
      }
     
      client = NimbusClient.getConfiguredClient(conf);

      TopologyInfo summ = client.getClient().getTopologyInfo(topologyid);

      // find the specified task entity
      TaskSummary taskSummary = null;
      for (TaskSummary _taskSummary : summ.get_tasks()) {
        if (taskid.equals(String.valueOf(_taskSummary.get_task_id()))) {
          taskSummary = _taskSummary;
          break;
        }
      }

      if (taskSummary == null) {
        throw new NotAliveException("topologyid=" + topologyid
            + ", taskid=" + taskid);
      }

      ComponentTask componentTask = UIUtils.getComponentTask(taskSummary,
          topologyid);

      host = componentTask.getHost();

//      logFileName = componentTask.getTopologyid() + "-worker-"
//          + componentTask.getPort() + ".log";
      logFileName = JStormUtils.genLogName(summ.get_name(),
          Integer.valueOf(componentTask.getPort()));

    } catch (TException e) {
      LOG.error(e.getCause(), e);
      throw e;
View Full Code Here

      Map conf = Utils.readStormConfig();
      client = NimbusClient.getConfiguredClient(conf);
     
      if (args.length > 0 && StringUtils.isBlank(args[0]) == false) {
        String topologyId = args[0];
        TopologyInfo info = client.getClient().getTopologyInfo(topologyId);
       
        System.out.println("Successfully get topology info \n"
            + info.toString());
      }else {
        ClusterSummary clusterSummary = client.getClient().getClusterInfo();
       

        System.out.println("Successfully get cluster info \n"
View Full Code Here

    try {
      Map conf = Utils.readStormConfig();
      client = NimbusClient.getConfiguredClient(conf);

      TopologyInfo summ = client.getClient().getTopologyInfo(topologyid);

      List<TaskSummary> ts = summ.get_tasks();
      if (ts == null) {
        throw new NotAliveException("No TaskSummary");
      }
      TaskSummary t = null;
      if (ts != null) {
View Full Code Here

        UIUtils.getClusterInfoByName(conf, clusterName);
      }
     
      client = NimbusClient.getConfiguredClient(conf);

      TopologyInfo summ = client.getClient().getTopologyInfo(topologyid);
      StormTopology topology = client.getClient().getTopology(topologyid);

      List<TaskSummary> ts = summ.get_tasks();

      tsumm = UIUtils.topologySummary(summ);

      getComponents(ts, topology);
View Full Code Here

TOP

Related Classes of backtype.storm.generated.TopologyInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.