提交 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>
<!-- Record your changes in the trunk here. -->
<div id="trunk" style="display:none"><!--=TRUNK-BEGIN=-->
<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>
Close drop-down button menu when clicking outside
(<a href="https://issues.jenkins-ci.org/browse/JENKINS-17050">issue 17050</a>)
......
......@@ -26,6 +26,8 @@ package hudson.model;
import hudson.Extension;
import hudson.model.MultiStageTimeSeries.TimeScale;
import hudson.model.MultiStageTimeSeries.TrendChart;
import hudson.model.queue.SubTask;
import hudson.model.queue.Tasks;
import hudson.util.ColorPalette;
import hudson.util.NoOverlapCategoryAxis;
import jenkins.model.Jenkins;
......@@ -230,8 +232,9 @@ public abstract class LoadStatistics {
private int count(List<Queue.BuildableItem> bis, Label l) {
int q=0;
for (Queue.BuildableItem bi : bis) {
if(bi.task.getAssignedLabel()==l)
q++;
for (SubTask st : Tasks.getSubTasksOf(bi.task))
if (st.getAssignedLabel()==l)
q++;
}
return q;
}
......
......@@ -819,11 +819,13 @@ public class Queue extends ResourceController implements Saveable {
public synchronized int countBuildableItemsFor(Label l) {
int r = 0;
for (BuildableItem bi : buildables.values())
if(bi.getAssignedLabel()==l)
r++;
for (SubTask st : bi.task.getSubTasks())
if (null==l || st.getAssignedLabel()==l)
r++;
for (BuildableItem bi : pendings.values())
if(bi.getAssignedLabel()==l)
r++;
for (SubTask st : bi.task.getSubTasks())
if (null==l || st.getAssignedLabel()==l)
r++;
return r;
}
......@@ -831,7 +833,7 @@ public class Queue extends ResourceController implements Saveable {
* Counts all the {@link BuildableItem}s currently in the queue.
*/
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.
先完成此消息的编辑!
想要评论请 注册