/** * Gets the current channel, if the node is connected and online, or null. * * This is just a convenience method for {@link Computer#getChannel()} with null check. */ @CheckForNull public final VirtualChannel getChannel() { Computer c = toComputer(); return c==null ? null : c.getChannel(); }
@Override protected int run() throws Exception { node.toComputer().waitUntilOnline(); return 0; } }
@Override protected int run() throws Exception { node.toComputer().waitUntilOffline(); return 0; } }
@Override protected int run() throws IOException, ServletException { node.toComputer().updateByXml(stdin); return 0; } }
public Builder with(@CheckForNull Node node) { if (node != null) { return with(node.toComputer()); } return this; }
public String getShortDescription() { String name = (node.toComputer() != null) ? node.toComputer().getDisplayName() : node.getDisplayName(); return Messages.Queue_NodeOffline(name); }
public String getShortDescription() { String name = (node.toComputer() != null) ? node.toComputer().getDisplayName() : node.getDisplayName(); return Messages.Queue_WaitingForNextAvailableExecutorOn(name); }
node.toComputer().doDoDelete(); } catch (Exception e) { if(hs.size() == 1) {
@Override public String getShortDescription() { Computer computer = node.toComputer(); String name = computer != null ? computer.getDisplayName() : node.getDisplayName(); return Messages.Node_BecauseNodeIsNotAcceptingTasks(name); }
public String getSearchUrl() { Computer c = toComputer(); if (c != null) { return c.getUrl(); } return "computer/" + Util.rawEncode(getNodeName()); }
/** * Returns true if all the nodes of this label is offline. */ @Exported public boolean isOffline() { for (Node n : getNodes()) { Computer c = n.toComputer(); if(c != null && !c.isOffline()) return false; } return true; }
/** * 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; }
/** * 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 void run() { Computer c = node.toComputer(); if (c != null) { c.recordTermination(); c.disconnect(OfflineCause.create(hudson.model.Messages._Hudson_NodeBeingRemoved())); } if (node == nodes.remove(node.getNodeName())) { jenkins.updateComputerList(); jenkins.trimLabels(); } } });
/** * 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; }
private WorkspaceOfflineReason workspaceOffline(R build) throws IOException, InterruptedException { FilePath ws = build.getWorkspace(); Label label = getAssignedLabel(); if (isAllSuitableNodesOffline(build)) { Collection<Cloud> applicableClouds = label == null ? Jenkins.getInstance().clouds : label.getClouds(); return applicableClouds.isEmpty() ? WorkspaceOfflineReason.all_suitable_nodes_are_offline : WorkspaceOfflineReason.use_ondemand_slave; } if (ws==null || !ws.exists()) { return WorkspaceOfflineReason.nonexisting_workspace; } Node builtOn = build.getBuiltOn(); if (builtOn == null) { // node built-on doesn't exist anymore return WorkspaceOfflineReason.builton_node_gone; } if (builtOn.toComputer() == null) { // node still exists, but has 0 executors - o.s.l.t. return WorkspaceOfflineReason.builton_node_no_executors; } return null; }
public static String encodeTo(Node node) { Computer c = node.toComputer(); if (c != null) { return encodeTo("/" + c.getUrl(), node.getDisplayName()); } String nodePath = node == Jenkins.getInstance() ? "(master)" : node.getNodeName(); return encodeTo("/computer/" + nodePath, node.getDisplayName()); }
final Computer computer = node.toComputer(); if (computer != null) {
/** * Adds a node * * @since 1.513 */ public ContextMenu add(Node n) { Computer c = n.toComputer(); return add(new MenuItem() .withDisplayName(n.getDisplayName()) .withStockIcon((c==null) ? "computer.png" : c.getIcon()) .withContextRelativeUrl(n.getSearchUrl())); }
if(canRoam) { for (Node n : Jenkins.getInstance().getNodes()) { Computer c = n.toComputer(); if (c != null && c.isOnline() && c.isAcceptingTasks() && n.getMode() == Mode.NORMAL) {