本文整理了Java中hudson.model.Label.contains()
方法的一些代码示例,展示了Label.contains()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Label.contains()
方法的具体详情如下:
包路径:hudson.model.Label
类名称:Label
方法名:contains
暂无
代码示例来源:origin: jenkinsci/jenkins
private boolean isRelevant(Collection<Label> labels, Computer computer) {
Node node = computer.getNode();
if (node == null) return false;
if (labels.contains(null) && node.getMode() == Node.Mode.NORMAL) return true;
for (Label l : labels)
if (l != null && l.contains(node))
return true;
return false;
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Checks whether this installer can be applied to a given node.
* (By default, just checks the label.)
*/
public boolean appliesTo(Node node) {
Label l = Jenkins.getInstance().getLabel(label);
return l == null || l.contains(node);
}
代码示例来源:origin: jenkinsci/jenkins
/**
* Is this executor chunk and the given work chunk compatible? Can the latter be run on the former?
*/
public boolean canAccept(WorkChunk c) {
if (this.size()<c.size())
return false; // too small compared towork
if (c.assignedLabel!=null && !c.assignedLabel.contains(node))
return false; // label mismatch
if (!(Node.SKIP_BUILD_CHECK_ON_FLYWEIGHTS && item.task instanceof Queue.FlyweightTask) && !nodeAcl.hasPermission(item.authenticate(), Computer.BUILD))
return false; // tasks don't have a permission to run on this node
return true;
}
代码示例来源:origin: jenkinsci/jenkins
continue;
if (lbl!=null && !lbl.contains(n)) {
continue;
代码示例来源:origin: jenkinsci/jenkins
if(l!=null && !l.contains(this))
return CauseOfBlockage.fromMessage(Messages._Node_LabelMissing(getDisplayName(), l)); // the task needs to be executed on label that this node doesn't have.
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
private boolean isRelevant(Collection<Label> labels, Computer computer) {
Node node = computer.getNode();
if (node == null) return false;
if (labels.contains(null) && node.getMode() == Node.Mode.NORMAL) return true;
for (Label l : labels)
if (l != null && l.contains(node))
return true;
return false;
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
/**
* Is this executor chunk and the given work chunk compatible? Can the latter be run on the former?
*/
public boolean canAccept(WorkChunk c) {
return this.size() >= c.size()
&& (c.assignedLabel==null || c.assignedLabel.contains(node));
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
* Checks whether this installer can be applied to a given node.
* (By default, just checks the label.)
*/
public boolean appliesTo(Node node) {
Label l = Hudson.getInstance().getLabel(label);
return l == null || l.contains(node);
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
/**
* Checks whether this installer can be applied to a given node. (By
* default, just checks the label.)
*/
public boolean appliesTo(Node node) {
Label l = Hudson.getInstance().getLabel(label);
return l == null || l.contains(node);
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
/**
* Is this executor chunk and the given work chunk compatible? Can the
* latter be run on the former?
*/
public boolean canAccept(WorkChunk c) {
return this.size() >= c.size()
&& (c.assignedLabel == null || c.assignedLabel.contains(node));
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Checks whether this installer can be applied to a given node.
* (By default, just checks the label.)
*/
public boolean appliesTo(Node node) {
Label l = Jenkins.getInstance().getLabel(label);
return l == null || l.contains(node);
}
代码示例来源:origin: hudson/hudson-2.x
/**
* Is this executor chunk and the given work chunk compatible? Can the latter be run on the former?
*/
public boolean canAccept(WorkChunk c) {
return this.size() >= c.size()
&& (c.assignedLabel==null || c.assignedLabel.contains(node));
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
* Is this executor chunk and the given work chunk compatible? Can the latter be run on the former?
*/
public boolean canAccept(WorkChunk c) {
return this.size() >= c.size()
&& (c.assignedLabel==null || c.assignedLabel.contains(node));
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
/**
* Checks whether this installer can be applied to a given node.
* (By default, just checks the label.)
*/
public boolean appliesTo(Node node) {
Label l = Hudson.getInstance().getLabel(label);
return l == null || l.contains(node);
}
代码示例来源:origin: hudson/hudson-2.x
/**
* Checks whether this installer can be applied to a given node.
* (By default, just checks the label.)
*/
public boolean appliesTo(Node node) {
Label l = Hudson.getInstance().getLabel(label);
return l == null || l.contains(node);
}
代码示例来源:origin: org.jenkins-ci.main/jenkins-core
/**
* Is this executor chunk and the given work chunk compatible? Can the latter be run on the former?
*/
public boolean canAccept(WorkChunk c) {
if (this.size()<c.size())
return false; // too small compared towork
if (c.assignedLabel!=null && !c.assignedLabel.contains(node))
return false; // label mismatch
if (!nodeAcl.hasPermission(item.authenticate(), Computer.BUILD))
return false; // tasks don't have a permission to run on this node
return true;
}
代码示例来源:origin: org.eclipse.hudson/hudson-core
public CauseOfBlockage canTake(Queue.BuildableItem item) {
Label l = item.getAssignedLabel();
if(l!=null && !l.contains(this))
return CauseOfBlockage.fromMessage(Messages._Node_LabelMissing(getNodeName(),l)); // the task needs to be executed on label that this node doesn't have.
if(l==null && getMode()== Mode.EXCLUSIVE)
return CauseOfBlockage.fromMessage(Messages._Node_BecauseNodeIsReserved(getNodeName())); // this node is reserved for tasks that are tied to it
// Check each NodeProperty to see whether they object to this node
// taking the task
for (NodeProperty prop: getNodeProperties()) {
CauseOfBlockage c = prop.canTake(item);
if (c!=null) return c;
}
// Looks like we can take the task
return null;
}
代码示例来源:origin: org.jvnet.hudson.main/hudson-core
/**
* Called by the {@link Queue} to determine whether or not this node can
* take the given task. The default checks include whether or not this node
* is part of the task's assigned label, whether this node is in
* {@link Mode#EXCLUSIVE} mode if it is not in the task's assigned label,
* and whether or not any of this node's {@link NodeProperty}s say that the
* task cannot be run.
*
* @since 1.360
*/
public CauseOfBlockage canTake(Task task) {
Label l = task.getAssignedLabel();
if(l!=null && !l.contains(this))
return CauseOfBlockage.fromMessage(Messages._Node_LabelMissing(getNodeName(),l)); // the task needs to be executed on label that this node doesn't have.
if(l==null && getMode()== Mode.EXCLUSIVE)
return CauseOfBlockage.fromMessage(Messages._Node_BecauseNodeIsReserved(getNodeName())); // this node is reserved for tasks that are tied to it
// Check each NodeProperty to see whether they object to this node
// taking the task
for (NodeProperty prop: getNodeProperties()) {
CauseOfBlockage c = prop.canTake(task);
if (c!=null) return c;
}
// Looks like we can take the task
return null;
}
代码示例来源:origin: org.eclipse.hudson.main/hudson-core
private void makeBuildable(BuildableItem p) {
if(Hudson.FLYWEIGHT_SUPPORT && p.task instanceof FlyweightTask && !ifBlockedByHudsonShutdown(p.task)) {
ConsistentHash<Node> hash = new ConsistentHash<Node>(new Hash<Node>() {
public String hash(Node node) {
return node.getNodeName();
}
});
Hudson h = Hudson.getInstance();
hash.add(h, h.getNumExecutors()*100);
for (Node n : h.getNodes())
hash.add(n,n.getNumExecutors()*100);
Label lbl = p.task.getAssignedLabel();
for (Node n : hash.list(p.task.getFullDisplayName())) {
Computer c = n.toComputer();
if (c==null || c.isOffline()) continue;
if (lbl!=null && !lbl.contains(n)) continue;
c.startFlyWeightTask(new WorkUnitContext(p).createWorkUnit(p.task));
pendings.add(p);
return;
}
// if the execution get here, it means we couldn't schedule it anywhere.
// so do the scheduling like other normal jobs.
}
buildables.put(p.task,p);
}
代码示例来源:origin: hudson/hudson-2.x
private void makeBuildable(BuildableItem p) {
if(Hudson.FLYWEIGHT_SUPPORT && p.task instanceof FlyweightTask && !ifBlockedByHudsonShutdown(p.task)) {
ConsistentHash<Node> hash = new ConsistentHash<Node>(new Hash<Node>() {
public String hash(Node node) {
return node.getNodeName();
}
});
Hudson h = Hudson.getInstance();
hash.add(h, h.getNumExecutors()*100);
for (Node n : h.getNodes())
hash.add(n,n.getNumExecutors()*100);
Label lbl = p.task.getAssignedLabel();
for (Node n : hash.list(p.task.getFullDisplayName())) {
Computer c = n.toComputer();
if (c==null || c.isOffline()) continue;
if (lbl!=null && !lbl.contains(n)) continue;
c.startFlyWeightTask(new WorkUnitContext(p).createWorkUnit(p.task));
pendings.add(p);
return;
}
// if the execution get here, it means we couldn't schedule it anywhere.
// so do the scheduling like other normal jobs.
}
buildables.put(p.task,p);
}
内容来源于网络,如有侵权,请联系作者删除!