use of org.apache.storm.scheduler.blacklist.BlacklistScheduler in project storm by apache.
the class Nimbus method wrapAsBlacklistScheduler.
private static IScheduler wrapAsBlacklistScheduler(Map<String, Object> conf, IScheduler scheduler, StormMetricsRegistry metricsRegistry) {
BlacklistScheduler blacklistWrappedScheduler = new BlacklistScheduler(scheduler);
blacklistWrappedScheduler.prepare(conf, metricsRegistry);
return blacklistWrappedScheduler;
}
use of org.apache.storm.scheduler.blacklist.BlacklistScheduler in project storm by apache.
the class Nimbus method makeSupervisorSummary.
private SupervisorSummary makeSupervisorSummary(String supervisorId, SupervisorInfo info) {
Set<String> blacklistedSupervisorIds = Collections.emptySet();
if (scheduler instanceof BlacklistScheduler) {
BlacklistScheduler bs = (BlacklistScheduler) scheduler;
blacklistedSupervisorIds = bs.getBlacklistSupervisorIds();
}
LOG.debug("INFO: {} ID: {}", info, supervisorId);
int numPorts = 0;
if (info.is_set_meta()) {
numPorts = info.get_meta_size();
}
int numUsedPorts = 0;
if (info.is_set_used_ports()) {
numUsedPorts = info.get_used_ports_size();
}
LOG.debug("NUM PORTS: {}", numPorts);
SupervisorSummary ret = new SupervisorSummary(info.get_hostname(), (int) info.get_uptime_secs(), numPorts, numUsedPorts, supervisorId);
ret.set_total_resources(info.get_resources_map());
SupervisorResources resources = nodeIdToResources.get().get(supervisorId);
if (resources != null && underlyingScheduler instanceof ResourceAwareScheduler) {
ret.set_used_mem(resources.getUsedMem());
ret.set_used_cpu(resources.getUsedCpu());
ret.set_used_generic_resources(resources.getUsedGenericResources());
if (isFragmented(resources)) {
final double availableCpu = resources.getAvailableCpu();
if (availableCpu < 0) {
LOG.warn("Negative fragmented CPU on {}", supervisorId);
}
ret.set_fragmented_cpu(availableCpu);
final double availableMem = resources.getAvailableMem();
if (availableMem < 0) {
LOG.warn("Negative fragmented Mem on {}", supervisorId);
}
ret.set_fragmented_mem(availableMem);
}
}
if (info.is_set_version()) {
ret.set_version(info.get_version());
}
if (blacklistedSupervisorIds.contains(supervisorId)) {
ret.set_blacklisted(true);
} else {
ret.set_blacklisted(false);
}
return ret;
}
Aggregations