use of org.apache.storm.scheduler.resource.strategies.scheduling.sorter.ExecSorterByConstraintSeverity in project storm by apache.
the class ConstraintSolverStrategy method prepareForScheduling.
@Override
protected void prepareForScheduling(Cluster cluster, TopologyDetails topologyDetails) {
super.prepareForScheduling(cluster, topologyDetails);
// populate additional instance variables
constraintSolverConfig = new ConstraintSolverConfig(topologyDetails);
setExecSorter(new ExecSorterByConstraintSeverity(cluster, topologyDetails));
}
use of org.apache.storm.scheduler.resource.strategies.scheduling.sorter.ExecSorterByConstraintSeverity in project storm by apache.
the class TestConstraintSolverStrategy method testConstraintSolverForceBacktrackWithSpreadCoLocation.
@Test
public void testConstraintSolverForceBacktrackWithSpreadCoLocation() {
// to find an answer.
if (CO_LOCATION_CNT > 1 && !consolidatedConfigFlag) {
LOG.info("INFO: Skipping Test {} with {}={} (required 1), and consolidatedConfigFlag={} (required false)", "testConstraintSolverForceBacktrackWithSpreadCoLocation", ConstraintSolverConfig.CONSTRAINT_TYPE_MAX_NODE_CO_LOCATION_CNT, CO_LOCATION_CNT, consolidatedConfigFlag);
return;
}
ConstraintSolverStrategy cs = new ConstraintSolverStrategy() {
protected void prepareForScheduling(Cluster cluster, TopologyDetails topologyDetails) {
super.prepareForScheduling(cluster, topologyDetails);
// set a reversing execSorter instance
IExecSorter execSorter = new ExecSorterByConstraintSeverity(cluster, topologyDetails) {
@Override
public List<ExecutorDetails> sortExecutors(Set<ExecutorDetails> unassignedExecutors) {
List<ExecutorDetails> tmp = super.sortExecutors(unassignedExecutors);
List<ExecutorDetails> reversed = new ArrayList<>();
while (!tmp.isEmpty()) {
reversed.add(0, tmp.remove(0));
}
return reversed;
}
};
setExecSorter(execSorter);
}
};
basicUnitTestWithKillAndRecover(cs, BACKTRACK_BOLT_PARALLEL, CO_LOCATION_CNT);
}
Aggregations