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

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

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

Node.getMode介绍

[英]Returns Mode#EXCLUSIVE if this node is only available for those jobs that exclusively specifies this node as the assigned node.
[中]如果此节点仅可用于以独占方式将此节点指定为指定节点的作业,则返回模式#独占。

代码示例

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

  1. @Override
  2. protected boolean filter(Node n) {
  3. return n != null && n.getMode() == Mode.NORMAL;
  4. }

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

  1. public boolean isNotExclusive() {
  2. return getNode().getMode() == Mode.NORMAL;
  3. }

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

  1. private boolean isRelevant(Collection<Label> labels, Computer computer) {
  2. Node node = computer.getNode();
  3. if (node == null) return false;
  4. if (labels.contains(null) && node.getMode() == Node.Mode.NORMAL) return true;
  5. for (Label l : labels)
  6. if (l != null && l.contains(node))
  7. return true;
  8. return false;
  9. }

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

  1. @Override
  2. public int computeTotalExecutors() {
  3. int r=0;
  4. for (Computer c : Jenkins.getInstance().getComputers()) {
  5. Node node = c.getNode();
  6. if (node != null && node.getMode() == Mode.NORMAL && c.isOnline()) {
  7. r += c.countExecutors();
  8. }
  9. }
  10. return r;
  11. }

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

  1. @Override
  2. public int computeIdleExecutors() {
  3. int r=0;
  4. for (Computer c : Jenkins.getInstance().getComputers()) {
  5. Node node = c.getNode();
  6. if (node != null && node.getMode() == Mode.NORMAL && (c.isOnline() || c.isConnecting()) && c.isAcceptingTasks()) {
  7. r += c.countIdle();
  8. }
  9. }
  10. return r;
  11. }

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

  1. for (Node n : Jenkins.getInstance().getNodes()) {
  2. Computer c = n.toComputer();
  3. if (c != null && c.isOnline() && c.isAcceptingTasks() && n.getMode() == Mode.NORMAL) {

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

  1. return CauseOfBlockage.fromMessage(Messages._Node_LabelMissing(getDisplayName(), l)); // the task needs to be executed on label that this node doesn't have.
  2. if(l==null && getMode()== Mode.EXCLUSIVE) {

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

  1. @Override
  2. protected boolean filter(Node n) {
  3. return n != null && n.getMode() == Mode.NORMAL;
  4. }

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

  1. public boolean isNotExclusive() {
  2. return getNode().getMode() == Mode.NORMAL;
  3. }
  4. }

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

  1. public boolean isNotExclusive() {
  2. return getNode().getMode() == Mode.NORMAL;
  3. }
  4. }

代码示例来源:origin: hudson/hudson-2.x

  1. public boolean isNotExclusive() {
  2. return getNode().getMode() == Mode.NORMAL;
  3. }
  4. }

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

  1. public boolean isNotExclusive() {
  2. return getNode().getMode() == Mode.NORMAL;
  3. }
  4. }

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

  1. public boolean isNotExclusive() {
  2. return getNode().getMode() == Mode.NORMAL;
  3. }

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

  1. private boolean isRelevant(Collection<Label> labels, Computer computer) {
  2. Node node = computer.getNode();
  3. if (node == null) return false;
  4. if (labels.contains(null) && node.getMode() == Node.Mode.NORMAL) return true;
  5. for (Label l : labels)
  6. if (l != null && l.contains(node))
  7. return true;
  8. return false;
  9. }

代码示例来源:origin: hudson/hudson-2.x

  1. Node n = c.getNode();
  2. if (n != null) {
  3. if (roam && n.getMode() == Mode.NORMAL || !Collections.disjoint(n.getAssignedLabels(), labels)) {
  4. result.add(c);

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

  1. @Override
  2. public int computeTotalExecutors() {
  3. int r=0;
  4. for (Computer c : Jenkins.getInstance().getComputers()) {
  5. Node node = c.getNode();
  6. if (node != null && node.getMode() == Mode.NORMAL && c.isOnline()) {
  7. r += c.countExecutors();
  8. }
  9. }
  10. return r;
  11. }

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

  1. @Override
  2. public int computeIdleExecutors() {
  3. int r=0;
  4. for (Computer c : Jenkins.getInstance().getComputers()) {
  5. Node node = c.getNode();
  6. if (node != null && node.getMode() == Mode.NORMAL && (c.isOnline() || c.isConnecting()) && c.isAcceptingTasks()) {
  7. r += c.countIdle();
  8. }
  9. }
  10. return r;
  11. }

代码示例来源:origin: org.hudsonci.plugins/rest-plugin-api

  1. public NodeDTO convert(final hudson.model.Node source) {
  2. assert source != null;
  3. log.trace("Converting: {}", source);
  4. NodeDTO target = new NodeDTO();
  5. target.setName(source.getNodeName());
  6. target.setDescription(source.getNodeDescription());
  7. target.setExecutors(source.getNumExecutors());
  8. target.setMode(convert(source.getMode()));
  9. // target.setConnected();
  10. // target.setOnline();
  11. // target.setOfflineCause();
  12. // target.setConnectTime();
  13. return target;
  14. }

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

  1. public CauseOfBlockage canTake(Queue.BuildableItem item) {
  2. Label l = item.getAssignedLabel();
  3. if(l!=null && !l.contains(this))
  4. return CauseOfBlockage.fromMessage(Messages._Node_LabelMissing(getNodeName(),l)); // the task needs to be executed on label that this node doesn't have.
  5. if(l==null && getMode()== Mode.EXCLUSIVE)
  6. return CauseOfBlockage.fromMessage(Messages._Node_BecauseNodeIsReserved(getNodeName())); // this node is reserved for tasks that are tied to it
  7. // Check each NodeProperty to see whether they object to this node
  8. // taking the task
  9. for (NodeProperty prop: getNodeProperties()) {
  10. CauseOfBlockage c = prop.canTake(item);
  11. if (c!=null) return c;
  12. }
  13. // Looks like we can take the task
  14. return null;
  15. }

代码示例来源:origin: hudson/hudson-2.x

  1. /**
  2. * Called by the {@link Queue} to determine whether or not this node can
  3. * take the given task. The default checks include whether or not this node
  4. * is part of the task's assigned label, whether this node is in
  5. * {@link Mode#EXCLUSIVE} mode if it is not in the task's assigned label,
  6. * and whether or not any of this node's {@link NodeProperty}s say that the
  7. * task cannot be run.
  8. *
  9. * @since 1.360
  10. */
  11. public CauseOfBlockage canTake(Task task) {
  12. Label l = task.getAssignedLabel();
  13. if(l!=null && !l.contains(this))
  14. return CauseOfBlockage.fromMessage(Messages._Node_LabelMissing(getNodeName(),l)); // the task needs to be executed on label that this node doesn't have.
  15. if(l==null && getMode()== Mode.EXCLUSIVE)
  16. return CauseOfBlockage.fromMessage(Messages._Node_BecauseNodeIsReserved(getNodeName())); // this node is reserved for tasks that are tied to it
  17. // Check each NodeProperty to see whether they object to this node
  18. // taking the task
  19. for (NodeProperty prop: getNodeProperties()) {
  20. CauseOfBlockage c = prop.canTake(task);
  21. if (c!=null) return c;
  22. }
  23. // Looks like we can take the task
  24. return null;
  25. }

相关文章