Search in sources :

Example 11 with NotAliveException

use of backtype.storm.generated.NotAliveException in project jstorm by alibaba.

the class ServiceHandler method metricMonitor.

@Override
public void metricMonitor(String topologyName, MonitorOptions options) throws TException {
    boolean isEnable = options.is_isEnable();
    StormClusterState clusterState = data.getStormClusterState();
    try {
        String topologyId = Cluster.get_topology_id(clusterState, topologyName);
        if (null != topologyId) {
            clusterState.set_storm_monitor(topologyId, isEnable);
        } else {
            throw new NotAliveException("Failed to update metricsMonitor status as " + topologyName + " is not alive");
        }
    } catch (Exception e) {
        String errMsg = "Failed to update metricsMonitor " + topologyName;
        LOG.error(errMsg, e);
        throw new TException(e);
    }
}
Also used : TException(org.apache.thrift.TException) StormClusterState(com.alibaba.jstorm.cluster.StormClusterState) NotAliveException(backtype.storm.generated.NotAliveException) InvalidParameterException(java.security.InvalidParameterException) FailedAssignTopologyException(com.alibaba.jstorm.utils.FailedAssignTopologyException) KeyNotFoundException(backtype.storm.generated.KeyNotFoundException) TException(org.apache.thrift.TException) IOException(java.io.IOException) AlreadyAliveException(backtype.storm.generated.AlreadyAliveException) TopologyAssignException(backtype.storm.generated.TopologyAssignException) FileNotFoundException(java.io.FileNotFoundException) NotAliveException(backtype.storm.generated.NotAliveException) InvalidTopologyException(backtype.storm.generated.InvalidTopologyException) KeyAlreadyExistsException(backtype.storm.generated.KeyAlreadyExistsException)

Example 12 with NotAliveException

use of backtype.storm.generated.NotAliveException in project jstorm by alibaba.

the class ServiceHandler method getTopologyTasksToSupervisorIds.

@Override
public Map<Integer, String> getTopologyTasksToSupervisorIds(String topologyName) throws NotAliveException, TException {
    StormClusterState stormClusterState = data.getStormClusterState();
    String topologyId = getTopologyId(topologyName);
    Map<Integer, String> ret = new HashMap<>();
    try {
        Assignment assignment = stormClusterState.assignment_info(topologyId, null);
        Set<ResourceWorkerSlot> workers = assignment.getWorkers();
        for (ResourceWorkerSlot worker : workers) {
            String supervisorId = worker.getNodeId();
            for (Integer task : worker.getTasks()) {
                ret.put(task, supervisorId);
            }
        }
    } catch (Exception ex) {
        LOG.error("Error:", ex);
    }
    return ret;
}
Also used : Assignment(com.alibaba.jstorm.schedule.Assignment) StormClusterState(com.alibaba.jstorm.cluster.StormClusterState) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) InvalidParameterException(java.security.InvalidParameterException) FailedAssignTopologyException(com.alibaba.jstorm.utils.FailedAssignTopologyException) KeyNotFoundException(backtype.storm.generated.KeyNotFoundException) TException(org.apache.thrift.TException) IOException(java.io.IOException) AlreadyAliveException(backtype.storm.generated.AlreadyAliveException) TopologyAssignException(backtype.storm.generated.TopologyAssignException) FileNotFoundException(java.io.FileNotFoundException) NotAliveException(backtype.storm.generated.NotAliveException) InvalidTopologyException(backtype.storm.generated.InvalidTopologyException) KeyAlreadyExistsException(backtype.storm.generated.KeyAlreadyExistsException) ResourceWorkerSlot(com.alibaba.jstorm.schedule.default_assign.ResourceWorkerSlot)

Example 13 with NotAliveException

use of backtype.storm.generated.NotAliveException in project jstorm by alibaba.

the class ServiceHandler method getTopology.

/**
     * get StormTopology throw deserialize local files
     *
     * @param id String: topology id
     * @return StormTopology
     */
