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);
}
}
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;
}
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;
}
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);
}
}
Aggregations