本文整理了Java中hudson.model.Executor.isBusy()
方法的一些代码示例,展示了Executor.isBusy()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Executor.isBusy()
方法的具体详情如下:
包路径:hudson.model.Executor
类名称:Executor
方法名:isBusy
[英]The opposite of #isIdle() — the executor is doing some work.
[中]#isIdle()的反面-执行者正在做一些工作。
代码示例来源:origin: jenkinsci/jenkins
private static boolean blocksRestart(Executor e) {
if (e.isBusy()) {
AsynchronousExecution execution = e.getAsynchronousExecution();
if (execution != null) {
return execution.blocksRestart();
} else {
return true;
}
} else {
return false;
}
}
}
代码示例来源:origin: com.sonymobile.jenkins.plugins.lenientshutdown/lenientshutdown
/**
* Checks if argument computer is currently building something.
* @param computer the computer to check for
* @return true if computer is building, otherwise false
*/
public static boolean isBuilding(Computer computer) {
boolean isBuilding = false;
List<Executor> executors = new ArrayList<Executor>(computer.getExecutors());
executors.addAll(computer.getOneOffExecutors());
for (Executor executor : executors) {
if (executor.isBusy()) {
isBuilding = true;
break;
}
}
return isBuilding;
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
private static boolean blocksRestart(Executor e) {
if (e.isBusy()) {
AsynchronousExecution execution = e.getAsynchronousExecution();
if (execution != null) {
return execution.blocksRestart();
} else {
return true;
}
} else {
return false;
}
}
}
代码示例来源:origin: jenkinsci/instant-messaging-plugin
private int getBusyExecutors() {
int busyExecutors = 0;
Computer[] computers = Jenkins.getInstance().getComputers();
for (Computer compi : computers) {
for (Executor executor : compi.getExecutors()) {
if (executor.isBusy()) {
busyExecutors++;
}
}
}
return busyExecutors;
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-test-framework
/**
* Waits until Hudson finishes building everything, including those in the queue, or fail the test
* if the specified timeout milliseconds is
*/
protected void waitUntilNoActivityUpTo(int timeout) throws Exception {
long startTime = System.currentTimeMillis();
int streak = 0;
while (true) {
Thread.sleep(10);
if (isSomethingHappening())
streak=0;
else
streak++;
if (streak>5) // the system is quiet for a while
return;
if (System.currentTimeMillis()-startTime > timeout) {
List<Executable> building = new ArrayList<Executable>();
for (Computer c : hudson.getComputers()) {
for (Executor e : c.getExecutors()) {
if (e.isBusy())
building.add(e.getCurrentExecutable());
}
}
throw new AssertionError(String.format("Hudson is still doing something after %dms: queue=%s building=%s",
timeout, Arrays.asList(hudson.getQueue().getItems()), building));
}
}
}
代码示例来源:origin: org.hudsonci.plugins/instant-messaging
private int getBusyExecutors() {
int busyExecutors = 0;
//boolean stillRunningExecutorFound = false;
Computer[] computers = Hudson.getInstance().getComputers();
for (Computer compi : computers) {
for (Executor executor : compi.getExecutors()) {
if (executor.isBusy()) {
busyExecutors++;
}
}
}
return busyExecutors;
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-test-harness
/**
* Waits until Hudson finishes building everything, including those in the queue, or fail the test
* if the specified timeout milliseconds is
*/
protected void waitUntilNoActivityUpTo(int timeout) throws Exception {
long startTime = System.currentTimeMillis();
int streak = 0;
while (true) {
Thread.sleep(10);
if (isSomethingHappening())
streak=0;
else
streak++;
if (streak>5) // the system is quiet for a while
return;
if (System.currentTimeMillis()-startTime > timeout) {
List<Executable> building = new ArrayList<Executable>();
for (Computer c : hudson.getComputers()) {
for (Executor e : c.getExecutors()) {
if (e.isBusy())
building.add(e.getCurrentExecutable());
}
}
throw new AssertionError(String.format("Hudson is still doing something after %dms: queue=%s building=%s",
timeout, Arrays.asList(hudson.getQueue().getItems()), building));
}
}
}
代码示例来源:origin: org.eclipse.hudson/hudson-test-framework
for (Computer c : hudson.getComputers()) {
for (Executor e : c.getExecutors()) {
if (e.isBusy()) {
building.add(e.getCurrentExecutable());
代码示例来源:origin: jenkinsci/jenkins-test-harness
/**
* Waits until Jenkins finishes building everything, including those builds in the queue, or fail the test
* if the specified timeout milliseconds is exceeded.
*/
protected void waitUntilNoActivityUpTo(int timeout) throws Exception {
long startTime = System.currentTimeMillis();
int streak = 0;
while (true) {
Thread.sleep(100);
if (isSomethingHappening())
streak=0;
else
streak++;
if (streak>2) // the system is quiet for a while
return;
if (System.currentTimeMillis()-startTime > timeout) {
List<Executable> building = new ArrayList<Executable>();
for (Computer c : jenkins.getComputers()) {
for (Executor e : c.getExecutors()) {
if (e.isBusy())
building.add(e.getCurrentExecutable());
}
}
throw new AssertionError(String.format("Jenkins is still doing something after %dms: queue=%s building=%s",
timeout, Arrays.asList(jenkins.getQueue().getItems()), building));
}
}
}
代码示例来源:origin: jenkinsci/jenkinsfile-runner
for (Computer c : jenkins.getComputers()) {
for (Executor e : c.getExecutors()) {
if (e.isBusy())
building.add(e.getCurrentExecutable());
if (e.isBusy())
building.add(e.getCurrentExecutable());
代码示例来源:origin: jenkinsci/jenkins-test-harness
for (Computer c : jenkins.getComputers()) {
for (Executor e : c.getExecutors()) {
if (e.isBusy())
building.add(e.getCurrentExecutable());
if (e.isBusy())
building.add(e.getCurrentExecutable());
代码示例来源:origin: io.jenkins.jenkinsfile-runner/setup
for (Computer c : jenkins.getComputers()) {
for (Executor e : c.getExecutors()) {
if (e.isBusy())
building.add(e.getCurrentExecutable());
if (e.isBusy())
building.add(e.getCurrentExecutable());
代码示例来源:origin: KostyaSha/github-integration-plugin
if (isNull(executor) || !executor.isBusy() || nonNull(executor.getCauseOfDeath()) ||
!getInterruptCauses(executor).isEmpty() || getInterruptStatus(executor) == Result.ABORTED) {
continue;
代码示例来源:origin: jenkinsci/cloudbees-folder-plugin
for (Computer c : r.jenkins.getComputers()) {
for (Executor e : c.getExecutors()) {
if (e.isBusy()) {
if (e.getCauseOfDeath() == null) {
building.add(e.getCurrentExecutable());
if (e.isBusy()) {
if (e.getCauseOfDeath() == null) {
building.add(e.getCurrentExecutable());
代码示例来源:origin: jenkinsci/workflow-cps-plugin
private static void assertNoTasksRunning(Jenkins j) {
j.getQueue().maintain();
assert j.getQueue().isEmpty();
Computer[] computerList = j.getComputers();
for (Computer c : computerList) {
List<Executor> executors = c.getExecutors();
for (Executor ex : executors) {
if (ex.isBusy()) {
Assert.fail("Computer "+c+" has an Executor "+ex+" still running a task: "+ex.getCurrentWorkUnit());
}
}
}
}
代码示例来源:origin: jenkinsci/cloudbees-folder-plugin
/**
* Returns true if Hudson is building something or going to build something.
*/
public boolean isSomethingHappeningIgnoringThreadDeath() {
if (!r.jenkins.getQueue().isEmpty()) {
return true;
}
for (Computer n : r.jenkins.getComputers()) {
for (OneOffExecutor e : n.getOneOffExecutors()) {
if (e.getCauseOfDeath() == null && e.isBusy()) {
return true;
}
}
for (Executor e : n.getExecutors()) {
if (e.getCauseOfDeath() == null && e.isBusy()) {
return true;
}
}
}
return false;
}
代码示例来源:origin: jenkinsci/workflow-cps-plugin
/**
* Verify that we kill endlessly recursive NonCPS code cleanly and don't leave remnants.
* This is a bit of extra caution to go along with {@link #endlessRecursion()} to ensure
* we don't trigger other forms of failure with the StackOverflowError.
*/
@Test
@Ignore /** Intermittent failures because triggers a longstanding unrelated SandboxResolvingClassloader bug
resolved in https://github.com/jenkinsci/script-security-plugin/pull/160 */
public void endlessRecursionNonCPS() throws Exception {
Assume.assumeTrue(!Functions.isWindows()); // Sidestep false failures specific to a few Windows build environments.
String script = "@NonCPS def getThing(){return thing == null}; \n" +
"node { echo getThing(); } ";
WorkflowJob job = jenkins.jenkins.createProject(WorkflowJob.class, "recursion");
job.setDefinition(new CpsFlowDefinition(script, true));
// Should have failed with error about excessive recursion depth
WorkflowRun r = jenkins.assertBuildStatus(Result.FAILURE, job.scheduleBuild2(0).get());
Assert.assertTrue("No queued FlyWeightTask for job should remain after failure", jenkins.jenkins.getQueue().isEmpty());
for (Computer c : jenkins.jenkins.getComputers()) {
for (Executor ex : c.getExecutors()) {
if (ex.isBusy()) {
fail(ex.getCurrentExecutable().toString());
}
}
}
}
代码示例来源:origin: jenkinsci/workflow-cps-plugin
/**
* Verify that we kill endlessly recursive CPS code cleanly.
*/
@Test
@Ignore /** Intermittent failures because triggers a longstanding unrelated SandboxResolvingClassloader bug
resolved in https://github.com/jenkinsci/script-security-plugin/pull/160 */
public void endlessRecursion() throws Exception {
Assume.assumeTrue(!Functions.isWindows()); // Sidestep false failures specific to a few Windows build environments.
String script = "def getThing(){return thing == null}; \n" +
"node { echo getThing(); } ";
WorkflowJob job = jenkins.jenkins.createProject(WorkflowJob.class, "recursion");
job.setDefinition(new CpsFlowDefinition(script, true));
// Should have failed with error about excessive recursion depth
WorkflowRun r = jenkins.assertBuildStatus(Result.FAILURE, job.scheduleBuild2(0).get());
jenkins.assertLogContains("look for unbounded recursion", r);
Assert.assertTrue("No queued FlyWeightTask for job should remain after failure", jenkins.jenkins.getQueue().isEmpty());
for (Computer c : jenkins.jenkins.getComputers()) {
for (Executor ex : c.getExecutors()) {
if (ex.isBusy()) {
fail(ex.getCurrentExecutable().toString());
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!