[Buildbot-devel] Ultimate fix for 'buildbot reconfig' problem

William Deegan bill at baddogconsulting.com
Wed Mar 27 18:27:50 UTC 2013


Ben,

not so much related to the python magic below, but if you change all your :
from x import y,z,w,..'s
with
y = x.y
z = x.z
w = x.w

Then you're reloads should work more smoothly.
Avoid from x import abc, or *'s and I've found reloads are reliable.

-Bill
On Mar 27, 2013, at 5:38 AM, Ben Hearsum <bhearsum at mozilla.com> wrote:

> I haven't seen this approach before, so forgive the potentially naive question but...
> 
> How does this work with multiple imports in the same file? The biggest reloading issue we have on the Mozilla Buildbot masters is multiple reloads of the same file.
> 
> For example, buildbotcustom.common is imported in at least two places:
> https://github.com/mozilla/build-buildbotcustom/blob/master/misc.py#L23
> https://github.com/mozilla/build-buildbotcustom/blob/master/process/factory.py#L19
> 
> but only reloaded in the former. If we reload the module in both of them we end up with dead references in the first after the second reload.
> 
> - Ben
> 
> On Wed, Mar 27, 2013 at 01:02:41AM +0200, Andrii Senkovych wrote:
>> Hi,
>> 
>> Recently it was mentioned about how Mozilla solves the reconfig
>> problem[1]. The same approach is used in metabuildbot configs[2].
>> However there's a more clean and universal way of doing the same in
>> just three lines of code for any number of imported modules. Behold:
>> 
>> from types import ModuleType
>> x = ()
>> _ = [reload(x) for x in locals() if isinstance(x, ModuleType)]
>> 
>> Some additional comments are available inside this[3] gist.
>> 
>>  [1]: http://hg.mozilla.org/build/buildbot-configs/file/a880563582c9/mozilla/scheduler_master.cfg
>>  [2]: https://github.com/buildbot/metabbotcfg/blob/master/master.cfg
>>  [3]: https://gist.github.com/jollyroger/5250060
>> 
>> ------------------------------------------------------------------------------
>> Own the Future-Intel® Level Up Game Demo Contest 2013
>> Rise to greatness in Intel's independent game demo contest.
>> Compete for recognition, cash, and the chance to get your game 
>> on Steam. $5K grand prize plus 10 genre and skill prizes. 
>> Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
>> _______________________________________________
>> Buildbot-devel mailing list
>> Buildbot-devel at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/buildbot-devel
> ------------------------------------------------------------------------------
> Own the Future-Intel® Level Up Game Demo Contest 2013
> Rise to greatness in Intel's independent game demo contest.
> Compete for recognition, cash, and the chance to get your game 
> on Steam. $5K grand prize plus 10 genre and skill prizes. 
> Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d_______________________________________________
> Buildbot-devel mailing list
> Buildbot-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/buildbot-devel





More information about the devel mailing list