Search in sources :

Example 6 with RAS_Node

use of org.apache.storm.scheduler.resource.RAS_Node in project storm by apache.

the class DefaultResourceAwareStrategy method scheduleExecutor.

/**
     * Schedule executor exec from topology td
     *
     * @param exec the executor to schedule
     * @param td the topology executor exec is a part of
     * @param schedulerAssignmentMap the assignments already calculated
     * @param scheduledTasks executors that have been scheduled
     */
private void scheduleExecutor(ExecutorDetails exec, TopologyDetails td, Map<WorkerSlot, Collection<ExecutorDetails>> schedulerAssignmentMap, Collection<ExecutorDetails> scheduledTasks) {
    WorkerSlot targetSlot = this.findWorkerForExec(exec, td, schedulerAssignmentMap);
    if (targetSlot != null) {
        RAS_Node targetNode = this.idToNode(targetSlot.getNodeId());
        if (!schedulerAssignmentMap.containsKey(targetSlot)) {
            schedulerAssignmentMap.put(targetSlot, new LinkedList<ExecutorDetails>());
        }
        schedulerAssignmentMap.get(targetSlot).add(exec);
        targetNode.consumeResourcesforTask(exec, td);
        scheduledTasks.add(exec);
        LOG.debug("TASK {} assigned to Node: {} avail [ mem: {} cpu: {} ] total [ mem: {} cpu: {} ] on slot: {} on Rack: {}", exec, targetNode.getHostname(), targetNode.getAvailableMemoryResources(), targetNode.getAvailableCpuResources(), targetNode.getTotalMemoryResources(), targetNode.getTotalCpuResources(), targetSlot, nodeToRack(targetNode));
    } else {
        LOG.error("Not Enough Resources to schedule Task {}", exec);
    }
}
Also used : ExecutorDetails(org.apache.storm.scheduler.ExecutorDetails) WorkerSlot(org.apache.storm.scheduler.WorkerSlot) RAS_Node(org.apache.storm.scheduler.resource.RAS_Node)

Aggregations

RAS_Node (org.apache.storm.scheduler.resource.RAS_Node)6 WorkerSlot (org.apache.storm.scheduler.WorkerSlot)5 HashMap (java.util.HashMap)4 ExecutorDetails (org.apache.storm.scheduler.ExecutorDetails)4 ArrayList (java.util.ArrayList)3 Collection (java.util.Collection)3 LinkedList (java.util.LinkedList)3 List (java.util.List)3 Map (java.util.Map)3 Config (org.apache.storm.Config)1 DNSToSwitchMapping (org.apache.storm.networktopography.DNSToSwitchMapping)1 Cluster (org.apache.storm.scheduler.Cluster)1 INimbus (org.apache.storm.scheduler.INimbus)1 SchedulerAssignmentImpl (org.apache.storm.scheduler.SchedulerAssignmentImpl)1 SupervisorDetails (org.apache.storm.scheduler.SupervisorDetails)1 Topologies (org.apache.storm.scheduler.Topologies)1 TopologyDetails (org.apache.storm.scheduler.TopologyDetails)1 RAS_Nodes (org.apache.storm.scheduler.resource.RAS_Nodes)1 SchedulingResult (org.apache.storm.scheduler.resource.SchedulingResult)1 SchedulingState (org.apache.storm.scheduler.resource.SchedulingState)1