[Buildbot-devel] buildbot doesn't fully reconfigure on SIGHUP?

William Deegan bill at baddogconsulting.com
Fri Oct 5 21:46:11 UTC 2012


On Oct 4, 2012, at 11:25 PM, Jared Grubb <jared.grubb at gmail.com> wrote:

> On 3 Oct 2012, at 14:38, Dan Kegel <dank at kegel.com> wrote:
>> On Wed, Oct 3, 2012 at 2:21 PM, Tom Prince <tom.prince at ualberta.net> wrote:
>>>> The manual claims buildbot reloads config files when you send it a SIGHUP,
>>>> but I'm not seeing that here.  I mean, sure, it says it's doing it, but
>>>> if the config file adds a new buildslave, that won't show up until
>>>> you actually stop the buildbot and start it again.
>>>> Has anyone else seen that?  I don't see an exact match in the bug tracker.
>>> 
>>> My guess is that you import some file that defines the buildslaves.
>>> 
>>> buildbot's reconfig is implemented by rerunning the code in the
>>> master.cfg file. The nature of python is such that an import only
>>> loads the indicated file the first time it is run (so if you change the
>>> file, python won't see it). This can be somewhat worked around by
>>> calling reload, although the behavior of that can be tricky.
>> 
>> Correct in one!
>> Following your hint, I see that
>> http://stackoverflow.com/questions/684171/how-to-re-import-an-updated-package-while-in-python-interpreter
>> lists some of the issues with reload.
>> 
>> I will chalk this up as another reason to rewrite our buildbot config.
> 
> I personally use exec_file instead of import in my master.cfg .. not ideal, but works ok for this purpose.

I use a stanza like this:

import myBBConfig.module
reload(myBBConfig.module)

And then either:
myMethod=myBBConfig.module.myMethod

Or refer to each method by full name
myBBConfig.module.myMethod(a,b,c,d)

This seems to work very reliably (for well over a year of reconfigs)

The trick is to remember that
from abc import xyz
Won't get reloaded, but is the equivalent of:
import abc
xyz = abc.xyz

if you add:
reload(abc) before xyz=abc.xyz, then that does that trick.

-Bill





More information about the devel mailing list