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; }
/** * 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); }
/** * 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; }
continue; if (lbl!=null && !lbl.contains(n)) { continue;
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.
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; }
/** * 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)); }
/** * 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); }
/** * 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); }
/** * 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)); }
/** * 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); }
/** * 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)); }
/** * 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)); }
/** * 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); }
/** * 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); }
/** * 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; }
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; }
/** * 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; }
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); }
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); }