[Buildbot-devel] waterfall/jinja - where do variables like 'categories' come from?

Jared Grubb jared.grubb at gmail.com
Wed Mar 12 06:06:31 UTC 2014


On Mar 7, 2014, at 11:00, Stephen Davis <buildbot at soundgeek.org> wrote:

> Noob questions regarding the waterfall template.  I am in the crowd of folks who misses the "order of builders = order they were added to config" waterfall display but I would be totally fine with it if I could use builder categories to group them together like the console page does.  I'm looking at the default templates, waterfall.html & console.html, and the former references a variable called "builders" to create the table columns and the latter uses "categories" and "slaves[c.name]" to create the columns.
> 
> a) Where do these variables come from?  I've looked briefly at the jinja documentation but it's not obvious (yet).

The Jinja context gets built up by the web resource pages. For example, the waterfall:
buildbot/source/master/buildbot/status/web/waterfall.py

You'll see eventually that this gets called:
        template = request.site.buildbot_service.templates.get_template("waterfall.html")
        data = template.render(**ctx)

where "ctx" is the context that holds all the variables you see in the jinja files.

In particular, it looks like "content_with_db_data" is the function where the order of the builders happens (or really, it's probably status.getBuilderNames, but you could alter the order there). I havent tried it, but after these two lines:
        allBuilderNames = status.getBuilderNames(categories=self.categories)
        builders = [status.getBuilder(name) for name in allBuilderNames]
it appears the order of "builders" is stable, so if you modified it there, I would bet it would stick.

> 
> b) What is the relationship between the builders and slaves variables as far as determining when I should decide to use one or the other?  Put another way, if I used the console.html mechanism of looping through the categories, could I use "builders[c.name]" instead?
> 
> thanks,
> stephen
> 
> ------------------------------------------------------------------------------
> Subversion Kills Productivity. Get off Subversion & Make the Move to Perforce.
> With Perforce, you get hassle-free workflows. Merge that actually works. 
> Faster operations. Version large binaries.  Built-in WAN optimization and the
> freedom to use Git, Perforce or both. Make the move to Perforce.
> http://pubads.g.doubleclick.net/gampad/clk?id=122218951&iu=/4140/ostg.clktrk
> _______________________________________________
> 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