Search in sources :

Example 1 with BlacklistScheduler

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;
}
Also used : BlacklistScheduler(org.apache.storm.scheduler.blacklist.BlacklistScheduler)

Example 2 with BlacklistScheduler

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;
}
Also used : SupervisorResources(org.apache.storm.scheduler.SupervisorResources) BlacklistScheduler(org.apache.storm.scheduler.blacklist.BlacklistScheduler) SupervisorSummary(org.apache.storm.generated.SupervisorSummary) WorkerMetricPoint(org.apache.storm.generated.WorkerMetricPoint) DataPoint(org.apache.storm.metric.api.DataPoint) ResourceAwareScheduler(org.apache.storm.scheduler.resource.ResourceAwareScheduler)

Aggregations

BlacklistScheduler (org.apache.storm.scheduler.blacklist.BlacklistScheduler)2 SupervisorSummary (org.apache.storm.generated.SupervisorSummary)1 WorkerMetricPoint (org.apache.storm.generated.WorkerMetricPoint)1 DataPoint (org.apache.storm.metric.api.DataPoint)1 SupervisorResources (org.apache.storm.scheduler.SupervisorResources)1 ResourceAwareScheduler (org.apache.storm.scheduler.resource.ResourceAwareScheduler)1