@Override @GuardedBy("hudson.model.Queue.lock") public long check(final AbstractCloudComputer c) { final AbstractCloudSlave computerNode = c.getNode(); if (c.isIdle() && !disabled && computerNode != null) { final long idleMilliseconds = System.currentTimeMillis() - c.getIdleStartMilliseconds(); if (idleMilliseconds > MINUTES.toMillis(idleMinutes)) { LOGGER.log(Level.INFO, "Disconnecting {0}", c.getName()); try { computerNode.terminate(); } catch (InterruptedException | IOException e) { LOGGER.log(WARNING, "Failed to terminate " + c.getName(), e); } } } return 1; }
/** * Releases and removes this agent. */ public void terminate() throws InterruptedException, IOException { final Computer computer = toComputer(); if (computer != null) { computer.recordTermination(); } try { // TODO: send the output to somewhere real _terminate(new StreamTaskListener(System.out, Charset.defaultCharset())); } finally { try { Jenkins.get().removeNode(this); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to remove "+name,e); } } }
/** * Releases and removes this slave. */ public void terminate() throws InterruptedException, IOException { try { // TODO: send the output to somewhere real _terminate(new StreamTaskListener(System.out, Charset.defaultCharset())); } finally { try { Hudson.getInstance().removeNode(this); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to remove "+name,e); } } }
/** * Releases and removes this slave. */ public void terminate() throws InterruptedException, IOException { try { // TODO: send the output to somewhere real _terminate(new StreamTaskListener(System.out, Charset.defaultCharset())); } finally { try { Hudson hudson = Hudson.getInstance(); hudson.removeNode(this); if (hudson.isTeamManagementEnabled()) { hudson.getTeamManager().removeNode(getNodeName()); } } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to remove " + name, e); } } }
@Override public JCloudsComputer getComputer() { return (JCloudsComputer) super.getComputer(); }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; if (!super.equals(o)) return false; KubernetesSlave that = (KubernetesSlave) o; if (cloudName != null ? !cloudName.equals(that.cloudName) : that.cloudName != null) return false; if (namespace != null ? !namespace.equals(that.namespace) : that.namespace != null) return false; return template != null ? template.equals(that.template) : that.template == null; }
@Override public CauseOfBlockage canTake(Queue.BuildableItem item) { // hack for some core issue if (item.task instanceof Queue.FlyweightTask) { return new FlyweightCauseOfBlockage(); } return super.canTake(item); }
@Override public Launcher createLauncher(TaskListener listener) { if (template != null) { Executor executor = Executor.currentExecutor(); if (executor != null) { Queue.Executable currentExecutable = executor.getCurrentExecutable(); if (currentExecutable != null && executables.add(currentExecutable)) { listener.getLogger().println(Messages.KubernetesSlave_AgentIsProvisionedFromTemplate( ModelHyperlinkNote.encodeTo("/computer/" + getNodeName(), getNodeName()), getTemplate().getDisplayName()) ); listener.getLogger().println(getTemplate().getDescriptionForLogging()); } } } return super.createLauncher(listener); }
/** * Releases and removes this slave. */ public void terminate() throws InterruptedException, IOException { try { // TODO: send the output to somewhere real _terminate(new StreamTaskListener(System.out, Charset.defaultCharset())); } finally { try { Hudson.getInstance().removeNode(this); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to remove "+name,e); } } }
/** * When the agent is deleted, free the node right away. */ @Override @RequirePOST public HttpResponse doDoDelete() throws IOException { checkPermission(DELETE); try { T node = getNode(); if (node != null) { // No need to terminate nodes again node.terminate(); } return new HttpRedirect(".."); } catch (InterruptedException e) { return HttpResponses.error(500,e); } } }
/** * Releases and removes this agent. */ public void terminate() throws InterruptedException, IOException { final Computer computer = toComputer(); if (computer != null) { computer.recordTermination(); } try { // TODO: send the output to somewhere real _terminate(new StreamTaskListener(System.out, Charset.defaultCharset())); } finally { try { Jenkins.getInstance().removeNode(this); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to remove "+name,e); } } }
/** * Releases and removes this slave. */ public void terminate() throws InterruptedException, IOException { try { // TODO: send the output to somewhere real _terminate(new StreamTaskListener(System.out, Charset.defaultCharset())); } finally { try { Hudson.getInstance().removeNode(this); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to remove "+name,e); } } }
@Override public void run() { try { AbstractCloudSlave node = computer.getNode(); if (node != null) { node.terminate(); } } catch (InterruptedException e) { LOGGER.log(Level.WARNING, "Failed to terminate " + computer.getName(), e); } catch (IOException e) { LOGGER.log(Level.WARNING, "Failed to terminate " + computer.getName(), e); } } });
@Override @GuardedBy("hudson.model.Queue.lock") public long check(final AbstractCloudComputer c) { final AbstractCloudSlave computerNode = c.getNode(); if (c.isIdle() && !disabled && computerNode != null) { final long idleMilliseconds = System.currentTimeMillis() - c.getIdleStartMilliseconds(); if (idleMilliseconds > MINUTES.toMillis(idleMinutes)) { LOGGER.log(Level.INFO, "Disconnecting {0}", c.getName()); try { computerNode.terminate(); } catch (InterruptedException e) { LOGGER.log(WARNING, "Failed to terminate " + c.getName(), e); } catch (IOException e) { LOGGER.log(WARNING, "Failed to terminate " + c.getName(), e); } } } return 1; }
protected void done(final AbstractCloudComputer<?> c) { c.setAcceptingTasks(false); // just in case synchronized (this) { if (terminating) { return; } terminating = true; } final Future<?> submit = Computer.threadPoolForRemoting.submit(() -> { try { AbstractCloudSlave node = c.getNode(); if (node != null) { node.terminate(); } } catch (InterruptedException | IOException e) { LOG.warn("Failed to terminate " + c.getName(), e); synchronized (DockerOnceRetentionStrategy.this) { terminating = false; } } } ); }
public synchronized long check(AbstractCloudComputer c) { if (c.isIdle() && !disabled) { final long idleMilliseconds = System.currentTimeMillis() - c.getIdleStartMilliseconds(); if (idleMilliseconds > MINUTES.toMillis(idleMinutes)) { LOGGER.info("Disconnecting " + c.getName()); try { c.getNode().terminate(); } catch (InterruptedException e) { LOGGER.log(WARNING, "Failed to terminate " + c.getName(), e); } catch (IOException e) { LOGGER.log(WARNING, "Failed to terminate " + c.getName(), e); } } } return 1; }
public synchronized long check(AbstractCloudComputer c) { if (c.isIdle() && !disabled) { final long idleMilliseconds = System.currentTimeMillis() - c.getIdleStartMilliseconds(); if (idleMilliseconds > MINUTES.toMillis(idleMinutes)) { LOGGER.info("Disconnecting "+c.getName()); try { c.getNode().terminate(); } catch (InterruptedException e) { LOGGER.log(WARNING,"Failed to terminate "+c.getName(),e); } catch (IOException e) { LOGGER.log(WARNING,"Failed to terminate "+c.getName(),e); } } } return 1; }
/** * While x-stream serialisation buggy, copy implementation. */ @Override @GuardedBy("hudson.model.Queue.lock") public long check(final AbstractCloudComputer c) { final AbstractCloudSlave computerNode = c.getNode(); if (c.isIdle() && computerNode != null) { final long idleMilliseconds = System.currentTimeMillis() - c.getIdleStartMilliseconds(); if (idleMilliseconds > MINUTES.toMillis(idleMinutes)) { LOG.info("Disconnecting {}, after {} min timeout.", c.getName(), idleMinutes); try { computerNode.terminate(); } catch (InterruptedException | IOException e) { LOG.warn("Failed to terminate {}", c.getName(), e); } } } return 1; }
public synchronized long check(AbstractCloudComputer c) { if (c.isIdle() && !disabled) { final long idleMilliseconds = System.currentTimeMillis() - c.getIdleStartMilliseconds(); if (idleMilliseconds > MINUTES.toMillis(idleMinutes)) { LOGGER.info("Disconnecting "+c.getName()); try { c.getNode().terminate(); } catch (InterruptedException e) { LOGGER.log(WARNING,"Failed to terminate "+c.getName(),e); } catch (IOException e) { LOGGER.log(WARNING,"Failed to terminate "+c.getName(),e); } } } return 1; }
public synchronized long check(AbstractCloudComputer c) { if (c.isIdle() && !disabled) { final long idleMilliseconds = System.currentTimeMillis() - c.getIdleStartMilliseconds(); if (idleMilliseconds > MINUTES.toMillis(idleMinutes)) { LOGGER.info("Disconnecting "+c.getName()); try { c.getNode().terminate(); } catch (InterruptedException e) { LOGGER.log(WARNING,"Failed to terminate "+c.getName(),e); } catch (IOException e) { LOGGER.log(WARNING,"Failed to terminate "+c.getName(),e); } } } return 1; }