Package com.alibaba.jstorm.daemon.supervisor

Examples of com.alibaba.jstorm.daemon.supervisor.SupervisorInfo


      Set<ResourceWorkerSlot> workers = entry.getValue().getWorkers();

      for (ResourceWorkerSlot worker : workers) {

        String supervisorId = worker.getNodeId();
        SupervisorInfo supervisorInfo = supervisorInfos
            .get(supervisorId);
        if (supervisorInfo == null) {
          continue;
        }
        Integer slots = supervisorToLeftSlotNum.get(supervisorId);
        if (slots == null) {
          slots = 0;
          supervisorToLeftSlotNum.put(supervisorId, slots);
        }
        supervisorToLeftSlotNum.put(supervisorId, ++slots);
      }
    }

    List<SupervisorSummary> ret = new ArrayList<SupervisorSummary>();
    for (Entry<String, SupervisorInfo> entry : supervisorInfos.entrySet()) {
      String supervisorId = entry.getKey();
      SupervisorInfo supervisorInfo = entry.getValue();

      SupervisorSummary summary = mkSupervisorSummary(supervisorInfo,
          supervisorId, supervisorToLeftSlotNum);

      ret.add(summary);
View Full Code Here


      sidToHostname.putAll(oldAssignment.getNodeHost());
    }

    for (Entry<String, SupervisorInfo> entry : cluster.entrySet()) {
      String supervisorId = entry.getKey();
      SupervisorInfo supervisorInfo = entry.getValue();

      sidToHostname.put(supervisorId, supervisorInfo.getHostName());

    }

    return sidToHostname;
  }
View Full Code Here

        LOG.warn("When free rebalance resource, no ResourceAssignment of task "
            + task);
        continue;
      }

      SupervisorInfo supervisorInfo = cluster.get(worker.getNodeId());
      if (supervisorInfo == null) {
        continue;
      }
      supervisorInfo.getWorkerPorts().add(worker.getPort());
    }
  }
View Full Code Here

        return;
      if (worker.getNodeId() != null)
        continue;
      if (key >= supervisors.size())
        key = 0;
      SupervisorInfo supervisor = supervisors.get(key);
      worker.setHostname(supervisor.getHostName());
      worker.setNodeId(supervisor.getSupervisorId());
      worker.setPort(supervisor.getWorkerPorts().iterator().next());
      supervisor.getWorkerPorts().remove(worker.getPort());
      if (supervisor.getWorkerPorts().size() == 0)
        supervisors.remove(supervisor);
      key++;
    }
  }
View Full Code Here

  private List<SupervisorInfo> getCanUseSupervisors(
      Map<String, SupervisorInfo> supervisors) {
    List<SupervisorInfo> canUseSupervisors = new ArrayList<SupervisorInfo>();
    for (Entry<String, SupervisorInfo> entry : supervisors.entrySet()) {
      SupervisorInfo supervisor = entry.getValue();
      if (supervisor.getWorkerPorts().size() > 0)
        canUseSupervisors.add(entry.getValue());
    }
    return canUseSupervisors;
  }
View Full Code Here

      throws NotAliveException, TException {
    try {
      StormClusterState stormClusterState = data.getStormClusterState();

      String supervisorId = null;
      SupervisorInfo supervisorInfo = null;

      String ip = NetWorkUtils.host2Ip(host);
      String hostName = NetWorkUtils.ip2Host(host);

      // all supervisors
      Map<String, SupervisorInfo> supervisorInfos = Cluster
          .allSupervisorInfo(stormClusterState, null);

      for (Entry<String, SupervisorInfo> entry : supervisorInfos
          .entrySet()) {

        SupervisorInfo info = entry.getValue();
        if (info.getHostName().equals(hostName)
            || info.getHostName().equals(ip)) {
          supervisorId = entry.getKey();
          supervisorInfo = info;
          break;
        }
      }
View Full Code Here

      TopologyAssignContext context) {
    Set<ResourceWorkerSlot> result = new HashSet<ResourceWorkerSlot>();
    Map<String, SupervisorInfo> cluster = context.getCluster();
    if (cluster.size() != 1)
      throw new RuntimeException();
    SupervisorInfo localSupervisor = null;
    String supervisorId = null;
    for (Entry<String, SupervisorInfo> entry : cluster.entrySet()) {
      supervisorId = entry.getKey();
      localSupervisor = entry.getValue();
    }
    int port = localSupervisor.getWorkerPorts().iterator().next();
    ResourceWorkerSlot worker = new ResourceWorkerSlot(supervisorId, port);
    worker.setTasks(new HashSet<Integer>(context.getAllTaskIds()));
    worker.setHostname(localSupervisor.getHostName());
    result.add(worker);
    return result;
  }
View Full Code Here

      Set<ResourceWorkerSlot> workers = assignment.getWorkers();

      for (ResourceWorkerSlot worker : workers) {

        SupervisorInfo supervisorInfo = supervisorInfos.get(worker
            .getNodeId());
        if (supervisorInfo == null) {
          // the supervisor is dead
          continue;
        }
        supervisorInfo.getWorkerPorts().remove(worker.getPort());
      }
    }

  }
View Full Code Here

    this.conf = conf;
    this.cluster = cluster;
    this.supervisorId = supervisorId;
    this.client = client;
    try {
        SupervisorInfo supervisorInfo = cluster.supervisor_info(supervisorId);
        this.hostName = supervisorInfo.getHostName();
    } catch (Exception e) {
      LOG.error("Failed to get hostname for supervisorID=" + supervisorId);
    }
  }
View Full Code Here

      for (Iterator<String> iter = supervisorIds.iterator(); iter
          .hasNext();) {

        String supervisorId = iter.next();
        // get /supervisors/supervisorid
        SupervisorInfo supervisorInfo = stormClusterState
            .supervisor_info(supervisorId);
        if (supervisorInfo == null) {
          LOG.warn("Failed to get SupervisorInfo of " + supervisorId);
        } else {
View Full Code Here

TOP

Related Classes of com.alibaba.jstorm.daemon.supervisor.SupervisorInfo

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.