本文整理了Java中jenkins.model.Jenkins.setNumExecutors()
方法的一些代码示例,展示了Jenkins.setNumExecutors()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Jenkins.setNumExecutors()
方法的具体详情如下:
包路径:jenkins.model.Jenkins
类名称:Jenkins
方法名:setNumExecutors
[英]Sets a number of executors.
[中]
代码示例来源:origin: jenkinsci/jenkins
@Override
public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
Jenkins j = Jenkins.get();
try {
// for compatibility reasons, this value is stored in Jenkins
String num = json.getString("numExecutors");
if (!num.matches("\\d+")) {
throw new FormException(Messages.Hudson_Computer_IncorrectNumberOfExecutors(),"numExecutors");
}
j.setNumExecutors(json.getInt("numExecutors"));
if (req.hasParameter("master.mode"))
j.setMode(Mode.valueOf(req.getParameter("master.mode")));
else
j.setMode(Mode.NORMAL);
j.setLabelString(json.optString("labelString", ""));
return true;
} catch (IOException e) {
throw new FormException(e,"numExecutors");
}
}
}
代码示例来源:origin: jenkinsci/kubernetes-ci-plugin
jenkins.setNumExecutors(0);
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
@Override
public boolean configure(StaplerRequest req, JSONObject json) throws FormException {
Jenkins j = Jenkins.getInstance();
try {
// for compatibility reasons, this value is stored in Jenkins
j.setNumExecutors(json.getInt("numExecutors"));
if (req.hasParameter("master.mode"))
j.setMode(Mode.valueOf(req.getParameter("master.mode")));
else
j.setMode(Mode.NORMAL);
j.setLabelString(json.optString("labelString", ""));
return true;
} catch (IOException e) {
throw new FormException(e,"numExecutors");
}
}
}
代码示例来源:origin: jenkinsci/workflow-cps-plugin
@Override public void evaluate() throws Throwable {
jenkins().setNumExecutors(0);
DumbSlave s = createSlave(story.j);
String nodeName = s.getNodeName();
p = jenkins().createProject(WorkflowJob.class, "demo");
p.setDefinition(new CpsFlowDefinition(
"def s = jenkins.model.Jenkins.instance.getComputer('" + nodeName + "')\n" +
"def r = s.node.rootPath\n" +
"def p = r.getRemote()\n" +
"semaphore 'wait'\n" +
// make sure these values are still alive
"assert s.nodeName=='" + nodeName + "'\n" +
"assert r.getRemote()==p : r.getRemote() + ' vs ' + p;\n" +
"assert r.channel==s.channel : r.channel.toString() + ' vs ' + s.channel\n", false));
startBuilding();
SemaphoreStep.waitForStart("wait/1", b);
assertTrue(b.isBuilding());
}
});
内容来源于网络,如有侵权,请联系作者删除!