Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
xxadev
jenkins
提交
46d94e08
J
jenkins
项目概览
xxadev
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
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,发现更多精彩内容 >>
提交
46d94e08
编写于
2月 12, 2013
作者:
K
Kevin P. Fleming
提交者:
Kohsuke Kawaguchi
2月 13, 2013
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adding a mechanism for NodeProvisioner to know when it's done.
This came from pull request #705
上级
4b1a95f2
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
42 addition
and
4 deletion
+42
-4
core/src/main/java/hudson/slaves/Cloud.java
core/src/main/java/hudson/slaves/Cloud.java
+4
-3
core/src/main/java/hudson/slaves/NodeProvisioner.java
core/src/main/java/hudson/slaves/NodeProvisioner.java
+38
-1
未找到文件。
core/src/main/java/hudson/slaves/Cloud.java
浏览文件 @
46d94e08
...
...
@@ -106,13 +106,14 @@ public abstract class Cloud extends AbstractModelObject implements ExtensionPoin
* Always >= 1. For example, if this is 3, the implementation
* should launch 3 slaves with 1 executor each, or 1 slave with
* 3 executors, etc.
*
* @return
* {@link PlannedNode}s that represent asynchronous {@link Node}
* provisioning operations. Can be empty but must not be null.
* {@link NodeProvisioner} will be responsible for adding the resulting {@link Node}
* {@link NodeProvisioner} will be responsible for adding the resulting {@link Node}
s
* into Hudson via {@link jenkins.model.Jenkins#addNode(Node)}, so a {@link Cloud} implementation
* just needs to create a new node object.
* just needs to return {@link PlannedNode}s that each contain an object that implements {@link Future}.
* When the {@link Future} has completed its work, {@link Future#get} will be called to obtain the
* provisioned {@link Node} object.
*/
public
abstract
Collection
<
PlannedNode
>
provision
(
Label
label
,
int
excessWorkload
);
...
...
core/src/main/java/hudson/slaves/NodeProvisioner.java
浏览文件 @
46d94e08
...
...
@@ -52,22 +52,56 @@ public class NodeProvisioner {
/**
* The node addition activity in progress.
*/
public
static
final
class
PlannedNode
{
public
static
class
PlannedNode
{
/**
* Used to display this planned node to UI. Should ideally include the identifier unique to the node
* being provisioned (like the instance ID), but if such an identifier doesn't readily exist, this
* can be just a name of the template being provisioned (like the machine image ID.)
*/
public
final
String
displayName
;
/**
* Used to launch and return a {@link Node} object. {@link NodeProvisioner} will check
* this {@link Future}'s isDone() method to determine when to finalize this object.
*/
public
final
Future
<
Node
>
future
;
/**
* The number of executors that will be provided by the {@link Node} launched by
* this object. This is used for capacity planning in {@link NodeProvisioner#update}.
*/
public
final
int
numExecutors
;
/**
* Construct a PlannedNode instance without {@link Cloud} callback for finalization.
*
* @param displayName Used to display this object in the UI.
* @param future Used to launch a @{link Node} object.
* @param numExecutors The number of executors that will be provided by the launched {@link Node}.
*/
public
PlannedNode
(
String
displayName
,
Future
<
Node
>
future
,
int
numExecutors
)
{
if
(
displayName
==
null
||
future
==
null
||
numExecutors
<
1
)
throw
new
IllegalArgumentException
();
this
.
displayName
=
displayName
;
this
.
future
=
future
;
this
.
numExecutors
=
numExecutors
;
}
/**
* Indicate that this {@link PlannedNode} is being finalized.
*
* <p>
* {@link NodeProvisioner} will call this method when it's done with {@link PlannedNode}.
* This indicates that the {@link PlannedNode}'s work has been completed
* (successfully or otherwise) and it is about to be removed from the list of pending
* {@link Node}s to be launched.
*
* <p>
* Create a subtype of this class and override this method to add any necessary behaviour.
*
* @since 1.503
*/
public
void
spent
()
{
}
}
/**
...
...
@@ -152,6 +186,9 @@ public class NodeProvisioner {
}
catch
(
IOException
e
)
{
LOGGER
.
log
(
Level
.
WARNING
,
"Provisioned slave "
+
f
.
displayName
+
" failed to launch"
,
e
);
}
f
.
spent
();
itr
.
remove
();
}
else
plannedCapacitySnapshot
+=
f
.
numExecutors
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录