|
40 | 40 | import hudson.model.Queue.Task; |
41 | 41 | import hudson.model.labels.LabelAssignmentAction; |
42 | 42 | import hudson.security.ACL; |
| 43 | +import hudson.slaves.DumbSlave; |
| 44 | +import java.time.Duration; |
43 | 45 | import java.util.AbstractList; |
44 | 46 | import java.util.ArrayList; |
45 | 47 | import java.util.Collection; |
@@ -330,15 +332,27 @@ public MappingWorksheet(BuildableItem item, List<? extends ExecutorSlot> offers, |
330 | 332 | this.item = item; |
331 | 333 |
|
332 | 334 | // group executors by their computers |
| 335 | + boolean someNonCloud = false; |
333 | 336 | Map<Computer, List<ExecutorSlot>> j = new HashMap<>(); |
334 | 337 | for (ExecutorSlot o : offers) { |
335 | 338 | Computer c = o.getExecutor().getOwner(); |
| 339 | + if (!someNonCloud) { |
| 340 | + Node n = c.getNode(); |
| 341 | + if (n == null || n instanceof DumbSlave) { |
| 342 | + someNonCloud = true; |
| 343 | + } |
| 344 | + } |
336 | 345 | List<ExecutorSlot> l = j.computeIfAbsent(c, k -> new ArrayList<>()); |
337 | 346 | l.add(o); |
338 | 347 | } |
339 | 348 |
|
340 | | - { // take load prediction into account and reduce the available executor pool size accordingly |
| 349 | + if (j.isEmpty()) { |
| 350 | + LOGGER.fine(() -> "nothing to consider for " + item); |
| 351 | + } else if (!someNonCloud) { |
| 352 | + LOGGER.fine(() -> "only cloud agents to consider for " + item + ": " + offers); |
| 353 | + } else { // take load prediction into account and reduce the available executor pool size accordingly |
341 | 354 | long duration = item.task.getEstimatedDuration(); |
| 355 | + LOGGER.fine(() -> "for " + item + " taking " + Duration.ofMillis(duration) + " considering " + offers); |
342 | 356 | if (duration > 0) { |
343 | 357 | long now = System.currentTimeMillis(); |
344 | 358 | for (Map.Entry<Computer, List<ExecutorSlot>> e : j.entrySet()) { |
|
0 commit comments