Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
野花太放肆
jenkins
提交
d9a37f2c
J
jenkins
项目概览
野花太放肆
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
J
jenkins
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d9a37f2c
编写于
5月 09, 2011
作者:
K
Kohsuke Kawaguchi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Provide richer information to QueueTaskDispatcher.
上级
9171338e
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
72 addition
and
9 deletion
+72
-9
changelog.html
changelog.html
+3
-1
core/src/main/java/hudson/model/Node.java
core/src/main/java/hudson/model/Node.java
+18
-2
core/src/main/java/hudson/model/Queue.java
core/src/main/java/hudson/model/Queue.java
+5
-5
core/src/main/java/hudson/model/queue/QueueTaskDispatcher.java
...src/main/java/hudson/model/queue/QueueTaskDispatcher.java
+31
-1
core/src/main/java/hudson/slaves/NodeProperty.java
core/src/main/java/hudson/slaves/NodeProperty.java
+15
-0
未找到文件。
changelog.html
浏览文件 @
d9a37f2c
...
...
@@ -55,7 +55,9 @@ Upcoming changes</a>
<!-- Record your changes in the trunk here. -->
<div
id=
"trunk"
style=
"display:none"
>
<!--=TRUNK-BEGIN=-->
<ul
class=
image
>
<li
class=
>
<li
class=
rfe
>
Provide more information to
<tt>
QueueTaskDispatcher
</tt>
(
<a
href=
"https://groups.google.com/d/topic/jenkinsci-dev/H1o_essBS_A/discussion"
>
thread
</a>
)
</ul>
</div>
<!--=TRUNK-END=-->
...
...
core/src/main/java/hudson/model/Node.java
浏览文件 @
d9a37f2c
...
...
@@ -285,9 +285,25 @@ public abstract class Node extends AbstractModelObject implements Reconfigurable
* task cannot be run.
*
* @since 1.360
* @deprecated as of 1.413
* Use {@link #canTake(Queue.BuildableItem)}
*/
public
CauseOfBlockage
canTake
(
Task
task
)
{
Label
l
=
task
.
getAssignedLabel
();
return
null
;
}
/**
* Called by the {@link Queue} to determine whether or not this node can
* take the given task. The default checks include whether or not this node
* is part of the task's assigned label, whether this node is in
* {@link Mode#EXCLUSIVE} mode if it is not in the task's assigned label,
* and whether or not any of this node's {@link NodeProperty}s say that the
* task cannot be run.
*
* @since 1.413
*/
public
CauseOfBlockage
canTake
(
Queue
.
BuildableItem
item
)
{
Label
l
=
item
.
task
.
getAssignedLabel
();
if
(
l
!=
null
&&
!
l
.
contains
(
this
))
return
CauseOfBlockage
.
fromMessage
(
Messages
.
_Node_LabelMissing
(
getNodeName
(),
l
));
// the task needs to be executed on label that this node doesn't have.
...
...
@@ -297,7 +313,7 @@ public abstract class Node extends AbstractModelObject implements Reconfigurable
// Check each NodeProperty to see whether they object to this node
// taking the task
for
(
NodeProperty
prop:
getNodeProperties
())
{
CauseOfBlockage
c
=
prop
.
canTake
(
task
);
CauseOfBlockage
c
=
prop
.
canTake
(
item
);
if
(
c
!=
null
)
return
c
;
}
...
...
core/src/main/java/hudson/model/Queue.java
浏览文件 @
d9a37f2c
...
...
@@ -201,15 +201,15 @@ public class Queue extends ResourceController implements Saveable {
/**
* Verifies that the {@link Executor} represented by this object is capable of executing the given task.
*/
public
boolean
canTake
(
Task
task
)
{
public
boolean
canTake
(
BuildableItem
item
)
{
Node
node
=
getNode
();
if
(
node
==
null
)
return
false
;
// this executor is about to die
if
(
node
.
canTake
(
task
)!=
null
)
if
(
node
.
canTake
(
item
)!=
null
)
return
false
;
// this node is not able to take the task
for
(
QueueTaskDispatcher
d
:
QueueTaskDispatcher
.
all
())
if
(
d
.
canTake
(
node
,
task
)!=
null
)
if
(
d
.
canTake
(
node
,
item
)!=
null
)
return
false
;
return
isAvailable
();
...
...
@@ -614,7 +614,7 @@ public class Queue extends ResourceController implements Saveable {
private
void
_getBuildableItems
(
Computer
c
,
ItemList
<
BuildableItem
>
col
,
List
<
BuildableItem
>
result
)
{
Node
node
=
c
.
getNode
();
for
(
BuildableItem
p
:
col
.
values
())
{
if
(
node
.
canTake
(
p
.
task
)
==
null
)
if
(
node
.
canTake
(
p
)
==
null
)
result
.
add
(
p
);
}
}
...
...
@@ -791,7 +791,7 @@ public class Queue extends ResourceController implements Saveable {
List
<
JobOffer
>
candidates
=
new
ArrayList
<
JobOffer
>(
parked
.
size
());
for
(
JobOffer
j
:
parked
.
values
())
if
(
j
.
canTake
(
p
.
task
))
if
(
j
.
canTake
(
p
))
candidates
.
add
(
j
);
MappingWorksheet
ws
=
new
MappingWorksheet
(
p
,
candidates
);
...
...
core/src/main/java/hudson/model/queue/QueueTaskDispatcher.java
浏览文件 @
d9a37f2c
...
...
@@ -30,6 +30,7 @@ import hudson.ExtensionPoint;
import
hudson.model.Hudson
;
import
hudson.model.Node
;
import
hudson.model.Queue
;
import
hudson.model.Queue.BuildableItem
;
import
hudson.model.Queue.Task
;
/**
...
...
@@ -59,8 +60,37 @@ public abstract class QueueTaskDispatcher implements ExtensionPoint {
* Vetos are additive. When multiple {@link QueueTaskDispatcher}s are in the system,
* the task won't run on the given node if any one of them returns a non-null value.
* (This relationship is also the same with built-in check logic.)
*
* @deprecated since 1.413
* Use {@link #canTake(Node, BuildableItem)}
*/
public
abstract
CauseOfBlockage
canTake
(
Node
node
,
Task
task
);
public
CauseOfBlockage
canTake
(
Node
node
,
Task
task
)
{
return
null
;
}
/**
* Called whenever {@link Queue} is considering to execute the given task on a given node.
*
* <p>
* Implementations can return null to indicate that the assignment is fine, or it can return
* a non-null instance to block the execution of the task on the given node.
*
* <p>
* Queue doesn't remember/cache the response from dispatchers, and instead it'll keep asking.
* The upside of this is that it's very easy to block execution for a limited time period (
* as you just need to return null when it's ready to execute.) The downside of this is that
* the decision needs to be made quickly.
*
* <p>
* Vetos are additive. When multiple {@link QueueTaskDispatcher}s are in the system,
* the task won't run on the given node if any one of them returns a non-null value.
* (This relationship is also the same with built-in check logic.)
*
* @sine 1.413
*/
public
CauseOfBlockage
canTake
(
Node
node
,
BuildableItem
item
)
{
return
canTake
(
node
,
item
.
task
);
// backward compatible behaviour
}
/**
* All registered {@link QueueTaskDispatcher}s.
...
...
core/src/main/java/hudson/slaves/NodeProperty.java
浏览文件 @
d9a37f2c
...
...
@@ -28,6 +28,7 @@ import hudson.FilePath;
import
hudson.Launcher
;
import
hudson.DescriptorExtensionList
;
import
hudson.model.Descriptor.FormException
;
import
hudson.model.Queue.BuildableItem
;
import
hudson.model.ReconfigurableDescribable
;
import
hudson.model.queue.CauseOfBlockage
;
import
hudson.scm.SCM
;
...
...
@@ -85,11 +86,25 @@ public abstract class NodeProperty<N extends Node> implements ReconfigurableDesc
* associated node. By default, this method returns <code>null</code>.
*
* @since 1.360
* @deprecated as of 1.413
* Use {@link #canTake(BuildableItem)}
*/
public
CauseOfBlockage
canTake
(
Task
task
)
{
return
null
;
}
/**
* Called by the {@link Node} to help determine whether or not it should
* take the given task. Individual properties can return a non-null value
* here if there is some reason the given task should not be run on its
* associated node. By default, this method returns <code>null</code>.
*
* @since 1.413
*/
public
CauseOfBlockage
canTake
(
BuildableItem
item
)
{
return
canTake
(
item
.
task
);
// backward compatible behaviour
}
/**
* Runs before the {@link SCM#checkout(AbstractBuild, Launcher, FilePath, BuildListener, File)} runs, and performs a set up.
* Can contribute additional properties to the environment.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录