|
This post was updated on .
hi,
I have the problem with automatic reconnect after disconnect. I work with slave as a windows service. I find this behaviour annoying in the following use case. I need to migrate gradually jenkins master to a new machine. There will be 2 jenkins masters with cloned configuration. At any given moment only one master should be connected to given node, but node will be configured on both. However, once the node is configured, there is no way to tell master not to reconnect. The only reliable way is to misconfigure given node. The unreliable way is to let master in charge of a node to connect and the preconfigured one to fail. Things get ugly if you have to restart any of 2 masters :-( The subject has been already discussed: http://jenkins.361315.n4.nabble.com/disconnected-slave-nodes-reconnect-automatically-td378239.html What would help is exactly what was suggested in the thread above. Master does not reconnect slave if it was manually disconnected. I think it would also help in situation when slave service is in the way of the things you do with slave. There is no way to tell master to simply back off until further notice. Cheers, Pawel |
|
Pawel,
As an interim solution, you could have a build step that runs either a groovy script or the Jenkins-cli to "disconnect-node" and "connect-node" . This is not an ideal solution! Strange that Jenkins does not know which nodes are disconnected and tries to re-connect. Kind Regards, Mgimza On Sat, Oct 13, 2012 at 5:12 AM, Pawel Jasinski <[hidden email]> wrote: hi, |
|
hi,
On Mon, Oct 15, 2012 at 5:05 PM, Marek Gimza <[hidden email]> wrote: > Pawel, > > > As an interim solution, you could have a build step that runs either a > groovy script or the Jenkins-cli to "disconnect-node" and "connect-node" . I have checked with the googles and came back empty handed. API docs do not give me any hint. Could you please, drop a snippet or at least sketch it. > > This is not an ideal solution! > > Strange that Jenkins does not know which nodes are disconnected and tries to > re-connect. > > > Kind Regards, > Mgimza > On Sat, Oct 13, 2012 at 5:12 AM, Pawel Jasinski <[hidden email]> > wrote: >> >> hi, >> >> I have the problem with automatic reconnect after disconnect. I work with >> slave as a windows service. I find this behaviour annoying in the >> following >> use case. >> >> I need to migrate gradually jenkins master to a new machine. >> There will be 2 jenkins masters with cloned configuration. At any given >> moment only one master should be connected to given node, but node will be >> configured on both. >> However, once the node is configured, there is no way to tell master not >> to >> reconnect. >> The only reliable way is to misconfigure given node. >> The unreliable way is to let master in charge of a node to connect and the >> preconfigured one to fail. Things get ugly if you have to restart any of 2 >> masters :-( >> >> The subject has been already discussed: >> >> http://jenkins.361315.n4.nabble.com/disconnected-slave-nodes-reconnect-automatically-td378239.html >> >> What would help is exactly what was suggested in the thread above. >> Master does not reconnect slave if it was manually disconnected. >> >> I thing it would also help in situation when slave service is in the way >> of >> the things you do with slave. There is no way to tell master to simply >> back >> off until further notice. >> >> >> >> Cheers, >> Pawel >> >> >> >> -- >> View this message in context: >> http://jenkins.361315.n4.nabble.com/Automatic-reconnect-after-manual-disconnect-tp4643194.html >> Sent from the Jenkins users mailing list archive at Nabble.com. > > |
|
Hi Pawel,
2012/10/16 Pawel Jasinski <[hidden email]>: > hi, > > > On Mon, Oct 15, 2012 at 5:05 PM, Marek Gimza <[hidden email]> wrote: >> Pawel, >> >> >> As an interim solution, you could have a build step that runs either a >> groovy script or the Jenkins-cli to "disconnect-node" and "connect-node" . > > I have checked with the googles and came back empty handed. API docs > do not give me any hint. > Could you please, drop a snippet or at least sketch it. I am currently just experimenting with utilizing our developer desktops during night for regression tests. Maybe this Groovy-snippet is helpful: import hudson.model.* import hudson.slaves.* for (aSlave in hudson.model.Hudson.instance.slaves) { if (aSlave.name == 'NameOfSlave') { println('Enabling NameOfSlave!'); aSlave.getComputer().doToggleOffline("Offline during office hours"); } } I run this script via cron at 0 8,18 * * 1-5. Any improvements from other people are very welcome. F.i. I do not like the toggle, if activating in the evening fails for any reason maybe the next toggle in the morning will work. HTH Dirk |
|
Thanks for the snippet.
I will try it with "disconnec()", perhaps when done with API it will act differently --pawel On Tue, Oct 16, 2012 at 3:42 PM, Dirk Kuypers <[hidden email]> wrote: > Hi Pawel, > > 2012/10/16 Pawel Jasinski <[hidden email]>: >> hi, >> >> >> On Mon, Oct 15, 2012 at 5:05 PM, Marek Gimza <[hidden email]> wrote: >>> Pawel, >>> >>> >>> As an interim solution, you could have a build step that runs either a >>> groovy script or the Jenkins-cli to "disconnect-node" and "connect-node" . >> >> I have checked with the googles and came back empty handed. API docs >> do not give me any hint. >> Could you please, drop a snippet or at least sketch it. > > I am currently just experimenting with utilizing our developer > desktops during night for regression tests. Maybe this Groovy-snippet > is helpful: > > import hudson.model.* > import hudson.slaves.* > > for (aSlave in hudson.model.Hudson.instance.slaves) { > if (aSlave.name == 'NameOfSlave') { > println('Enabling NameOfSlave!'); > aSlave.getComputer().doToggleOffline("Offline during office hours"); > } > } > > I run this script via cron at 0 8,18 * * 1-5. > > Any improvements from other people are very welcome. F.i. I do not > like the toggle, if activating in the evening fails for any reason > maybe the next toggle in the morning will work. > > HTH > Dirk |
|
In reply to this post by Dirk Kuypers-2
hi,
the following does disconnect, but it did not change the reconnect behaviour :-( import hudson.slaves.* for (aSlave in hudson.model.Hudson.instance.slaves) { if (aSlave.name == 'excon-34') { println('Enabling NameOfSlave!'); aSlave.getComputer().disconnect(new OfflineCause.ByCLI("X")); } } On Tue, Oct 16, 2012 at 3:42 PM, Dirk Kuypers <[hidden email]> wrote: > Hi Pawel, > > 2012/10/16 Pawel Jasinski <[hidden email]>: >> hi, >> >> >> On Mon, Oct 15, 2012 at 5:05 PM, Marek Gimza <[hidden email]> wrote: >>> Pawel, >>> >>> >>> As an interim solution, you could have a build step that runs either a >>> groovy script or the Jenkins-cli to "disconnect-node" and "connect-node" . >> >> I have checked with the googles and came back empty handed. API docs >> do not give me any hint. >> Could you please, drop a snippet or at least sketch it. > > I am currently just experimenting with utilizing our developer > desktops during night for regression tests. Maybe this Groovy-snippet > is helpful: > > import hudson.model.* > import hudson.slaves.* > > for (aSlave in hudson.model.Hudson.instance.slaves) { > if (aSlave.name == 'NameOfSlave') { > println('Enabling NameOfSlave!'); > aSlave.getComputer().doToggleOffline("Offline during office hours"); > } > } > > I run this script via cron at 0 8,18 * * 1-5. > > Any improvements from other people are very welcome. F.i. I do not > like the toggle, if activating in the evening fails for any reason > maybe the next toggle in the morning will work. > > HTH > Dirk |
| Powered by Nabble | Edit this page |
