本文整理汇总了Java中backtype.storm.generated.TopologySummary.get_id方法的典型用法代码示例。如果您正苦于以下问题:Java TopologySummary.get_id方法的具体用法?Java TopologySummary.get_id怎么用?Java TopologySummary.get_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类backtype.storm.generated.TopologySummary
的用法示例。
在下文中一共展示了TopologySummary.get_id方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTopologyTPS
import backtype.storm.generated.TopologySummary; //导入方法依赖的package包/类
protected long getTopologyTPS(TopologySummary topology, Client client) throws NotAliveException, TException{
long topologyTps = 0l;
String topologyId = topology.get_id();
if(topologyId.startsWith("ClusterMonitor")){
return topologyTps;
}
TopologyInfo topologyInfo = client.getTopologyInfo(topologyId);
if(topologyInfo == null){
return topologyTps;
}
List<ExecutorSummary> executorSummaryList = topologyInfo.get_executors();
for(ExecutorSummary executor : executorSummaryList){
topologyTps += getComponentTPS(executor);
}
LOGGER.info("topology = " + topology.get_name() + ", tps = " + topologyTps);
return topologyTps;
}
示例2: getComponents
import backtype.storm.generated.TopologySummary; //导入方法依赖的package包/类
/**
* @@@ Don't be compatible with Storm
*
* Here skip the logic
* @param client
* @param topology
* @return
* @throws Exception
*/
private HashSet<String> getComponents(Nimbus.Client client, String topology) throws Exception {
HashSet<String> components = new HashSet<String>();
ClusterSummary clusterSummary = client.getClusterInfo();
TopologySummary topologySummary = null;
for (TopologySummary ts : clusterSummary.get_topologies()) {
if (topology.equals(ts.get_name())) {
topologySummary = ts;
break;
}
}
if (topologySummary == null) {
throw new IllegalArgumentException("topology: " + topology + " not found");
} else {
String id = topologySummary.get_id();
// GetInfoOptions getInfoOpts = new GetInfoOptions();
// getInfoOpts.set_num_err_choice(NumErrorsChoice.NONE);
// TopologyInfo info = client.getTopologyInfoWithOpts(id, getInfoOpts);
// for (ExecutorSummary es: info.get_executors()) {
// components.add(es.get_component_id());
// }
}
return components;
}
示例3: metrics
import backtype.storm.generated.TopologySummary; //导入方法依赖的package包/类
public boolean metrics(Nimbus.Client client, int size, long now, MetricsState state, String message) throws Exception {
ClusterSummary summary = client.getClusterInfo();
long time = now - state.lastTime;
state.lastTime = now;
int numSupervisors = summary.get_supervisors_size();
int totalSlots = 0;
int totalUsedSlots = 0;
for (SupervisorSummary sup: summary.get_supervisors()) {
totalSlots += sup.get_num_workers();
totalUsedSlots += sup.get_num_used_workers();
}
int slotsUsedDiff = totalUsedSlots - state.slotsUsed;
state.slotsUsed = totalUsedSlots;
int numTopologies = summary.get_topologies_size();
long totalTransferred = 0;
int totalExecutors = 0;
int executorsWithMetrics = 0;
int totalFailed = 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) {
if (stats.get_specific().is_set_spout()) {
SpoutStats ss = stats.get_specific().get_spout();
Map<String, Long> failedMap = ss.get_failed().get(":all-time");
if (failedMap != null) {
for (String key: failedMap.keySet()) {
Long tmp = failedMap.get(key);
if (tmp != null) {
totalFailed += tmp;
}
}
}
}
Map<String,Map<String,Long>> transferred = stats.get_transferred();
if ( transferred != null) {
Map<String, Long> e2 = transferred.get(":all-time");
if (e2 != null) {
executorsWithMetrics++;
//The SOL messages are always on the default stream, so just count those
Long dflt = e2.get("default");
if (dflt != null) {
totalTransferred += dflt;
}
}
}
}
}
}
long transferredDiff = totalTransferred - state.transferred;
state.transferred = totalTransferred;
double throughput = (transferredDiff == 0 || time == 0) ? 0.0 : (transferredDiff * size)/(1024.0 * 1024.0)/(time/1000.0);
System.out.println(message+"\t"+numTopologies+"\t"+totalSlots+"\t"+totalUsedSlots+"\t"+totalExecutors+"\t"+executorsWithMetrics+"\t"+now+"\t"+time+"\t"+transferredDiff+"\t"+throughput+"\t"+totalFailed);
if ("WAITING".equals(message)) {
//System.err.println(" !("+totalUsedSlots+" > 0 && "+slotsUsedDiff+" == 0 && "+totalExecutors+" > 0 && "+executorsWithMetrics+" >= "+totalExecutors+")");
}
return !(totalUsedSlots > 0 && slotsUsedDiff == 0 && totalExecutors > 0 && executorsWithMetrics >= totalExecutors);
}