提交 1d5653a9 编写于 作者: K Kohsuke Kawaguchi

Merge pull request #742

Queue length has to count individual SubTask, so that heavy weight jobs
correctly provision required number of slaves through Cloud.
...@@ -55,6 +55,10 @@ Upcoming changes</a> ...@@ -55,6 +55,10 @@ Upcoming changes</a>
<!-- Record your changes in the trunk here. --> <!-- Record your changes in the trunk here. -->
<div id="trunk" style="display:none"><!--=TRUNK-BEGIN=--> <div id="trunk" style="display:none"><!--=TRUNK-BEGIN=-->
<ul class=image> <ul class=image>
<li class=bug>
When measuring the length of the queue, jobs that consist of multiple subtasks should
count as more than 1.
(<a href="https://github.com/jenkinsci/jenkins/pull/742">pull request 742</a>)
<li class=rfe> <li class=rfe>
Close drop-down button menu when clicking outside Close drop-down button menu when clicking outside
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-17050">issue 17050</a>) (<a href="https://issues.jenkins-ci.org/browse/JENKINS-17050">issue 17050</a>)
......
...@@ -26,6 +26,8 @@ package hudson.model; ...@@ -26,6 +26,8 @@ package hudson.model;
import hudson.Extension; import hudson.Extension;
import hudson.model.MultiStageTimeSeries.TimeScale; import hudson.model.MultiStageTimeSeries.TimeScale;
import hudson.model.MultiStageTimeSeries.TrendChart; import hudson.model.MultiStageTimeSeries.TrendChart;
import hudson.model.queue.SubTask;
import hudson.model.queue.Tasks;
import hudson.util.ColorPalette; import hudson.util.ColorPalette;
import hudson.util.NoOverlapCategoryAxis; import hudson.util.NoOverlapCategoryAxis;
import jenkins.model.Jenkins; import jenkins.model.Jenkins;
...@@ -230,8 +232,9 @@ public abstract class LoadStatistics { ...@@ -230,8 +232,9 @@ public abstract class LoadStatistics {
private int count(List<Queue.BuildableItem> bis, Label l) { private int count(List<Queue.BuildableItem> bis, Label l) {
int q=0; int q=0;
for (Queue.BuildableItem bi : bis) { for (Queue.BuildableItem bi : bis) {
if(bi.task.getAssignedLabel()==l) for (SubTask st : Tasks.getSubTasksOf(bi.task))
q++; if (st.getAssignedLabel()==l)
q++;
} }
return q; return q;
} }
......
...@@ -819,11 +819,13 @@ public class Queue extends ResourceController implements Saveable { ...@@ -819,11 +819,13 @@ public class Queue extends ResourceController implements Saveable {
public synchronized int countBuildableItemsFor(Label l) { public synchronized int countBuildableItemsFor(Label l) {
int r = 0; int r = 0;
for (BuildableItem bi : buildables.values()) for (BuildableItem bi : buildables.values())
if(bi.getAssignedLabel()==l) for (SubTask st : bi.task.getSubTasks())
r++; if (null==l || st.getAssignedLabel()==l)
r++;
for (BuildableItem bi : pendings.values()) for (BuildableItem bi : pendings.values())
if(bi.getAssignedLabel()==l) for (SubTask st : bi.task.getSubTasks())
r++; if (null==l || st.getAssignedLabel()==l)
r++;
return r; return r;
} }
...@@ -831,7 +833,7 @@ public class Queue extends ResourceController implements Saveable { ...@@ -831,7 +833,7 @@ public class Queue extends ResourceController implements Saveable {
* Counts all the {@link BuildableItem}s currently in the queue. * Counts all the {@link BuildableItem}s currently in the queue.
*/ */
public synchronized int countBuildableItems() { public synchronized int countBuildableItems() {
return buildables.size()+pendings.size(); return countBuildableItemsFor(null);
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册