本文整理了Java中hudson.model.Executor.getOwner()
方法的一些代码示例,展示了Executor.getOwner()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Executor.getOwner()
方法的具体详情如下:
包路径:hudson.model.Executor
类名称:Executor
方法名:getOwner
暂无
代码示例来源:origin: jenkinsci/jenkins
/**
* Gets the current {@link Computer} that the build is running.
* This method only works when called during a build, such as by
* {@link hudson.tasks.Publisher}, {@link hudson.tasks.BuildWrapper}, etc.
* @return the {@link Computer} associated with {@link Executor#currentExecutor}, or (consistently as of 1.591) null if not on an executor thread
*/
public static @Nullable Computer currentComputer() {
Executor e = Executor.currentExecutor();
return e != null ? e.getOwner() : null;
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Is this executor ready to accept some tasks?
*/
public boolean isAvailable() {
return workUnit == null && !executor.getOwner().isOffline() && executor.getOwner().isAcceptingTasks();
}
代码示例来源:origin: jenkinsci/jenkins
@CheckForNull
public Node getNode() {
return executor.getOwner().getNode();
}
代码示例来源:origin: jenkinsci/jenkins
@Override
public String toString() {
return String.format("JobOffer[%s #%d]",executor.getOwner().getName(), executor.getNumber());
}
}
代码示例来源:origin: jenkinsci/jenkins
private ExecutorChunk(List<ExecutorSlot> base, int index) {
super(base);
this.index = index;
assert !base.isEmpty();
computer = base.get(0).getExecutor().getOwner();
node = computer.getNode();
nodeAcl = node.getACL();
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Performs an installation.
*/
private int install(ToolInstallation t, BuildIDs id, AbstractProject p) throws IOException, InterruptedException {
Run b = p.getBuildByNumber(Integer.parseInt(id.number));
if (b==null)
throw new IllegalStateException("No such build: "+id.number);
Executor exec = b.getExecutor();
if (exec==null)
throw new IllegalStateException(b.getFullDisplayName()+" is not building");
Node node = exec.getOwner().getNode();
if (node == null) {
throw new IllegalStateException("The node " + exec.getOwner().getDisplayName() + " has been deleted");
}
t = t.translate(node, EnvVars.getRemote(checkChannel()), new StreamTaskListener(stderr));
stdout.println(t.getHome());
return 0;
}
代码示例来源:origin: jenkinsci/jenkins
Computer c = o.getExecutor().getOwner();
List<ExecutorSlot> l = j.get(c);
if (l==null)
代码示例来源:origin: jenkinsci/jenkins
@Override
protected void onCriteriaMet() {
// on behalf of the member Executors,
// the one that executes the main thing will send notifications
// Unclear if this will work with AsynchronousExecution; it *seems* this is only called from synchronize which is only called from synchronizeStart which is only called from an executor thread.
Executor e = Executor.currentExecutor();
if (e.getCurrentWorkUnit().isMainWork()) {
e.getOwner().taskAccepted(e,task);
}
}
};
代码示例来源:origin: jenkinsci/jenkins
/**
* All the {@link Executor}s that jointly execute a {@link Task} call this method to synchronize on the end of the task.
*
* @throws InterruptedException
* If any of the member thread is interrupted while waiting for other threads to join, all
* the member threads will report {@link InterruptedException}.
*/
public void synchronizeEnd(Executor e, Queue.Executable executable, Throwable problems, long duration) throws InterruptedException {
endLatch.synchronize();
// the main thread will send a notification
WorkUnit wu = e.getCurrentWorkUnit();
if (wu.isMainWork()) {
if (problems == null) {
future.set(executable);
e.getOwner().taskCompleted(e, task, duration);
} else {
future.set(problems);
e.getOwner().taskCompletedWithProblems(e, task, duration, problems);
}
}
}
代码示例来源:origin: jenkinsci/jenkins
Node node = getNode();
if (node == null) {
return CauseOfBlockage.fromMessage(Messages._Queue_node_has_been_removed_from_configuration(executor.getOwner().getDisplayName()));
return CauseOfBlockage.fromMessage(Messages._Queue_executor_slot_already_in_use());
if (executor.getOwner().isOffline()) {
return new CauseOfBlockage.BecauseNodeIsOffline(node);
if (!executor.getOwner().isAcceptingTasks()) { // Node.canTake (above) does not consider RetentionStrategy.isAcceptingTasks
return new CauseOfBlockage.BecauseNodeIsNotAcceptingTasks(node);
代码示例来源:origin: jenkinsci/jenkins
@Override
public void buildEnvironmentFor(Job j, EnvVars env, TaskListener listener) throws IOException, InterruptedException {
Jenkins jenkins = Jenkins.getInstance();
String rootUrl = jenkins.getRootUrl();
if(rootUrl!=null) {
env.put("JENKINS_URL", rootUrl);
env.put("HUDSON_URL", rootUrl); // Legacy compatibility
env.put("JOB_URL", rootUrl+j.getUrl());
}
String root = jenkins.getRootDir().getPath();
env.put("JENKINS_HOME", root);
env.put("HUDSON_HOME", root); // legacy compatibility
Thread t = Thread.currentThread();
if (t instanceof Executor) {
Executor e = (Executor) t;
env.put("EXECUTOR_NUMBER", String.valueOf(e.getNumber()));
if (e.getOwner() instanceof MasterComputer) {
env.put("NODE_NAME", "master");
} else {
env.put("NODE_NAME", e.getOwner().getName());
}
Node n = e.getOwner().getNode();
if (n != null)
env.put("NODE_LABELS", Util.join(n.getAssignedLabels(), " "));
}
}
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
* Is this executor ready to accept some tasks?
*/
public boolean isAvailable() {
return workUnit == null && !executor.getOwner().isOffline() && executor.getOwner().isAcceptingTasks();
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Gets the current {@link Computer} that the build is running.
* This method only works when called during a build, such as by
* {@link hudson.tasks.Publisher}, {@link hudson.tasks.BuildWrapper}, etc.
* @return the {@link Computer} associated with {@link Executor#currentExecutor}, or (consistently as of 1.591) null if not on an executor thread
*/
public static @Nullable Computer currentComputer() {
Executor e = Executor.currentExecutor();
return e != null ? e.getOwner() : null;
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Is this executor ready to accept some tasks?
*/
public boolean isAvailable() {
return workUnit == null && !executor.getOwner().isOffline() && executor.getOwner().isAcceptingTasks();
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
private ExecutorChunk(List<ExecutorSlot> base, int index) {
super(base);
this.index = index;
assert !base.isEmpty();
computer = base.get(0).getExecutor().getOwner();
node = computer.getNode();
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
@Override
public String toString() {
return String.format("JobOffer[%s #%d]",executor.getOwner().getName(), executor.getNumber());
}
}
代码示例来源:origin: jenkinsci/kubernetes-ci-plugin
@Override
public void taskCompletedWithProblems(Executor executor, Queue.Task task, long duration, Throwable problems) {
LOGGER.info("Task completed with problems: " + task.getName() + " in: " + duration + " ms");
terminate((AbstractCloudComputer<?>) executor.getOwner());
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
private ExecutorChunk(List<ExecutorSlot> base, int index) {
super(base);
this.index = index;
assert !base.isEmpty();
computer = base.get(0).getExecutor().getOwner();
node = computer.getNode();
nodeAcl = node.getACL();
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
/**
* Gets the current {@link Computer} that the build is running.
* This method only works when called during a build, such as by
* {@link Publisher}, {@link BuildWrapper}, etc.
*/
public static Computer currentComputer() {
Executor e = Executor.currentExecutor();
// If no executor then must be on master node
return e != null ? e.getOwner() : Hudson.getInstance().toComputer();
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
@Override
protected void onCriteriaMet() {
// on behalf of the member Executors,
// the one that executes the main thing will send notifications
// Unclear if this will work with AsynchronousExecution; it *seems* this is only called from synchronize which is only called from synchronizeStart which is only called from an executor thread.
Executor e = Executor.currentExecutor();
if (e.getCurrentWorkUnit().isMainWork()) {
e.getOwner().taskAccepted(e,task);
}
}
};
内容来源于网络,如有侵权,请联系作者删除!