[Buildbot-devel] persisting members in changesource

Brian Warner warner-buildbot at lothar.com
Sun Aug 12 07:03:18 UTC 2007

"Axel Hecht" <l10n.moz at googlemail.com> writes:

> I'm wondering if there's a 'right' way to persist data in a
> changesource between restarts of the master. The source in question
> would be the bonsaipoller, it'd be nice if it would actually ask for
> changes since it last asked, and not when it started.

Given the current state of buildbot persistence (i.e. until we get that
sqlite backend written), I'd say pick a probably-unique filename and write
the change number (or whatever state you need) into that file after each
change, and read it from that file in BonsaiPoller.startService(). The
buildmaster chdirs into its base directory before running, so you can feel
sure that open("bonsaipoller.state", "w") will go to the right place.

If the state is complex, you might consider using pickle to serialize it. If
it's just a number, I'd just write it to a line by itself, and read it back
with int(f.read().strip()).

When we get sqlite support in place, we can make up a separate table for the
BonsaiPoller and save the state as a single record there.


More information about the devel mailing list