@Override public void run() { if (c.isIdle()) { LOGGER.log(INFO, "Disconnecting computer {0} as it has finished all jobs running when " + "it completed its scheduled uptime", new Object[]{c.getName()}); c.disconnect(OfflineCause .create(Messages._SimpleScheduledRetentionStrategy_FinishedUpTime())); } } });
@Override public void run() { if (c.isIdle()) { LOGGER.log(INFO, "Disconnecting computer {0} as it has finished its scheduled uptime", new Object[]{c.getName()}); c.disconnect(OfflineCause .create(Messages._SimpleScheduledRetentionStrategy_FinishedUpTime())); } else { c.setAcceptingTasks(false); } } });
@Override public void run() { Computer c = node.toComputer(); if (c != null) { c.recordTermination(); c.disconnect(OfflineCause.create(hudson.model.Messages._Hudson_NodeBeingRemoved())); } if (node == nodes.remove(node.getNodeName())) { jenkins.updateComputerList(); jenkins.trimLabels(); } } });
protected void execute(TaskListener listener) throws IOException, InterruptedException { if (!enabled) return; long now = System.currentTimeMillis(); for (Computer c: Jenkins.get().getComputers()) { VirtualChannel ch = c.getChannel(); if (ch instanceof Channel) { Channel channel = (Channel) ch; if (now-channel.getLastHeard() > TIME_TILL_PING) { // haven't heard from this agent for a while. Long lastPing = (Long)channel.getProperty(ConnectionActivityMonitor.class); if (lastPing!=null && now-lastPing > TIMEOUT) { LOGGER.info("Repeated ping attempts failed on "+c.getName()+". Disconnecting"); c.disconnect(OfflineCause.create(Messages._ConnectionActivityMonitor_OfflineCause())); } else { // send a ping. if we receive a reply, it will be reflected in the next getLastHeard() call. channel.callAsync(PING_COMMAND); if (lastPing==null) channel.setProperty(ConnectionActivityMonitor.class,now); } } else { // we are receiving data nicely channel.setProperty(ConnectionActivityMonitor.class,null); } } } }
c.disconnect(OfflineCause.create(Messages._SimpleScheduledRetentionStrategy_FinishedUpTime()));
private void fastTerminate(final JCloudsComputer c) { if (!c.isOffline()) { LOGGER.info("Setting " + c.getName() + " to be deleted."); try { c.disconnect(OfflineCause.create(Messages._DeletedCause())).get(); } catch (Exception e) { LOGGER.info("Caught " + e.toString()); } } c.deleteSlave(true); }
/** * Removes a {@link Node} from Hudson. */ public synchronized void removeNode(Node n) throws IOException { Computer c = n.toComputer(); if (c != null) { c.disconnect(OfflineCause.create(Messages._Hudson_NodeBeingRemoved())); } ArrayList<Node> nl = new ArrayList<Node>(this.slaves); nl.remove(n); setNodes(nl); }
/** * Removes a {@link Node} from Hudson. */ public synchronized void removeNode(Node n) throws IOException { Computer c = n.toComputer(); if (c != null) { c.disconnect(OfflineCause.create(Messages._Hudson_NodeBeingRemoved())); } ArrayList<Node> nl = new ArrayList<Node>(this.slaves); nl.remove(n); setNodes(nl); }
/** * Removes a {@link Node} from Hudson. */ public synchronized void removeNode(Node n) throws IOException { Computer c = n.toComputer(); if (c != null) { c.disconnect(OfflineCause.create(Messages._Hudson_NodeBeingRemoved())); } ArrayList<Node> nl = new ArrayList<Node>(this.slaves); nl.remove(n); setNodes(nl); }
/** * Removes a {@link Node} from Hudson. */ public synchronized void removeNode(Node n) throws IOException { Computer c = n.toComputer(); if (c != null) { c.disconnect(OfflineCause.create(Messages._Hudson_NodeBeingRemoved())); } ArrayList<Node> nl = new ArrayList<Node>(this.slaves); nl.remove(n); setNodes(nl); }
@Override public void run() { if (c.isIdle()) { LOGGER.log(INFO, "Disconnecting computer {0} as it has finished all jobs running when " + "it completed its scheduled uptime", new Object[]{c.getName()}); c.disconnect(OfflineCause .create(Messages._SimpleScheduledRetentionStrategy_FinishedUpTime())); } } });
@Override public boolean tearDown(AbstractBuild build, final BuildListener listener) throws IOException, InterruptedException { LOGGER.warning("Single-use slave " + c.getName() + " getting torn down."); c.setTemporarilyOffline(true, OfflineCause.create(Messages._OneOffCause())); // Fixes JENKINS-28403 c.deleteSlave(); return true; } };
public void setCleanUpAction(CleanUpAction action, Localizable reason) { if (action != CleanUpAction.DELETE && action != CleanUpAction.SHUTDOWN) { throw new IllegalStateException("Only use this method to set explicit cleanup operations"); } AzureVMComputer computer = (AzureVMComputer) this.toComputer(); if (computer != null) { // Set the machine temporarily offline machine with an offline reason. computer.setTemporarilyOffline(true, OfflineCause.create(reason)); } setCleanUpAction(action); setCleanUpReason(reason); }
public HttpResponse doDoDisconnect(@QueryParameter String offlineMessage) throws IOException, ServletException { if (channel != null) { //does nothing in case computer is already disconnected checkPermission(CONFIGURE); offlineMessage = Util.fixEmptyAndTrim(offlineMessage); disconnect(OfflineCause.create(Messages._SlaveComputer_DisconnectedBy( HudsonSecurityManager.getAuthentication().getName(), offlineMessage != null ? " : " + offlineMessage : ""))); } return new HttpRedirect("."); }
@Override public void run() { if (c.isIdle()) { LOGGER.log(INFO, "Disconnecting computer {0} as it has finished its scheduled uptime", new Object[]{c.getName()}); c.disconnect(OfflineCause .create(Messages._SimpleScheduledRetentionStrategy_FinishedUpTime())); } else { c.setAcceptingTasks(false); } } });
public HttpResponse doToggleOffline(@QueryParameter String offlineMessage) throws IOException, ServletException { checkPermission(CONFIGURE); if (!temporarilyOffline) { offlineMessage = Util.fixEmptyAndTrim(offlineMessage); setTemporarilyOffline(!temporarilyOffline, OfflineCause.create(hudson.slaves.Messages._SlaveComputer_DisconnectedBy( HudsonSecurityManager.getAuthentication().getName(), offlineMessage != null ? " : " + offlineMessage : ""))); } else { setTemporarilyOffline(!temporarilyOffline, null); } return HttpResponses.redirectToDot(); }
public HttpResponse doDoDisconnect(@QueryParameter String offlineMessage) throws IOException, ServletException { if (channel!=null) { //does nothing in case computer is already disconnected checkPermission(Hudson.ADMINISTER); offlineMessage = Util.fixEmptyAndTrim(offlineMessage); disconnect(OfflineCause.create(Messages._SlaveComputer_DisconnectedBy( Hudson.getAuthentication().getName(), offlineMessage!=null ? " : " + offlineMessage : "") )); } return new HttpRedirect("."); }
public HttpResponse doDoDisconnect(@QueryParameter String offlineMessage) throws IOException, ServletException { if (channel!=null) { //does nothing in case computer is already disconnected checkPermission(Hudson.ADMINISTER); offlineMessage = Util.fixEmptyAndTrim(offlineMessage); disconnect(OfflineCause.create(Messages._SlaveComputer_DisconnectedBy( Hudson.getAuthentication().getName(), offlineMessage!=null ? " : " + offlineMessage : "") )); } return new HttpRedirect("."); }
@Override public void run() { Computer c = node.toComputer(); if (c != null) { c.recordTermination(); c.disconnect(OfflineCause.create(hudson.model.Messages._Hudson_NodeBeingRemoved())); } if (node == nodes.remove(node.getNodeName())) { jenkins.updateComputerList(); jenkins.trimLabels(); } } });
public HttpResponse doDoDisconnect(@QueryParameter String offlineMessage) throws IOException, ServletException { if (channel!=null) { //does nothing in case computer is already disconnected checkPermission(Hudson.ADMINISTER); offlineMessage = Util.fixEmptyAndTrim(offlineMessage); disconnect(OfflineCause.create(Messages._SlaveComputer_DisconnectedBy( Hudson.getAuthentication().getName(), offlineMessage!=null ? " : " + offlineMessage : "") )); } return new HttpRedirect("."); }