/** * Returns true if this label is a "self label", * which means the label is the name of a {@link Node}. */ public boolean isSelfLabel() { Set<Node> nodes = getNodes(); return nodes.size() == 1 && nodes.iterator().next().getSelfLabel() == this; }
/** * Assigns this job to the given node. A convenience method over {@link #setAssignedLabel(Label)}. */ public void setAssignedNode(Node l) throws IOException { setAssignedLabel(l.getSelfLabel()); }
/** * Returns projects that are tied on this node. */ public List<AbstractProject> getTiedJobs() { Node node = getNode(); return (node != null) ? node.getSelfLabel().getTiedJobs() : Collections.EMPTY_LIST; }
/** * Returns the possibly empty set of labels that are assigned to this node, * including the automatic {@link #getSelfLabel() self label}, manually * assigned labels and dynamically assigned labels via the * {@link LabelFinder} extension point. * * This method has a side effect of updating the hudson-wide set of labels * and should be called after events that will change that - e.g. a agent * connecting. */ @Exported public Set<LabelAtom> getAssignedLabels() { Set<LabelAtom> r = Label.parse(getLabelString()); r.add(getSelfLabel()); r.addAll(getDynamicLabels()); return Collections.unmodifiableSet(r); }
private PollingResult pollWithWorkspace(TaskListener listener, SCM scm, R lb, @Nonnull FilePath ws, WorkspaceList l) throws InterruptedException, IOException { // if doing non-concurrent build, acquire a workspace in a way that causes builds to block for this workspace. // this prevents multiple workspaces of the same job --- the behavior of Hudson < 1.319. // // OTOH, if a concurrent build is chosen, the user is willing to create a multiple workspace, // so better throughput is achieved over time (modulo the initial cost of creating that many workspaces) // by having multiple workspaces Node node = lb.getBuiltOn(); Launcher launcher = ws.createLauncher(listener).decorateByEnv(getEnvironment(node,listener)); WorkspaceList.Lease lease = l.acquire(ws, !concurrentBuild); try { String nodeName = node != null ? node.getSelfLabel().getName() : "[node_unavailable]"; listener.getLogger().println("Polling SCM changes on " + nodeName); LOGGER.fine("Polling SCM changes of " + getName()); if (pollingBaseline==null) // see NOTE-NO-BASELINE above calcPollingBaseline(lb,launcher,listener); PollingResult r = scm.poll(this, launcher, ws, listener, pollingBaseline); pollingBaseline = r.remote; return r; } finally { lease.release(); } }
/** * Assigns this job to the given node. A convenience method over {@link #setAssignedLabel(Label)}. */ public void setAssignedNode(Node l) throws IOException { setAssignedLabel(l.getSelfLabel()); }
/** * Assigns this job to the given node. A convenience method over {@link #setAssignedLabel(Label)}. * * @param node node. * @throws java.io.IOException exception */ public void setAssignedNode(Node node) throws IOException { setAssignedLabel(node.getSelfLabel()); }
/** * Returns true if this label is a "self label", * which means the label is the name of a {@link Node}. */ public boolean isSelfLabel() { Set<Node> nodes = getNodes(); return nodes.size() == 1 && nodes.iterator().next().getSelfLabel() == this; }
/** * Returns true if this label is a "self label", which means the label is * the name of a {@link Node}. */ public boolean isSelfLabel() { Set<Node> nodes = getNodes(); return nodes.size() == 1 && nodes.iterator().next().getSelfLabel() == this; }
/** * Assigns this job to the given node. A convenience method over {@link #setAssignedLabel(Label)}. * * @param node node. * @throws java.io.IOException exception */ public void setAssignedNode(Node node) throws IOException { setAssignedLabel(node.getSelfLabel()); }
/** * Returns true if this label is a "self label", * which means the label is the name of a {@link Node}. */ public boolean isSelfLabel() { Set<Node> nodes = getNodes(); return nodes.size() == 1 && nodes.iterator().next().getSelfLabel() == this; }
/** * Assigns this job to the given node. A convenience method over * {@link #setAssignedLabel(Label)}. * * @param node node. * @throws java.io.IOException exception */ public void setAssignedNode(Node node) throws IOException { setAssignedLabel(node.getSelfLabel()); }
private List<String> getNodeNamesForLabelExpression(String labelExp) { List<String> nodeNames = new ArrayList<String>(); try { Label label = LabelExpression.parseExpression(labelExp); for (Node node : label.getNodes()) { nodeNames.add(node.getSelfLabel().getName()); } } catch (ANTLRException e) { LOGGER.log(Level.SEVERE, "failed to parse label [" + labelExp + "]", e); } return nodeNames; }
/** * {@link MavenModule} uses the workspace of the {@link MavenModuleSet}, * so it always needs to be built on the same slave as the parent. */ @Override public Label getAssignedLabel() { Node n = getParent().getLastBuiltOn(); if(n==null) return null; return n.getSelfLabel(); }
/** * Returns projects that are tied on this node. */ public List<AbstractProject> getTiedJobs() { Node node = getNode(); return (node != null) ? node.getSelfLabel().getTiedJobs() : Collections.EMPTY_LIST; }
/** * Returns projects that are tied on this node. */ public List<AbstractProject> getTiedJobs() { return getNode().getSelfLabel().getTiedJobs(); }
/** * Returns projects that are tied on this node. */ public List<AbstractProject> getTiedJobs() { return getNode().getSelfLabel().getTiedJobs(); }
/** * {@link MavenModule} uses the workspace of the {@link MavenModuleSet}, * so it always needs to be built on the same slave as the parent. */ @Override public Label getAssignedLabel() { Node n = getParent().getLastBuiltOn(); if(n==null) return null; return n.getSelfLabel(); }
/** * {@link IvyModule} uses the workspace of the {@link IvyModuleSet}, so it * always needs to be built on the same slave as the parent. */ @Override public Label getAssignedLabel() { Node n = getParent().getLastBuiltOn(); if (n == null) return null; return n.getSelfLabel(); }
/** * Returns projects that are tied on this node. */ public List<AbstractProject> getTiedJobs() { return getNode().getSelfLabel().getTiedJobs(); }