[Buildbot-devel] reconfig, import and exec

Geoff Wedig gwedig at d2.com
Mon May 14 15:52:26 UTC 2007


Brian Warner wrote:
>>> import mozbuild
>>> reload(mozbuild)
>>>       
>
> Yeah, this is a consequence of the way that python handles modules. There is
> a process-global cache of module contents that is only updated by the
> 'reload' statement. Doing the import/reload pair will flush this cache every
> time the buildmaster is reconfigured.
>
> Note that this will change the identity of any classes you've defined in that
> module, so that e.g. a Builder which uses mozbuild.MyBuildStep will *always*
> think it has changed, even if the contents of mozbuild.py haven't been
> touched. (the cache isn't indexed by a hash of the source code).
>
> As a result, sometimes I leave that 'reload' line commented out, and when I
> need to update one of the imported modules, I do two changes. The first one
> modifies mozbuild.py and uncomments the reload, so everything gets reloaded.
> The second one recomments the reload statement, so that further changes (to
> just the master.cfg contents) don't do the reload and don't cause spurious
> side-effects (like resetting change-source pollers, or losing pending builds
> that are waiting inside a Scheduler that gets replaced).
>
> Hmm. #14 will suffer/benefit from this same effect. I was thinking we'd just
> exec() all the files in master.cfg.d/* in order, in the same namespace.
> Because that will change the identity of the classes, it may cause these
> spurious changes. I'm not sure of a good way to deal with this.
>
> cheers,
>  -Brian
>
>   
Hmmm, after my rewrite, I didn't get this problem.  I think this is due 
to using exec to load the individual projects, and using reload to load 
projects.py file which I use to load them.  The two together don't seem 
to think anything but what was actually changed has changed.

So maybe that's a solution.  Still, I don't know, since my understanding 
of this little subset of the python language is pretty lousy.  Probably 
just talking through my hat.

Geoff


-- 
Geoff Wedig
Software Engineer
Digital Domain

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://buildbot.net/pipermail/devel/attachments/20070514/1a2b987f/attachment.html>


More information about the devel mailing list