Package com.alibaba.jstorm.cluster

Examples of com.alibaba.jstorm.cluster.StormBase


            TopoCommStatsInfo ret;
            List<String> topologys = clusterState.heartbeat_storms();

            for (String topologyId : topologys) {
                if (topologyMap.containsKey(topologyId) == false) {
                    StormBase base = clusterState.storm_base(topologyId, null);
                    if (base == null) {
                      topologyMap.remove(topologyId);
                      continue;
                    } else {
                      topologyMap.put(topologyId, new TopoCommStatsInfo(topologyId, base.getStormName()));
                    }
                }
                // Get common statistic data from taskbeats in ZK for a topology
                ret = getCommStatsData(topologyId)
View Full Code Here


      StormClusterState stormClusterState, String topologyId,
      String supervisorId, Assignment assignmenInfo) throws Exception {

    Map<Integer, LocalAssignment> portTasks = new HashMap<Integer, LocalAssignment>();

    StormBase stormBase = stormClusterState.storm_base(topologyId, null);
    if (stormBase == null) {
      LOG.error("Failed to get StormBase of " + topologyId);
      return portTasks;
    }

    Set<ResourceWorkerSlot> workers = assignmenInfo.getWorkers();
    if (workers == null) {
      LOG.error("No worker of assignement's " + assignmenInfo);
      return portTasks;
    }

    for (ResourceWorkerSlot worker : workers) {
      if (!supervisorId.equals(worker.getNodeId()))
        continue;
      portTasks.put(worker.getPort(),
          new LocalAssignment(topologyId, worker.getTasks(),
              stormBase.getStormName(), worker.getMemSize(),
              worker.getCpu(), worker.getJvm()));
    }

    return portTasks;
  }
View Full Code Here

      Map<String, StormBase> bases = Cluster
          .topology_bases(stormClusterState);
      for (Entry<String, StormBase> entry : bases.entrySet()) {

        String topologyId = entry.getKey();
        StormBase base = entry.getValue();

        Assignment assignment = stormClusterState.assignment_info(
            topologyId, null);
        if (assignment == null) {
          LOG.error("Failed to get assignment of " + topologyId);
          continue;
        }
        assignments.put(topologyId, assignment);

        Map<Integer, String> lastErrTimeStamp = null;
        try {
            lastErrTimeStamp = stormClusterState.topo_lastErr_time(topologyId);
        } catch (Exception e) {
          LOG.error("Failed to get last error timestamp map for "+ topologyId +
              ", and begin to remove the corrupt data", e);
          try {
            stormClusterState.remove_lastErr_time(topologyId);
          } catch (Exception rmErr) {
            LOG.error("Failed to remove last error timestamp in ZK for " + topologyId, rmErr);
          }
        }
       
        TopologySummary topology = NimbusUtils.mkTopologySummary(
            assignment, topologyId, base.getStormName(),
            base.getStatusString(),
            TimeUtils.time_delta(base.getLanchTimeSecs()), lastErrTimeStamp);

        topologySummaries.add(topology);

      }
View Full Code Here

      Map<String, StormBase> bases = Cluster
          .topology_bases(stormClusterState);
      for (Entry<String, StormBase> entry : bases.entrySet()) {

        String topologyId = entry.getKey();
        StormBase base = entry.getValue();

        Assignment assignment = stormClusterState.assignment_info(
            topologyId, null);
        if (assignment == null) {
          LOG.error("Failed to get assignment of " + topologyId);
View Full Code Here

    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) {
View Full Code Here

  public <T> void transitionLock(String topologyid,
      boolean errorOnNoTransition, StatusType changeStatus, T... args)
      throws Exception {

    // get ZK's topology node's data, which is StormBase
    StormBase stormbase = data.getStormClusterState().storm_base(
        topologyid, null);
    if (stormbase == null) {

      LOG.error("Cannot apply event changing status "
          + changeStatus.getStatus() + " to " + topologyid
          + " because failed to get StormBase from ZK");
      return;
    }

    StormStatus currentStatus = stormbase.getStatus();
    if (currentStatus == null) {
      LOG.error("Cannot apply event changing status "
          + changeStatus.getStatus() + " to " + topologyid
          + " because topologyStatus is null in ZK");
      return;
View Full Code Here

    StormStatus status = new StormStatus(StatusType.active);
    if (event.getOldStatus() != null) {
      status = event.getOldStatus();
    }

    StormBase stormBase = stormClusterState.storm_base(topologyId, null);
    if (stormBase == null) {
      stormBase = new StormBase(topologyName,
          TimeUtils.current_time_secs(), status, group);
      stormClusterState.activate_storm(topologyId, stormBase);

    } else {

      stormClusterState.update_storm(topologyId, status);

      // here exist one hack operation
      // when monitor/rebalance/startup topologyName is null
      if (topologyName == null) {
        event.setTopologyName(stormBase.getStormName());
      }
    }

    LOG.info("Update " + topologyId + " " + status);
View Full Code Here

  @Override
  public <T> Object execute(T... args) {
    LOG.info("Begin to remove topology: " + topologyid);
    try {

      StormBase stormBase = data.getStormClusterState().storm_base(
          topologyid, null);
      if (stormBase == null) {
        LOG.info("Topology " + topologyid + " has been removed ");
        return null;
      }
View Full Code Here

   

    try {
      StatusType newTopologyStatus = StatusType.activate;
      // /ZK-DIR/topology
      StormBase base = zkCluster.storm_base(topologyId, this);
      if (base == null) {
        // @@@ normally the topology has been removed
        LOG.warn("Failed to get StromBase from ZK of " + topologyId);
        newTopologyStatus = StatusType.killed;
      } else {

        newTopologyStatus = base.getStatus().getStatusType();
      }

      // Start metrics report if metrics monitor is enabled.
      // Stop metrics report if metrics monitor is disabled.
      try {
View Full Code Here

TOP

Related Classes of com.alibaba.jstorm.cluster.StormBase

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.