templates_packagesdir = $(templatesdir)/packages
dist_templates_packages_builds_DATA = \
- src/templates/packages/builds/scratch.html \
- src/templates/packages/builds/times.html
+ src/templates/packages/builds/scratch.html
templates_packages_buildsdir = $(templates_packagesdir)/builds
return comments
- def get_build_times_summary(self, name=None, arch=None):
- query = "\
- SELECT \
- builds_times.arch AS arch, \
- MAX(duration) AS maximum, \
- MIN(duration) AS minimum, \
- AVG(duration) AS average, \
- SUM(duration) AS sum, \
- STDDEV_POP(duration) AS stddev \
- FROM builds_times \
- LEFT JOIN builds ON builds_times.build_id = builds.id \
- LEFT JOIN packages ON builds.pkg_id = packages.id"
-
- args = []
- conditions = []
-
- # Filter for name.
- if name:
- conditions.append("packages.name = %s")
- args.append(name)
-
- # Filter by arch.
- if arch:
- conditions.append("builds_times.arch = %s")
- args.append(arch)
-
- # Add conditions.
- if conditions:
- query += " WHERE %s" % " AND ".join(conditions)
-
- # Grouping and sorting.
- query += " GROUP BY builds_times.arch ORDER BY builds_times.arch DESC"
-
- return self.db.query(query, *args)
-
- def get_build_times_by_arch(self, arch, **kwargs):
- kwargs.update({
- "arch" : arch,
- })
-
- build_times = self.get_build_times_summary(**kwargs)
- if build_times:
- return build_times[0]
-
class Build(base.DataObject):
table = "builds"
ALTER TABLE public.jobs OWNER TO pakfire;
---
--- Name: builds_times; Type: VIEW; Schema: public; Owner: pakfire
---
-
-CREATE VIEW public.builds_times AS
- SELECT jobs.build_id,
- jobs.arch,
- date_part('epoch'::text, (jobs.time_finished - jobs.time_started)) AS duration
- FROM public.jobs
- WHERE ((jobs.test IS FALSE) AND (jobs.state = 'finished'::text));
-
-
-ALTER TABLE public.builds_times OWNER TO pakfire;
-
--
-- Name: builds_watchers; Type: TABLE; Schema: public; Owner: pakfire
--
+++ /dev/null
-{% extends "../../base.html" %}
-
-{% block title %}{{ _("Package build times") }}: {{ pkg.name }}{% end block %}
-
-{% block body %}
- <ul class="breadcrumb">
- <li>
- <a href="/">{{ _("Home") }}</a>
- <span class="divider">/</span>
- </li>
- <li>
- <a href="/packages">{{ _("Packages") }}</a>
- <span class="divider">/</span>
- </li>
- <li>
- <a href="/package/{{ pkg.name }}">{{ pkg.name }}</a>
- <span class="divider">/</span>
- </li>
- <li class="active">
- <a href="/package/{{ pkg.name }}/builds/times">{{ _("Build times") }}</a>
- </li>
- </ul>
-
- <div class="page-header">
- <h2>
- {{ pkg.name }}<br>
- <small>{{ pkg.summary }}</small>
- </h2>
- </div>
-
- <h4>{{ _("Summary") }}</h4>
-
- <p class="muted">
- {{ _("This table shows you how long this package normally takes to be built.") }}
- </p>
-
- <table class="table table-striped table-hover table-condensed">
- <thead>
- <tr>
- <th></th>
- <th class="ac" colspan="4">{{ _("Build times") }}</th>
- </tr>
- <tr>
- <th>{{ _("Architecture") }}</th>
- <th class="ar">{{ _("Average") }}</th>
- <th class="ar">{{ _("Maximum") }}</th>
- <th class="ar">{{ _("Minimum") }}</th>
- <th class="ar">{{ _("Total") }}</th>
- </tr>
- </thead>
- <tbody>
- {% for row in build_times_summary %}
- <tr>
- <td>{{ row.arch }}</td>
- <td class="ar">
- {{ format_time(row.average) }}
- <span class="muted">
- ± {{ format_time(row.stddev / 2) }}
- </span>
- </td>
- <td class="ar">{{ format_time(row.maximum) }}</td>
- <td class="ar">{{ format_time(row.minimum) }}</td>
- <td class="ar">{{ format_time(row.sum) }}</td>
- </tr>
- {% end %}
- </tbody>
- </table>
-{% end block %}
(r"/package/([\w]{8}-[\w]{4}-[\w]{4}-[\w]{4}-[\w]{12})/view(.*)", packages.PackageFileViewHandler),
(r"/packages/([\w\-\+]+)", packages.PackageNameHandler),
(r"/package/([\w\-\+]+)/builds/scratch", packages.PackageScratchBuildsHandler),
- (r"/package/([\w\-\+]+)/builds/times", packages.PackageBuildsTimesHandler),
(r"/package/([\w\-\+]+)/changelog", packages.PackageChangelogHandler),
(r"/package/([\w\-\+]+)/properties", packages.PackagePropertiesHandler),
self.render("packages/view-file.html", pkg=pkg, filename=filename,
mimetype=mimetype, content=content, filesize=f.size)
-
-
-class PackageBuildsTimesHandler(base.BaseHandler):
- def get(self, name):
- latest_build = self.backend.builds.get_latest_by_name(name)
-
- # If no build with this name was found, we cannot go on.
- if not latest_build:
- raise tornado.web.HTTPError(404)
-
- # Get the summary stats.
- build_times_summary = self.backend.builds.get_build_times_summary(name)
-
- self.render("packages/builds/times.html", pkg=latest_build.pkg,
- build_times_summary=build_times_summary)