result = self._get_store().find(StormBuild)
return distinct_builds(result.order_by(Desc(StormBuild.upload_time)))
+ def get_summary_builds(self):
+ """returns tree and status to the ViewSummaryPage class"""
+ store = self._get_store()
+ return store.execute("""
+SELECT obd.tree, obd.status AS status_str
+FROM build obd
+INNER JOIN(
+ SELECT MAX(age) age, tree, host, compiler
+ FROM build
+ GROUP BY tree, host, compiler
+) ibd ON obd.age = ibd.age AND obd.tree = ibd.tree AND obd.host = ibd.host AND obd.compiler = ibd.compiler;
+""")
+
def get_tree_builds(self, tree):
result = self._get_store().find(StormBuild,
Cast(StormBuild.tree, "TEXT") == Cast(tree, "TEXT"))
os.link(build.basename+".log", new_basename+".log")
if os.path.exists(build.basename+".err"):
os.link(build.basename+".err", new_basename+".err")
- new_build = StormBuild(new_basename, build.tree, build.host,
- build.compiler, rev)
+ # They are supposed to be in unicode only but since comparision for sumary page depends on them
+ # the unicode conversion is done to avoid duplicates when running query in summary_builds
+ new_build = StormBuild(new_basename, unicode(build.tree), unicode(build.host), unicode(build.compiler), rev)
new_build.checksum = build.log_checksum()
new_build.upload_time = build.upload_time
new_build.status_str = build.status().__serialize__()
LogFileMissing,
NoSuchBuildError,
NoTestOutput,
+ BuildStatus,
)
import cgi
# output when we want
broken_table = ""
- builds = self.buildfarm.get_last_builds()
+ builds = self.buildfarm.get_summary_builds()
- for build in builds:
- host_count[build.tree]+=1
- status = build.status()
+ for tree, status_str in builds:
+ host_count[tree]+=1
+ status = BuildStatus.__deserialize__(status_str)
if status.failed:
- broken_count[build.tree]+=1
+ broken_count[tree]+=1
if "panic" in status.other_failures:
- panic_count[build.tree]+=1
+ panic_count[tree]+=1
return (host_count, broken_count, panic_count)
def render_text(self, myself):