/** * Blocks until the node becomes online/offline. */ public void waitUntilOnline() throws InterruptedException { synchronized (statusChangeLock) { while (!isOnline()) statusChangeLock.wait(1000); } }
/** * Utility method to mark the computer online for derived classes. * * @return true * if the node was actually taken online by this act (as opposed to us deciding not to do it, * or the computer was already online.) */ protected boolean markOnline(Computer c) { if(isIgnored() || c.isOnline()) return false; // noop c.setTemporarilyOffline(false,null); return true; }
/** * Number of busy {@link Executor}s that are carrying out some work right now. */ @Exported public int getBusyExecutors() { int r=0; for (Computer c : get_all()) { if(c.isOnline()) r += c.countBusy(); } return r; }
/** * Number of total {@link Executor}s that belong to this label that are functioning. * <p> * This excludes executors that belong to offline nodes. */ @Exported public int getTotalExecutors() { int r=0; for (Computer c : get_all()) { if(c.isOnline()) r += c.countExecutors(); } return r; }
/** * {@code getTotalExecutors()-getBusyExecutors()}, plus executors that are being brought online. */ public int getIdleExecutors() { int r=0; for (Computer c : get_all()) if((c.isOnline() || c.isConnecting()) && c.isAcceptingTasks()) r += c.countIdle(); return r; }
/** * Number of busy {@link Executor}s that are carrying out some work right now. */ @Exported public int getBusyExecutors() { int r=0; for (Node n : getNodes()) { Computer c = n.toComputer(); if(c!=null && c.isOnline()) r += c.countBusy(); } return r; }
@Override public boolean isReadyToRestart() throws IOException, InterruptedException { for (Computer c : Jenkins.getInstance().getComputers()) { if (c.isOnline()) { for (Executor e : c.getAllExecutors()) { if (blocksRestart(e)) { return false; } } } } return true; } private static boolean blocksRestart(Executor e) {
/** * Number of total {@link Executor}s that belong to this label that are functioning. * <p> * This excludes executors that belong to offline nodes. */ @Exported public int getTotalExecutors() { int r=0; for (Node n : getNodes()) { Computer c = n.toComputer(); if(c!=null && c.isOnline()) r += c.countExecutors(); } return r; }
@Override public int computeTotalExecutors() { int r=0; for (Computer c : Jenkins.getInstance().getComputers()) { Node node = c.getNode(); if (node != null && node.getMode() == Mode.NORMAL && c.isOnline()) { r += c.countExecutors(); } } return r; }
public Builder with(@CheckForNull Computer computer) { if (computer == null) { return this; } if (computer.isOnline()) { final List<Executor> executors = computer.getExecutors(); final boolean acceptingTasks = computer.isAcceptingTasks(); for (Executor e : executors) { definedExecutors++; onlineExecutors++; if (e.getCurrentWorkUnit() != null) { busyExecutors++; } else { idleExecutors++; if (acceptingTasks) availableExecutors++; } } } else { final int numExecutors = computer.getNumExecutors(); definedExecutors += numExecutors; if (computer.isConnecting()) { connectingExecutors += numExecutors; } } return this; }
/** * Number of idle {@link Executor}s that can start working immediately. */ @Exported public int getIdleExecutors() { int r=0; for (Node n : getNodes()) { Computer c = n.toComputer(); if(c!=null && (c.isOnline() || c.isConnecting()) && c.isAcceptingTasks()) r += c.countIdle(); } return r; }
@Override public int computeIdleExecutors() { int r=0; for (Computer c : Jenkins.getInstance().getComputers()) { Node node = c.getNode(); if (node != null && node.getMode() == Mode.NORMAL && (c.isOnline() || c.isConnecting()) && c.isAcceptingTasks()) { r += c.countIdle(); } } return r; }
final HashMap<Computer, Integer> availableComputers = new HashMap<>(); for (Computer o : Jenkins.get().getComputers()) { if ((o.isOnline() || o.isConnecting()) && o.isPartiallyIdle() && o.isAcceptingTasks()) { final int idleExecutors = o.countIdle(); if (idleExecutors>0)
@Override public void run() { if (!owner.isOnline()) { resetWorkUnit("went off-line before the task's worker thread started"); owner.removeExecutor(this);
for (Node n : Jenkins.getInstance().getNodes()) { Computer c = n.toComputer(); if (c != null && c.isOnline() && c.isAcceptingTasks() && n.getMode() == Mode.NORMAL) {
/** * Blocks until the node becomes online/offline. */ public void waitUntilOnline() throws InterruptedException { synchronized (statusChangeLock) { while (!isOnline()) statusChangeLock.wait(1000); } }
/** * Number of busy {@link Executor}s that are carrying out some work right now. */ @Exported public int getBusyExecutors() { int r=0; for (Computer c : get_all()) { if(c.isOnline()) r += c.countBusy(); } return r; }
/** * {@code getTotalExecutors()-getBusyExecutors()}, plus executors that are being brought online. */ public int getIdleExecutors() { int r=0; for (Computer c : get_all()) if((c.isOnline() || c.isConnecting()) && c.isAcceptingTasks()) r += c.countIdle(); return r; }
@Override public int computeTotalExecutors() { int r=0; for (Computer c : Jenkins.getInstance().getComputers()) { Node node = c.getNode(); if (node != null && node.getMode() == Mode.NORMAL && c.isOnline()) { r += c.countExecutors(); } } return r; }
@Override public int computeIdleExecutors() { int r=0; for (Computer c : Jenkins.getInstance().getComputers()) { Node node = c.getNode(); if (node != null && node.getMode() == Mode.NORMAL && (c.isOnline() || c.isConnecting()) && c.isAcceptingTasks()) { r += c.countIdle(); } } return r; }