Commit 86956664 authored by Fabien Viale's avatar Fabien Viale
Browse files

SchedulingMethodImpl: optional non-strict fifo mode

This mode can improve throughput when a strict fifo order it not mandatory
parent 645ff420
......@@ -108,6 +108,11 @@ pa.scheduler.policy=org.ow2.proactive.scheduler.policy.ExtendedSchedulerPolicy
# Defines the maximum number of tasks to be scheduled in each scheduling loop.
pa.scheduler.policy.nbtaskperloop=10
# If set to true (default), the scheduling loop will deploy tasks only on nodes which are free at the beginning of the loop.
# This is mandatory in order to respect strict task fifo order or priorities, but it can reduce the task throughput.
# Change this setting if a lot a short lived tasks are scheduled per minute and enforcing strict fifo priority is not mandatory
pa.scheduler.policy.strict.fifo=true
# Path of the license properties file
pa.scheduler.license.policy.configuration=config/scheduler/license.properties
......
......@@ -61,6 +61,11 @@ public enum PASchedulerProperties implements PACommonProperties {
/** Defines the maximum number of tasks to be scheduled in each scheduling loop (not used any more). */
SCHEDULER_POLICY_NBTASKPERLOOP("pa.scheduler.policy.nbtaskperloop", PropertyType.INTEGER, "10"),
/** If set to true (default), the scheduling loop will deploy tasks on nodes which are free at the beginning of the loop.
* This is mandatory in order to respect strict task fifo order or priorities, but it can reduce the task throughput.
* Change this setting if a lot a short lived tasks are scheduled per minute and enforce strict fifo priority is not mandatory **/
SCHEDULER_POLCY_STRICT_FIFO("pa.scheduler.policy.strict.fifo", PropertyType.BOOLEAN, "true"),
/** Path of the license properties file. */
SCHEDULER_LICENSE_POLICY_CONFIGURATION("pa.scheduler.license.policy.configuration", PropertyType.STRING),
......
......@@ -224,7 +224,10 @@ public final class SchedulingMethodImpl implements SchedulingMethod {
schedulingMainLoopTimingLogger.start("getFreeResources");
//get rmState and update it in scheduling policy
Set<String> freeResources = getFreeResources(currentPolicy);
Set<String> freeResources = null;
if (PASchedulerProperties.SCHEDULER_POLCY_STRICT_FIFO.getValueAsBoolean()) {
freeResources = getFreeResources(currentPolicy);
}
schedulingMainLoopTimingLogger.end("getFreeResources");
......@@ -235,7 +238,7 @@ public final class SchedulingMethodImpl implements SchedulingMethod {
setPendingStatusesToAllEligibleTasks(fullListOfTaskRetrievedFromPolicy);
//if there is no free resources, stop it right now without starting any task
if (freeResources.isEmpty()) {
if (PASchedulerProperties.SCHEDULER_POLCY_STRICT_FIFO.getValueAsBoolean() && freeResources.isEmpty()) {
updateNeededNodes(computeNeededNodes(fullListOfTaskRetrievedFromPolicy));
return 0;
......@@ -346,7 +349,8 @@ public final class SchedulingMethodImpl implements SchedulingMethod {
schedulingMainLoopTimingLogger.end("loadAndInit");
while (!tasksRetrievedFromPolicy.isEmpty() && !freeResources.isEmpty()) {
while (!tasksRetrievedFromPolicy.isEmpty() &&
(!PASchedulerProperties.SCHEDULER_POLCY_STRICT_FIFO.getValueAsBoolean() || !freeResources.isEmpty())) {
//get the next compatible tasks from the whole returned policy tasks
LinkedList<EligibleTaskDescriptor> tasksToSchedule = new LinkedList<>();
......@@ -374,7 +378,7 @@ public final class SchedulingMethodImpl implements SchedulingMethod {
NodeSet nodeSet = getRMNodes(jobMap, neededResourcesNumber, tasksToSchedule, freeResources);
schedulingMainLoopTimingLogger.end("getRMNodes");
if (nodeSet != null) {
if (PASchedulerProperties.SCHEDULER_POLCY_STRICT_FIFO.getValueAsBoolean() && nodeSet != null) {
freeResources.removeAll(nodeSet.getAllNodesUrls());
}
......@@ -407,7 +411,9 @@ public final class SchedulingMethodImpl implements SchedulingMethod {
if (!nodeSet.isEmpty()) {
schedulingMainLoopTimingLogger.start("releaseNodes");
releaseNodes(currentJob, nodeSet);
freeResources.addAll(nodeSet.getAllNodesUrls());
if (PASchedulerProperties.SCHEDULER_POLCY_STRICT_FIFO.getValueAsBoolean()) {
freeResources.addAll(nodeSet.getAllNodesUrls());
}
schedulingMainLoopTimingLogger.end("releaseNodes");
}
//and leave the loop
......@@ -420,7 +426,9 @@ public final class SchedulingMethodImpl implements SchedulingMethod {
//so try to get back every remaining nodes to the resource manager
try {
releaseNodes(currentJob, nodeSet);
freeResources.addAll(nodeSet.getAllNodesUrls());
if (PASchedulerProperties.SCHEDULER_POLCY_STRICT_FIFO.getValueAsBoolean()) {
freeResources.addAll(nodeSet.getAllNodesUrls());
}
} catch (Exception e2) {
logger.info("Unable to get back the nodeSet to the RM", e2);
}
......@@ -433,7 +441,9 @@ public final class SchedulingMethodImpl implements SchedulingMethod {
//so try to get back every remaining nodes to the resource manager
try {
releaseNodes(currentJob, nodeSet);
freeResources.addAll(nodeSet.getAllNodesUrls());
if (PASchedulerProperties.SCHEDULER_POLCY_STRICT_FIFO.getValueAsBoolean()) {
freeResources.addAll(nodeSet.getAllNodesUrls());
}
} catch (Exception e2) {
logger.info("Unable to get back the nodeSet to the RM", e2);
}
......@@ -579,7 +589,9 @@ public final class SchedulingMethodImpl implements SchedulingMethod {
internalTask0.getRuntimeVariables()));
criteria.setBlackList(internalTask0.getNodeExclusion());
criteria.setBestEffort(bestEffort);
criteria.setAcceptableNodesUrls(freeResources);
if (PASchedulerProperties.SCHEDULER_POLCY_STRICT_FIFO.getValueAsBoolean()) {
criteria.setAcceptableNodesUrls(freeResources);
}
criteria.setBindings(createBindingsForSelectionScripts(currentJob, internalTask0, schedulingService));
if (internalTask0.getRuntimeGenericInformation().containsKey(SchedulerConstants.NODE_ACCESS_TOKEN)) {
criteria.setNodeAccessToken(internalTask0.getRuntimeGenericInformation()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment