hudson.model.Node.getSelfLabel()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(179)

本文整理了Java中hudson.model.Node.getSelfLabel()方法的一些代码示例,展示了Node.getSelfLabel()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getSelfLabel()方法的具体详情如下:
包路径:hudson.model.Node
类名称:Node
方法名:getSelfLabel

Node.getSelfLabel介绍

[英]Gets the special label that represents this node itself.
[中]获取表示此节点本身的特殊标签。

代码示例

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Returns true if this label is a "self label",
  3. * which means the label is the name of a {@link Node}.
  4. */
  5. public boolean isSelfLabel() {
  6. Set<Node> nodes = getNodes();
  7. return nodes.size() == 1 && nodes.iterator().next().getSelfLabel() == this;
  8. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Assigns this job to the given node. A convenience method over {@link #setAssignedLabel(Label)}.
  3. */
  4. public void setAssignedNode(Node l) throws IOException {
  5. setAssignedLabel(l.getSelfLabel());
  6. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Returns projects that are tied on this node.
  3. */
  4. public List<AbstractProject> getTiedJobs() {
  5. Node node = getNode();
  6. return (node != null) ? node.getSelfLabel().getTiedJobs() : Collections.EMPTY_LIST;
  7. }

代码示例来源:origin: jenkinsci/jenkins

  1. /**
  2. * Returns the possibly empty set of labels that are assigned to this node,
  3. * including the automatic {@link #getSelfLabel() self label}, manually
  4. * assigned labels and dynamically assigned labels via the
  5. * {@link LabelFinder} extension point.
  6. *
  7. * This method has a side effect of updating the hudson-wide set of labels
  8. * and should be called after events that will change that - e.g. a agent
  9. * connecting.
  10. */
  11. @Exported
  12. public Set<LabelAtom> getAssignedLabels() {
  13. Set<LabelAtom> r = Label.parse(getLabelString());
  14. r.add(getSelfLabel());
  15. r.addAll(getDynamicLabels());
  16. return Collections.unmodifiableSet(r);
  17. }

代码示例来源:origin: jenkinsci/jenkins

  1. private PollingResult pollWithWorkspace(TaskListener listener, SCM scm, R lb, @Nonnull FilePath ws, WorkspaceList l) throws InterruptedException, IOException {
  2. // if doing non-concurrent build, acquire a workspace in a way that causes builds to block for this workspace.
  3. // this prevents multiple workspaces of the same job --- the behavior of Hudson < 1.319.
  4. //
  5. // OTOH, if a concurrent build is chosen, the user is willing to create a multiple workspace,
  6. // so better throughput is achieved over time (modulo the initial cost of creating that many workspaces)
  7. // by having multiple workspaces
  8. Node node = lb.getBuiltOn();
  9. Launcher launcher = ws.createLauncher(listener).decorateByEnv(getEnvironment(node,listener));
  10. WorkspaceList.Lease lease = l.acquire(ws, !concurrentBuild);
  11. try {
  12. String nodeName = node != null ? node.getSelfLabel().getName() : "[node_unavailable]";
  13. listener.getLogger().println("Polling SCM changes on " + nodeName);
  14. LOGGER.fine("Polling SCM changes of " + getName());
  15. if (pollingBaseline==null) // see NOTE-NO-BASELINE above
  16. calcPollingBaseline(lb,launcher,listener);
  17. PollingResult r = scm.poll(this, launcher, ws, listener, pollingBaseline);
  18. pollingBaseline = r.remote;
  19. return r;
  20. } finally {
  21. lease.release();
  22. }
  23. }

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

  1. /**
  2. * Assigns this job to the given node. A convenience method over {@link #setAssignedLabel(Label)}.
  3. */
  4. public void setAssignedNode(Node l) throws IOException {
  5. setAssignedLabel(l.getSelfLabel());
  6. }

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

  1. /**
  2. * Assigns this job to the given node. A convenience method over {@link #setAssignedLabel(Label)}.
  3. *
  4. * @param node node.
  5. * @throws java.io.IOException exception
  6. */
  7. public void setAssignedNode(Node node) throws IOException {
  8. setAssignedLabel(node.getSelfLabel());
  9. }

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

  1. /**
  2. * Returns true if this label is a "self label",
  3. * which means the label is the name of a {@link Node}.
  4. */
  5. public boolean isSelfLabel() {
  6. Set<Node> nodes = getNodes();
  7. return nodes.size() == 1 && nodes.iterator().next().getSelfLabel() == this;
  8. }

代码示例来源:origin: org.eclipse.hudson/hudson-core

  1. /**
  2. * Returns true if this label is a "self label", which means the label is
  3. * the name of a {@link Node}.
  4. */
  5. public boolean isSelfLabel() {
  6. Set<Node> nodes = getNodes();
  7. return nodes.size() == 1 && nodes.iterator().next().getSelfLabel() == this;
  8. }

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

  1. /**
  2. * Assigns this job to the given node. A convenience method over {@link #setAssignedLabel(Label)}.
  3. *
  4. * @param node node.
  5. * @throws java.io.IOException exception
  6. */
  7. public void setAssignedNode(Node node) throws IOException {
  8. setAssignedLabel(node.getSelfLabel());
  9. }

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

  1. /**
  2. * Returns true if this label is a "self label",
  3. * which means the label is the name of a {@link Node}.
  4. */
  5. public boolean isSelfLabel() {
  6. Set<Node> nodes = getNodes();
  7. return nodes.size() == 1 && nodes.iterator().next().getSelfLabel() == this;
  8. }

代码示例来源:origin: org.eclipse.hudson/hudson-core

  1. /**
  2. * Assigns this job to the given node. A convenience method over
  3. * {@link #setAssignedLabel(Label)}.
  4. *
  5. * @param node node.
  6. * @throws java.io.IOException exception
  7. */
  8. public void setAssignedNode(Node node) throws IOException {
  9. setAssignedLabel(node.getSelfLabel());
  10. }

代码示例来源:origin: org.jenkins-ci.plugins/nodelabelparameter

  1. private List<String> getNodeNamesForLabelExpression(String labelExp) {
  2. List<String> nodeNames = new ArrayList<String>();
  3. try {
  4. Label label = LabelExpression.parseExpression(labelExp);
  5. for (Node node : label.getNodes()) {
  6. nodeNames.add(node.getSelfLabel().getName());
  7. }
  8. } catch (ANTLRException e) {
  9. LOGGER.log(Level.SEVERE, "failed to parse label [" + labelExp + "]", e);
  10. }
  11. return nodeNames;
  12. }

代码示例来源:origin: org.jvnet.hudson.main/maven-plugin

  1. /**
  2. * {@link MavenModule} uses the workspace of the {@link MavenModuleSet},
  3. * so it always needs to be built on the same slave as the parent.
  4. */
  5. @Override
  6. public Label getAssignedLabel() {
  7. Node n = getParent().getLastBuiltOn();
  8. if(n==null) return null;
  9. return n.getSelfLabel();
  10. }

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

  1. /**
  2. * Returns projects that are tied on this node.
  3. */
  4. public List<AbstractProject> getTiedJobs() {
  5. Node node = getNode();
  6. return (node != null) ? node.getSelfLabel().getTiedJobs() : Collections.EMPTY_LIST;
  7. }

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

  1. /**
  2. * Returns projects that are tied on this node.
  3. */
  4. public List<AbstractProject> getTiedJobs() {
  5. return getNode().getSelfLabel().getTiedJobs();
  6. }

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

  1. /**
  2. * Returns projects that are tied on this node.
  3. */
  4. public List<AbstractProject> getTiedJobs() {
  5. return getNode().getSelfLabel().getTiedJobs();
  6. }

代码示例来源:origin: jenkinsci/maven-plugin

  1. /**
  2. * {@link MavenModule} uses the workspace of the {@link MavenModuleSet},
  3. * so it always needs to be built on the same slave as the parent.
  4. */
  5. @Override
  6. public Label getAssignedLabel() {
  7. Node n = getParent().getLastBuiltOn();
  8. if(n==null) return null;
  9. return n.getSelfLabel();
  10. }

代码示例来源:origin: org.jenkins-ci.plugins/ivy

  1. /**
  2. * {@link IvyModule} uses the workspace of the {@link IvyModuleSet}, so it
  3. * always needs to be built on the same slave as the parent.
  4. */
  5. @Override
  6. public Label getAssignedLabel() {
  7. Node n = getParent().getLastBuiltOn();
  8. if (n == null)
  9. return null;
  10. return n.getSelfLabel();
  11. }

代码示例来源:origin: org.eclipse.hudson/hudson-core

  1. /**
  2. * Returns projects that are tied on this node.
  3. */
  4. public List<AbstractProject> getTiedJobs() {
  5. return getNode().getSelfLabel().getTiedJobs();
  6. }

相关文章