/** @deprecated Use {@link #isBlockedByShutdown} instead. */ @Deprecated public static boolean ifBlockedByHudsonShutdown(Task task) { return isBlockedByShutdown(task); }
@Override public Mapping map(Task task, MappingWorksheet worksheet) { if (Queue.isBlockedByShutdown(task)) { // if we are quieting down, don't start anything new so that // all executors will be eventually free. return null; } return base.map(task, worksheet); }
/** * Tries to make an item ready to build. * @param p a proposed buildable item * @return a thunk to actually prepare it (after leaving an earlier list), or null if it cannot be run now */ private @CheckForNull Runnable makeBuildable(final BuildableItem p) { if (p.task instanceof FlyweightTask) { String taskDisplayName = LOGGER.isLoggable(Level.FINEST) ? p.task.getFullDisplayName() : null; if (!isBlockedByShutdown(p.task)) { Runnable runnable = makeFlyWeightTaskBuildable(p); LOGGER.log(Level.FINEST, "Converting flyweight task: {0} into a BuildableRunnable", taskDisplayName); if(runnable != null){ return runnable; } //this is to solve JENKINS-30084: the task has to be buildable to force the provisioning of nodes. //if the execution gets here, it means the task could not be scheduled since the node //the task is supposed to run on is offline or not available. //Thus, the flyweighttask enters the buildables queue and will ask Jenkins to provision a node LOGGER.log(Level.FINEST, "Flyweight task {0} is entering as buildable to provision a node.", taskDisplayName); return new BuildableRunnable(p); } // if the execution gets here, it means the task is blocked by shutdown and null is returned. LOGGER.log(Level.FINEST, "Task {0} is blocked by shutdown.", taskDisplayName); return null; } else { // regular heavyweight task return new BuildableRunnable(p); } }
public CauseOfBlockage getCauseOfBlockage() { Jenkins jenkins = Jenkins.getInstance(); if(isBlockedByShutdown(task)) return CauseOfBlockage.fromMessage(Messages._Queue_HudsonIsAboutToShutDown()); List<CauseOfBlockage> causesOfBlockage = transientCausesOfBlockage; Label label = getAssignedLabel(); List<Node> allNodes = jenkins.getNodes(); if (allNodes.isEmpty()) label = null; // no master/agent. pointless to talk about nodes if (label != null) { Set<Node> nodes = label.getNodes(); if (label.isOffline()) { if (nodes.size() != 1) return new BecauseLabelIsOffline(label); else return new BecauseNodeIsOffline(nodes.iterator().next()); } else { if (causesOfBlockage != null && label.getIdleExecutors() > 0) { return new CompositeCauseOfBlockage(causesOfBlockage); } if (nodes.size() != 1) return new BecauseLabelIsBusy(label); else return new BecauseNodeIsBusy(nodes.iterator().next()); } } else if (causesOfBlockage != null && new ComputerSet().getIdleExecutors() > 0) { return new CompositeCauseOfBlockage(causesOfBlockage); } else { return CauseOfBlockage.createNeedsMoreExecutor(Messages._Queue_WaitingForNextAvailableExecutor()); } }
/** @deprecated Use {@link #isBlockedByShutdown} instead. */ @Deprecated public static boolean ifBlockedByHudsonShutdown(Task task) { return isBlockedByShutdown(task); }
@Override public Mapping map(Task task, MappingWorksheet worksheet) { if (Queue.isBlockedByShutdown(task)) { // if we are quieting down, don't start anything new so that // all executors will be eventually free. return null; } return base.map(task, worksheet); }
/** * Tries to make an item ready to build. * @param p a proposed buildable item * @return a thunk to actually prepare it (after leaving an earlier list), or null if it cannot be run now */ private @CheckForNull Runnable makeBuildable(final BuildableItem p) { if (p.task instanceof FlyweightTask) { String taskDisplayName = LOGGER.isLoggable(Level.FINEST) ? p.task.getFullDisplayName() : null; if (!isBlockedByShutdown(p.task)) { Runnable runnable = makeFlyWeightTaskBuildable(p); LOGGER.log(Level.FINEST, "Converting flyweight task: {0} into a BuildableRunnable", taskDisplayName); if(runnable != null){ return runnable; } //this is to solve JENKINS-30084: the task has to be buildable to force the provisioning of nodes. //if the execution gets here, it means the task could not be scheduled since the node //the task is supposed to run on is offline or not available. //Thus, the flyweighttask enters the buildables queue and will ask Jenkins to provision a node LOGGER.log(Level.FINEST, "Flyweight task {0} is entering as buildable to provision a node.", taskDisplayName); return new BuildableRunnable(p); } // if the execution gets here, it means the task is blocked by shutdown and null is returned. LOGGER.log(Level.FINEST, "Task {0} is blocked by shutdown.", taskDisplayName); return null; } else { // regular heavyweight task return new BuildableRunnable(p); } }
public CauseOfBlockage getCauseOfBlockage() { Jenkins jenkins = Jenkins.getInstance(); if(isBlockedByShutdown(task)) return CauseOfBlockage.fromMessage(Messages._Queue_HudsonIsAboutToShutDown()); List<CauseOfBlockage> causesOfBlockage = transientCausesOfBlockage; Label label = getAssignedLabel(); List<Node> allNodes = jenkins.getNodes(); if (allNodes.isEmpty()) label = null; // no master/agent. pointless to talk about nodes if (label != null) { Set<Node> nodes = label.getNodes(); if (label.isOffline()) { if (nodes.size() != 1) return new BecauseLabelIsOffline(label); else return new BecauseNodeIsOffline(nodes.iterator().next()); } else { if (causesOfBlockage != null && label.getIdleExecutors() > 0) { return new CompositeCauseOfBlockage(causesOfBlockage); } if (nodes.size() != 1) return new BecauseLabelIsBusy(label); else return new BecauseNodeIsBusy(nodes.iterator().next()); } } else if (causesOfBlockage != null && new ComputerSet().getIdleExecutors() > 0) { return new CompositeCauseOfBlockage(causesOfBlockage); } else { return CauseOfBlockage.createNeedsMoreExecutor(Messages._Queue_WaitingForNextAvailableExecutor()); } }