@Override
public StormTopology getTopology(String id) throws NotAliveException, TException {
    StormTopology topology;
    try {
        StormTopology stormtopology = StormConfig.read_nimbus_topology_code(id, data.getBlobStore());
        if (stormtopology == null) {
            throw new NotAliveException("No topology of " + id);
        }
        Map<Object, Object> topologyConf = (Map<Object, Object>) StormConfig.read_nimbus_topology_conf(id, data.getBlobStore());
        topology = Common.system_topology(topologyConf, stormtopology);
    } catch (Exception e) {
        LOG.error("Failed to get topology " + id + ",", e);
        throw new TException("Failed to get system_topology");
    }
    return topology;
}
Also used : TException(org.apache.thrift.TException) NotAliveException(backtype.storm.generated.NotAliveException) StormTopology(backtype.storm.generated.StormTopology) Map(java.util.Map) TreeMap(java.util.TreeMap) TimeCacheMap(com.alibaba.jstorm.utils.TimeCacheMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) InvalidParameterException(java.security.InvalidParameterException) FailedAssignTopologyException(com.alibaba.jstorm.utils.FailedAssignTopologyException) KeyNotFoundException(backtype.storm.generated.KeyNotFoundException) TException(org.apache.thrift.TException) IOException(java.io.IOException) AlreadyAliveException(backtype.storm.generated.AlreadyAliveException) TopologyAssignException(backtype.storm.generated.TopologyAssignException) FileNotFoundException(java.io.FileNotFoundException) NotAliveException(backtype.storm.generated.NotAliveException) InvalidTopologyException(backtype.storm.generated.InvalidTopologyException) KeyAlreadyExistsException(backtype.storm.generated.KeyAlreadyExistsException)

Example 14 with NotAliveException

use of backtype.storm.generated.NotAliveException in project jstorm by alibaba.

the class ServiceHandler method activate.

/**
     * set topology status as active
     *
     * @param topologyName
     */
@Override
public void activate(String topologyName) throws TException, NotAliveException {
    try {
        NimbusUtils.transitionName(data, topologyName, true, StatusType.activate);
        notifyTopologyActionListener(topologyName, "activate");
    } catch (NotAliveException e) {
        String errMsg = "Activate Error, no this topology " + topologyName;
        LOG.error(errMsg, e);
        throw new NotAliveException(errMsg);
    } catch (Exception e) {
        String errMsg = "Failed to active topology " + topologyName;
        LOG.error(errMsg, e);
        throw new TException(errMsg);
    }
}
Also used : TException(org.apache.thrift.TException) NotAliveException(backtype.storm.generated.NotAliveException) InvalidParameterException(java.security.InvalidParameterException) FailedAssignTopologyException(com.alibaba.jstorm.utils.FailedAssignTopologyException) KeyNotFoundException(backtype.storm.generated.KeyNotFoundException) TException(org.apache.thrift.TException) IOException(java.io.IOException) AlreadyAliveException(backtype.storm.generated.AlreadyAliveException) TopologyAssignException(backtype.storm.generated.TopologyAssignException) FileNotFoundException(java.io.FileNotFoundException) NotAliveException(backtype.storm.generated.NotAliveException) InvalidTopologyException(backtype.storm.generated.InvalidTopologyException) KeyAlreadyExistsException(backtype.storm.generated.KeyAlreadyExistsException)

Aggregations

NotAliveException (backtype.storm.generated.NotAliveException)14 IOException (java.io.IOException)12 AlreadyAliveException (backtype.storm.generated.AlreadyAliveException)11 InvalidTopologyException (backtype.storm.generated.InvalidTopologyException)11 KeyAlreadyExistsException (backtype.storm.generated.KeyAlreadyExistsException)11 KeyNotFoundException (backtype.storm.generated.KeyNotFoundException)11 TopologyAssignException (backtype.storm.generated.TopologyAssignException)11 FailedAssignTopologyException (com.alibaba.jstorm.utils.FailedAssignTopologyException)11 FileNotFoundException (java.io.FileNotFoundException)11 InvalidParameterException (java.security.InvalidParameterException)11 TException (org.apache.thrift.TException)11 StormClusterState (com.alibaba.jstorm.cluster.StormClusterState)7 HashMap (java.util.HashMap)7 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)7 TreeMap (java.util.TreeMap)6 TimeCacheMap (com.alibaba.jstorm.utils.TimeCacheMap)5 Map (java.util.Map)5 StormTopology (backtype.storm.generated.StormTopology)3 TopologyInfo (backtype.storm.generated.TopologyInfo)2 TopologySummary (backtype.storm.generated.TopologySummary)2