# HG changeset patch # User Jeff Hammel # Date 1341971794 25200 # Node ID 48b4c926be734ea6def1d96f3f9b9d4323b1aa31 # Parent 0a829ad6e116db2c501b36c17dc2a0f7ae570b8b getting there diff -r 0a829ad6e116 -r 48b4c926be73 talosnames/api.py --- a/talosnames/api.py Tue Jul 10 18:39:46 2012 -0700 +++ b/talosnames/api.py Tue Jul 10 18:56:34 2012 -0700 @@ -41,7 +41,10 @@ self.setup_database() self.tbpl_mapping() self.setup_buildbot() + + # cache self._talos_configs = {} + self._tbpl_names = {} def setup_database(self): self.db = sqlite3.connect(':memory:') @@ -95,9 +98,12 @@ def tbpl_name(self, name): """returns the TBPL long name""" + if name in self._tbpl_names: + return self._tbpl_names[name] for tbplname, regex in self.tbpl_regexs.items(): regex = re.compile(regex) if regex.match(name): + self._tbpl_names[name] = tbplname return tbplname def buildbot_command(self, name): @@ -106,6 +112,9 @@ def talos_config(self, name): """returns talos configuration for suite `name`""" + if name in self._talos_configs: + return self._talos_configs[name] + command = self.buildbot_command(name) assert command is not None, "Suite not found: %s" % name outfile = tempfile.mktemp(suffix='.yml') @@ -114,6 +123,7 @@ call(['PerfConfigurator'] + command, stdout=subprocess.PIPE, cwd=talos_dir) assert os.path.exists(outfile) config = yaml.load(file(outfile)) + self._talos_configs[name] = config return config def test_config(self, name): diff -r 0a829ad6e116 -r 48b4c926be73 talosnames/templates/index.html --- a/talosnames/templates/index.html Tue Jul 10 18:39:46 2012 -0700 +++ b/talosnames/templates/index.html Tue Jul 10 18:56:34 2012 -0700 @@ -15,6 +15,17 @@ TBPL Name Talos Tests +{{for suite in suites}} + + {{suite}} + {{repr(commands[suite])}} + {{tbpl[suite]}} +
foo
+
+
+bar
+ +{{endfor}} diff -r 0a829ad6e116 -r 48b4c926be73 talosnames/web.py --- a/talosnames/web.py Tue Jul 10 18:39:46 2012 -0700 +++ b/talosnames/web.py Tue Jul 10 18:56:34 2012 -0700 @@ -26,7 +26,21 @@ def render(self): template = tempita.HTMLTemplate(self.template) - data = {} + suites = sorted(self.api.suites.keys()) + tests = {} + for suite in suites: + try: + test = self.api.test_config(suite) + tests[suite] = test + except: + tests[suite] = None + + data = {'suites': suites, + 'commands': self.api.buildbot_commands, + 'tbpl': dict([(suite, self.api.tbpl_name(suite)) + for suite in suites]), + 'tests': tests + } return template.substitute(data) if __name__ == '__main__':