From bfb7bd4ba442774ea8d7ec5e862c9cb1ccc12837 Mon Sep 17 00:00:00 2001 From: Stephen Connolly Date: Fri, 3 Jun 2011 16:15:24 +0100 Subject: [PATCH] When there are absolutely no executors for a specific label, there was an unnecessary delay in provisioning the first node for that label --- changelog.html | 5 ++++- .../main/java/hudson/slaves/NodeProvisioner.java | 13 ++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/changelog.html b/changelog.html index 9cef01f641..8d8b5fc982 100644 --- a/changelog.html +++ b/changelog.html @@ -81,7 +81,10 @@ Upcoming changes Strongly encrypt proxy credentials (issue 4002)
  • - Added an extension point to allow prodding the NodeProvisioner into taking action faster than it might usually. + Added an extension point to allow prodding the NodeProvisioner into taking action faster than it might usually. +
  • + When there are absolutely no executors for a specific label, there was an unnecessary delay in provisioning the + first node for that label. diff --git a/core/src/main/java/hudson/slaves/NodeProvisioner.java b/core/src/main/java/hudson/slaves/NodeProvisioner.java index c72091a973..7c6a955958 100644 --- a/core/src/main/java/hudson/slaves/NodeProvisioner.java +++ b/core/src/main/java/hudson/slaves/NodeProvisioner.java @@ -143,7 +143,7 @@ public class NodeProvisioner { Hudson hudson = Hudson.getInstance(); // clean up the cancelled launch activity, then count the # of executors that we are about to bring up. - float plannedCapacity = 0; + int plannedCapacitySnapshot = 0; for (Iterator itr = pendingLaunches.iterator(); itr.hasNext();) { PlannedNode f = itr.next(); if(f.future.isDone()) { @@ -159,8 +159,9 @@ public class NodeProvisioner { } itr.remove(); } else - plannedCapacity += f.numExecutors; + plannedCapacitySnapshot += f.numExecutors; } + float plannedCapacity = plannedCapacitySnapshot; plannedCapacitiesEMA.update(plannedCapacity); /* @@ -197,8 +198,9 @@ public class NodeProvisioner { int idleSnapshot = stat.computeIdleExecutors(); int totalSnapshot = stat.computeTotalExecutors(); + boolean needSomeWhenNoneAtAll = ((totalSnapshot + plannedCapacity) == 0) && (stat.computeQueueLength() > 0); float idle = Math.max(stat.getLatestIdleExecutors(TIME_SCALE), idleSnapshot); - if(idle1-m) {// and there's more work to do... LOGGER.fine("Excess workload "+excessWorkload+" detected. (planned capacity="+plannedCapacity+",Qlen="+qlen+",idle="+idle+"&"+idleSnapshot+",total="+totalSnapshot+"m,="+m+")");