Runnable r = makeBuildable(new BuildableItem(p)); if (r != null) { p.leave(this); if (causeOfBlockage == null) { Runnable r = makeBuildable(new BuildableItem(top)); String topTaskDisplayName = LOGGER.isLoggable(Level.FINEST) ? top.task.getFullDisplayName() : null; if (r != null) { p.leave(this); new BlockedItem(p, causeOfBlockage).enter(this); LOGGER.log(Level.FINE, "Catching that {0} is blocked in the last minute", p); Runnable r = makeFlyWeightTaskBuildable(new BuildableItem(p)); if (r != null) { p.leave(this); LOGGER.log(Level.FINEST, "Executing flyweight task {0}", taskDisplayName); r.run(); m.execute(wuc); p.leave(this); if (!wuc.getWorkUnits().isEmpty()) { LOGGER.log(Level.FINEST, "BuildableItem {0} marked as pending.", taskDisplayName);
bi.addAction(tp); return tp; } finally {
@Override public Iterable<FutureLoad> predict(MappingWorksheet plan, Computer computer, long start, long end) { TimeRange timeRange = new TimeRange(start, end - start); List<FutureLoad> loads = new ArrayList<FutureLoad>(); for (BuildableItem bi : Jenkins.getInstance().getQueue().getBuildableItems()) { TentativePlan tp = bi.getAction(TentativePlan.class); if (tp==null) {// do this even for bi==plan.item ensures that we have FIFO semantics in tentative plans. tp = makeTentativePlan(bi); if (tp==null) continue; // no viable plan. } if (tp.isStale()) { // if the tentative plan is stale, just keep on pushing it to the current time // (if we recreate the plan, it'll be put at the end of the queue, whereas this job // should actually get priority over others) tp.range.shiftTo(System.currentTimeMillis()); } // don't let its own tentative plan count when considering a scheduling for a job if (plan.item==bi) continue; // no overlap in the time span, meaning this plan is for a distant future if (!timeRange.overlapsWith(tp.range)) continue; // if this tentative plan has no baring on this computer, that's ignorable Integer i = tp.footprint.get(computer); if (i==null) continue; return Collections.singleton(tp.range.toFutureLoad(i)); } return loads; }
Runnable r = makeBuildable(new BuildableItem(p)); if (r != null) { p.leave(this); if (causeOfBlockage == null) { Runnable r = makeBuildable(new BuildableItem(top)); String topTaskDisplayName = LOGGER.isLoggable(Level.FINEST) ? top.task.getFullDisplayName() : null; if (r != null) { p.leave(this); new BlockedItem(p, causeOfBlockage).enter(this); LOGGER.log(Level.FINE, "Catching that {0} is blocked in the last minute", p); Runnable r = makeFlyWeightTaskBuildable(new BuildableItem(p)); if (r != null) { p.leave(this); LOGGER.log(Level.FINEST, "Executing flyweight task {0}", taskDisplayName); r.run(); m.execute(wuc); p.leave(this); if (!wuc.getWorkUnits().isEmpty()) { LOGGER.log(Level.FINEST, "BuildableItem {0} marked as pending.", taskDisplayName);
LOGGER.log(FINER, "when running {0} from {1} we are copying {2} actions whereas the item currently has {3}", new Object[] {executable, workUnit.context.item, workUnit.context.actions, workUnit.context.item.getAllActions()}); Authentication auth = workUnit.context.item.authenticate(); LOGGER.log(FINE, "{0} is now executing {1} as {2}", new Object[] {getName(), executable, auth}); if (LOGGER.isLoggable(FINE) && auth.equals(ACL.SYSTEM)) { // i.e., unspecified
makeBuildable(new BuildableItem(p)); makeBuildable(new BuildableItem(top)); } else {
bi.addAction(tp); return tp; } finally {
bi.addAction(tp); return tp; } finally {
bi.addAction(tp); return tp; } finally {
bi.addAction(tp); return tp; } finally {
bi.addAction(tp); return tp; } finally {
makeBuildable(new BuildableItem(p)); makeBuildable(new BuildableItem(top)); } else {
hash.addAll(hashSource); Label lbl = p.getAssignedLabel(); String fullDisplayName = p.task.getFullDisplayName(); for (Node n : hash.list(fullDisplayName)) {
makeBuildable(new BuildableItem(p)); makeBuildable(new BuildableItem(top)); } else {
Label label = getAssignedLabel(); List<Node> allNodes = hudson.getNodes(); if (allNodes.isEmpty()) { for (Node node : allNodes) { if (node.toComputer().isPartiallyIdle()) { c = canTake(node); if (c == null) { break;
makeBuildable(new BuildableItem(p)); makeBuildable(new BuildableItem(top)); } else {
Label l = item.getAssignedLabel(); 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. Authentication identity = item.authenticate(); if (!getACL().hasPermission(identity,Computer.BUILD)) {
Label lbl = p.getAssignedLabel(); for (Node n : hash.list(p.task.getFullDisplayName())) { Computer c = n.toComputer();
TentativePlan tp = bi.getAction(TentativePlan.class); if (tp == null) {// do this even for bi==plan.item ensures that we have FIFO semantics in tentative plans. tp = makeTentativePlan(bi);
/** * Handles prevention of builds specific for a node when taking specific nodes offline leniently. * @param node the node to check prevention for * @param item the buildable item to check prevention for * @return CauseOfBlockage if a build is prevented, otherwise null */ @Override public CauseOfBlockage canTake(Node node, Queue.BuildableItem item) { CauseOfBlockage blockage = null; //Allow to run by default PluginImpl plugin = PluginImpl.getInstance(); String nodeName = node.getNodeName(); boolean nodeIsGoingToShutdown = plugin.isNodeShuttingDown(nodeName); if (nodeIsGoingToShutdown && item.task instanceof AbstractProject && !plugin.wasAlreadyQueued(item.getId(), nodeName)) { boolean otherNodeCanBuild = QueueUtils.canOtherNodeBuild(item, node); Set<Long> upstreamQueueIds = QueueUtils.getUpstreamQueueIds(item); if (otherNodeCanBuild || (!otherNodeCanBuild && !plugin.isAnyPermittedUpstreamQueueId(upstreamQueueIds, nodeName))) { logger.log(Level.FINE, "Preventing project {0} from running on node {1}, " + "since lenient shutdown is active", new String[] { item.getDisplayName(), nodeName }); blockage = new NodeShutdownBlockage(); } } //Set the project as allowed upstream project if it was not blocked and node shutdown enabled: if (blockage == null && nodeIsGoingToShutdown) { plugin.addPermittedUpstreamQueueId(item.getId(), nodeName); } return blockage; }