private Node prepareExecutorFor(final Queue.BuildableItem item, final AbstractProject job) throws Descriptor.FormException, IOException, InterruptedException { LOGGER.info("Creating a container slave to host " + job.toString() + ", item id " + item.getId()); // Immediately create a slave for this item // Real provisioning will happen later String slaveName = "Container for item " + item.getId(); String description = "Container slave for building " + job.getFullName(); DockerSlaves plugin = DockerSlaves.get(); return new DockerSlave(slaveName, description, null, plugin.createStandardJobProvisionerFactory(job),item); }
/** * 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; }
/** * This method is only meant to be called internally by {@link Executor}. */ @Restricted(NoExternalUse.class) public void setExecutable(Executable executable) { this.executable = executable; if (executable instanceof Run) { ((Run) executable).setQueueId(context.item.getId()); } }
/** * This method is only meant to be called internally by {@link Executor}. */ @Restricted(NoExternalUse.class) public void setExecutable(Executable executable) { this.executable = executable; if (executable instanceof Run) { ((Run) executable).setQueueId(context.item.getId()); } }