Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
LinuxSuRen
jenkins
提交
af95fef7
J
jenkins
项目概览
LinuxSuRen
/
jenkins
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
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,发现更多精彩内容 >>
未验证
提交
af95fef7
编写于
12月 08, 2017
作者:
J
Jesse Glick
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Removing core/src/main/groovy/.
上级
c4dff1ba
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
49 addition
and
193 deletion
+49
-193
core/pom.xml
core/pom.xml
+1
-1
core/src/main/groovy/hudson/util/LoadMonitor.groovy
core/src/main/groovy/hudson/util/LoadMonitor.groovy
+0
-116
core/src/main/groovy/jenkins/util/groovy/AbstractGroovyViewModule.groovy
...roovy/jenkins/util/groovy/AbstractGroovyViewModule.groovy
+0
-47
core/src/main/java/jenkins/util/groovy/AbstractGroovyViewModule.java
...in/java/jenkins/util/groovy/AbstractGroovyViewModule.java
+48
-0
pom.xml
pom.xml
+0
-28
test/pom.xml
test/pom.xml
+0
-1
未找到文件。
core/pom.xml
浏览文件 @
af95fef7
...
...
@@ -799,10 +799,10 @@ THE SOFTWARE.
<plugin>
<!-- run unit test in src/test/java -->
<groupId>
org.codehaus.gmaven
</groupId>
<artifactId>
gmaven-plugin
</artifactId>
<!-- version specified in grandparent pom -->
<executions>
<execution>
<goals>
<goal>
generateTestStubs
</goal>
<goal>
testCompile
</goal>
</goals>
</execution>
...
...
core/src/main/groovy/hudson/util/LoadMonitor.groovy
已删除
100644 → 0
浏览文件 @
c4dff1ba
/*
* The MIT License
*
* Copyright (c) 2004-2009, Sun Microsystems, Inc., Kohsuke Kawaguchi
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package
hudson.util
import
hudson.model.Computer
import
jenkins.util.Timer
import
jenkins.model.Jenkins
import
hudson.model.Label
import
hudson.model.Queue.BlockedItem
import
hudson.model.Queue.BuildableItem
import
hudson.model.Queue.WaitingItem
import
hudson.triggers.SafeTimerTask
import
java.text.DateFormat
import
java.util.concurrent.TimeUnit
/**
* Spits out the load information.
*
* <p>
* I'm using this code to design the auto scaling feature.
* In future this might be useful data to expose to the UI.
*
* @author Kohsuke Kawaguchi
*/
public
class
LoadMonitorImpl
extends
SafeTimerTask
{
private
final
File
dataFile
;
private
List
<
String
>
labels
;
public
LoadMonitorImpl
(
File
dataFile
)
{
this
.
dataFile
=
dataFile
;
labels
=
Jenkins
.
getInstance
().
labels
*.
name
;
printHeaders
();
Timer
.
get
().
scheduleAtFixedRate
(
this
,
0
,
10
*
1000
,
TimeUnit
.
MILLISECONDS
);
}
private
String
quote
(
Object
s
)
{
"\"${s}\""
;
}
protected
void
printHeaders
()
{
def
headers
=
[
"# of executors"
,
"# of busy executors"
,
"BuildableItems in Q"
,
"BuildableItem avg wait time"
];
def
data
=
[
"timestamp"
];
data
+=
headers
;
data
+=
[
"WaitingItems in Q"
,
"BlockedItems in Q"
];
for
(
String
label
:
labels
)
data
+=
headers
.
collect
{
"${it} (${label}}"
}
dataFile
.
append
(
data
.
collect
({
quote
(
it
)
}).
join
(
","
)+
"\n"
);
}
@Override
protected
void
doRun
()
{
def
now
=
new
Date
();
def
data
=
[];
data
.
add
(
quote
(
FORMATTER
.
format
(
now
)));
def
h
=
Jenkins
.
getInstance
();
def
items
=
h
.
queue
.
items
;
def
filterByType
=
{
Class
type
->
items
.
findAll
{
type
.
isInstance
(
it
)
}
}
def
builder
=
{
List
<
Computer
>
cs
,
Closure
itemFilter
->
// number of total executor, number of busy executor
data
.
add
(
cs
.
sum
{
it
.
isOffline
()
?
0
:
it
.
numExecutors
});
data
.
add
(
cs
.
sum
{
Computer
c
->
c
.
executors
.
findAll
{
!
it
.
isIdle
()
}.
size
()
});
// queue statistics
def
is
=
filterByType
(
BuildableItem
).
findAll
(
itemFilter
);
data
.
add
(
is
.
size
());
data
.
add
(
is
.
sum
{
BuildableItem
bi
->
now
.
time
-
bi
.
buildableStartMilliseconds
}?:
0
/
Math
.
max
(
1
,
is
.
size
())
);
};
// for the whole thing
builder
(
Arrays
.
asList
(
h
.
computers
),{
it
->
true
});
data
.
add
(
filterByType
(
WaitingItem
).
size
());
data
.
add
(
filterByType
(
BlockedItem
).
size
());
// per label stats
for
(
String
label
:
labels
)
{
Label
l
=
h
.
getLabel
(
label
)
builder
(
l
.
nodes
.
collect
{
it
.
toComputer
()
})
{
BuildableItem
bi
->
bi
.
task
.
assignedLabel
==
l
};
}
dataFile
.
append
(
data
.
join
(
","
)+
"\n"
);
}
private
static
final
DateFormat
FORMATTER
=
DateFormat
.
getDateTimeInstance
();
}
new
LoadMonitorImpl
(
new
File
(
"/files/hudson/load.txt"
));
core/src/main/groovy/jenkins/util/groovy/AbstractGroovyViewModule.groovy
已删除
100644 → 0
浏览文件 @
c4dff1ba
package
jenkins.util.groovy
import
lib.FormTagLib
import
lib.LayoutTagLib
import
org.kohsuke.stapler.jelly.groovy.JellyBuilder
import
org.kohsuke.stapler.jelly.groovy.Namespace
import
lib.JenkinsTagLib
/**
* Base class for utility classes for Groovy view scripts
* <p />
* Usage from script of a subclass, say ViewHelper:
* <p />
* <tt>new ViewHelper(delegate).method();</tt>
* <p />
* see <tt>ModularizeViewScript</tt> in ui-samples for an example how to use this class.
*
* @author Stefan Wolf (wolfs)
*/
abstract
class
AbstractGroovyViewModule
{
JellyBuilder
builder
FormTagLib
f
LayoutTagLib
l
JenkinsTagLib
t
Namespace
st
public
AbstractGroovyViewModule
(
JellyBuilder
b
)
{
builder
=
b
f
=
builder
.
namespace
(
FormTagLib
)
l
=
builder
.
namespace
(
LayoutTagLib
)
t
=
builder
.
namespace
(
JenkinsTagLib
)
st
=
builder
.
namespace
(
"jelly:stapler"
)
}
def
methodMissing
(
String
name
,
args
)
{
builder
.
invokeMethod
(
name
,
args
)
}
def
propertyMissing
(
String
name
)
{
builder
.
getProperty
(
name
)
}
def
propertyMissing
(
String
name
,
value
)
{
builder
.
setProperty
(
name
,
value
)
}
}
core/src/main/java/jenkins/util/groovy/AbstractGroovyViewModule.java
0 → 100644
浏览文件 @
af95fef7
package
jenkins.util.groovy
;
import
groovy.lang.GroovyObjectSupport
;
import
lib.FormTagLib
;
import
lib.LayoutTagLib
;
import
org.kohsuke.stapler.jelly.groovy.JellyBuilder
;
import
org.kohsuke.stapler.jelly.groovy.Namespace
;
import
lib.JenkinsTagLib
;
/**
* Base class for utility classes for Groovy view scripts
* <p />
* Usage from script of a subclass, say ViewHelper:
* <p />
* <tt>new ViewHelper(delegate).method();</tt>
* <p />
* see <tt>ModularizeViewScript</tt> in ui-samples for an example how to use
* this class.
*/
public
abstract
class
AbstractGroovyViewModule
extends
GroovyObjectSupport
{
public
JellyBuilder
builder
;
public
FormTagLib
f
;
public
LayoutTagLib
l
;
public
JenkinsTagLib
t
;
public
Namespace
st
;
public
AbstractGroovyViewModule
(
JellyBuilder
b
)
{
builder
=
b
;
f
=
builder
.
namespace
(
FormTagLib
.
class
);
l
=
builder
.
namespace
(
LayoutTagLib
.
class
);
t
=
builder
.
namespace
(
JenkinsTagLib
.
class
);
st
=
builder
.
namespace
(
"jelly:stapler"
);
}
public
Object
methodMissing
(
String
name
,
Object
args
)
{
return
builder
.
invokeMethod
(
name
,
args
);
}
public
Object
propertyMissing
(
String
name
)
{
return
builder
.
getProperty
(
name
);
}
public
void
propertyMissing
(
String
name
,
Object
value
)
{
builder
.
setProperty
(
name
,
value
);
}
}
pom.xml
浏览文件 @
af95fef7
...
...
@@ -722,34 +722,6 @@ THE SOFTWARE.
<groupId>
org.jenkins-ci.tools
</groupId>
<artifactId>
maven-jenkins-dev-plugin
</artifactId>
</plugin>
<!--<plugin>
<groupId>org.jvnet.fix1600</groupId>
<artifactId>fix1600</artifactId>
<executions>
<execution>
<goals>
<goal>fix</goal>
</goals>
</execution>
</executions>
</plugin>-->
<plugin>
<groupId>
org.codehaus.gmaven
</groupId>
<artifactId>
gmaven-plugin
</artifactId>
<executions>
<execution>
<goals>
<goal>
generateStubs
</goal>
<goal>
compile
</goal>
<goal>
generateTestStubs
</goal>
<goal>
testCompile
</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<extensions>
...
...
test/pom.xml
浏览文件 @
af95fef7
...
...
@@ -244,7 +244,6 @@ THE SOFTWARE.
<plugin>
<groupId>
org.codehaus.gmaven
</groupId>
<artifactId>
gmaven-plugin
</artifactId>
<!-- version specified in grandparent pom -->
<executions>
<execution>
<id>
default
</id>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录