Mercurial > mozilla > hg > talosnames
diff talosnames/api.py @ 10:1029ddf7b806
get the buildbot config
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Tue, 10 Jul 2012 16:22:58 -0700 |
parents | 82aad57c7d1d |
children | a4aa9f83e3be |
line wrap: on
line diff
--- a/talosnames/api.py Tue Jul 10 14:54:03 2012 -0700 +++ b/talosnames/api.py Tue Jul 10 16:22:58 2012 -0700 @@ -1,10 +1,13 @@ import re +import require import sqlite3 import urllib2 class TalosNames(object): graphserver_sql = 'http://hg.mozilla.org/graphs/raw-file/tip/sql/data.sql' schema = 'http://hg.mozilla.org/graphs/raw-file/tip/sql/schema.sql' + project_branches = 'http://hg.mozilla.org/build/buildbot-configs/raw-file/tip/mozilla/project_branches.py' + buildbot_config = 'http://hg.mozilla.org/build/buildbot-configs/raw-file/tip/mozilla-tests/config.py' # mapping file from builbot-configs name to tbpl codes: # http://hg.mozilla.org/users/mstange_themasta.com/tinderboxpushlog/file/tip/js/Config.js @@ -17,9 +20,12 @@ 'tests': '(id, name text, pretty_name text, is_chrome int, is_active int, pageset_id int)' } + ### initialization functions + def __init__(self): self.setup_database() self.tbpl_mapping() + self.setup_buildbot() def setup_database(self): self.db = sqlite3.connect(':memory:') @@ -61,6 +67,20 @@ _regex, name = match.groups() self.tbpl_regexs[name] = _regex + def setup_buildbot(self): +# project_branches = require.require(self.project_branches) + module = require.require(self.buildbot_config) + self.suites = module.SUITES + + ### functions for fetching information + + def tbpl_name(self, name): + """returns the TBPL long name""" + for tbplname, regex in self.tbpl_regexs.items(): + regex = re.compile(regex) + if regex.match(name): + return tbplname + def __call__(self, name=None): retval = [] for short_name, graphserver_name in self.names.items():