templates_sessionsdir = $(templatesdir)/sessions
-dist_templates_statistics_DATA = \
- src/templates/statistics/index.html
-
-templates_statisticsdir = $(templatesdir)/statistics
-
# ------------------------------------------------------------------------------
#
dist_static_DATA = \
src/templates/search-results.html
src/templates/sessions/index.html
src/templates/source-list.html
-src/templates/statistics/index.html
src/templates/updates-index.html
src/templates/uploads-list.html
src/templates/user-comments.html
return builds
- def count(self):
- builds = self.db.get("SELECT COUNT(*) AS count FROM builds")
- if builds:
- return builds.count
-
def get_obsolete(self, repo=None):
"""
Get all obsoleted builds.
return [Job(self.backend, j.id, j) for j in self.db.query(query, *args)]
- def get_average_build_time(self):
- """
- Returns the average build time of all finished builds from the
- last 3 months.
- """
- result = self.db.get("SELECT AVG(time_finished - time_started) as average \
- FROM jobs WHERE type = 'build' AND state = 'finished' AND \
- time_finished >= NOW() - '3 months'::interval")
-
- if result:
- return result.average
-
- def count(self, *states):
- query = "SELECT COUNT(*) AS count FROM jobs"
- args = []
-
- if states:
- query += " WHERE state IN %s"
- args.append(states)
-
- jobs = self.db.get(query, *args)
- if jobs:
- return jobs.count
-
def restart_failed(self):
jobs = self._get_jobs("SELECT jobs.* FROM jobs \
JOIN builds ON builds.id = jobs.build_id \
</li>
{% end %}
- <li>
- <a href="/statistics">
- <i class="icon-align-left"></i>
- {{ _("Statistics") }}
- </a>
- </li>
-
{% if current_user and current_user.is_admin() %}
<li class="divider"></li>
<li class="nav-header">
+++ /dev/null
-{% extends "../base.html" %}
-
-{% block title %}{{ _("Statistics") }}{% end block %}
-
-{% block body %}
- <div class="page-header">
- <h2>{{ _("Statistics") }}</h2>
- </div>
-
- <p>
- {{ _("On this page, you will find a lot of information bundled in graphs and figures.") }}
- {{ _("They give a very quick overview about what is going on in the build service.") }}
- </p>
-
- <h3>{{ _("Builds") }}</h3>
- <ul>
- <li>
- {{ _("The average build time is %.1f minutes.") % (jobs_avg_build_time / 60) }}
- </li>
- <li>
- {{ _("There are %(builds_count)s builds containing %(jobs_count_all)s jobs.") % { "builds_count" : builds_count, "jobs_count_all" : jobs_count_all } }}
- </li>
- </ul>
-{% end block %}
(r"/key/([A-Z0-9]+)", KeysDownloadHandler),
(r"/key/([A-Z0-9]+)/delete", KeysDeleteHandler),
- # Statistics
- (r"/statistics", StatisticsMainHandler),
-
# Documents
(r"/documents", DocsIndexHandler),
(r"/documents/builds", DocsBuildsHandler),
raise tornado.web.HTTPError(404)
-class StatisticsMainHandler(BaseHandler):
- def get(self):
- args = {}
-
- # Build statistics.
- args.update({
- "builds_count" : self.pakfire.builds.count(),
- })
-
- # Job statistics.
- args.update({
- "jobs_count_all" : self.pakfire.jobs.count(),
- "jobs_avg_build_time" : self.pakfire.jobs.get_average_build_time(),
- })
-
- self.render("statistics/index.html", **args)
-
-
class UploadsHandler(BaseHandler):
@tornado.web.authenticated
def get(self):