use of org.apache.storm.scheduler.resource.strategies.scheduling.sorter.ExecSorterByConnectionCount in project storm by apache.
the class BaseResourceAwareStrategy method prepareForScheduling.
/**
* Initialize instance variables as the first step in {@link #schedule(Cluster, TopologyDetails)}.
* This method may be extended by subclasses to initialize additional variables as in
* {@link ConstraintSolverStrategy#prepareForScheduling(Cluster, TopologyDetails)}.
*
* @param cluster on which executors will be scheduled.
* @param topologyDetails to be scheduled.
*/
protected void prepareForScheduling(Cluster cluster, TopologyDetails topologyDetails) {
this.cluster = cluster;
this.topologyDetails = topologyDetails;
// from Cluster
this.nodes = new RasNodes(cluster);
networkTopography = cluster.getNetworkTopography();
hostnameToNodes = this.nodes.getHostnameToNodes();
// from TopologyDetails
topoName = topologyDetails.getName();
execToComp = topologyDetails.getExecutorToComponent();
compToExecs = topologyDetails.getComponentToExecutors();
Map<String, Object> topoConf = topologyDetails.getConf();
orderExecutorsByProximity = isOrderByProximity(topoConf);
maxSchedulingTimeMs = computeMaxSchedulingTimeMs(topoConf);
// From Cluster and TopologyDetails - and cleaned-up
// all unassigned executors including system components execs
unassignedExecutors = Collections.unmodifiableSet(new HashSet<>(cluster.getUnassignedExecutors(topologyDetails)));
int confMaxStateSearch = getMaxStateSearchFromTopoConf(topologyDetails.getConf());
int daemonMaxStateSearch = ObjectReader.getInt(cluster.getConf().get(DaemonConfig.RESOURCE_AWARE_SCHEDULER_MAX_STATE_SEARCH));
maxStateSearch = Math.min(daemonMaxStateSearch, confMaxStateSearch);
LOG.debug("The max state search configured by topology {} is {}", topologyDetails.getId(), confMaxStateSearch);
LOG.debug("The max state search that will be used by topology {} is {}", topologyDetails.getId(), maxStateSearch);
searcherState = createSearcherState();
setNodeSorter(new NodeSorterHostProximity(cluster, topologyDetails, nodeSortType));
setExecSorter(orderExecutorsByProximity ? new ExecSorterByProximity(topologyDetails) : new ExecSorterByConnectionCount(topologyDetails));
logClusterInfo();
}
Aggregations