*(builder.stop(wait=wait) for builder in builders_to_be_shut_down),
)
+ # Stats
+
+ @property
+ def total_build_time(self):
+ """
+ Returns the total build time
+ """
+ res = self.db.get("""
+ SELECT
+ SUM(
+ COALESCE(jobs.finished_at, CURRENT_TIMESTAMP)
+ -
+ jobs.started_at
+ ) AS t
+ FROM
+ jobs
+ WHERE
+ started_at IS NOT NULL""",
+ )
+
+ return res.t
+
+ @property
+ def total_build_time_by_arch(self):
+ """
+ Returns a dict with the total build times grouped by architecture
+ """
+ res = self.db.query("""
+ SELECT
+ jobs.arch AS arch,
+ SUM(
+ COALESCE(jobs.finished_at, CURRENT_TIMESTAMP)
+ -
+ jobs.started_at
+ ) AS t
+ FROM
+ jobs
+ WHERE
+ started_at IS NOT NULL
+ GROUP BY
+ jobs.arch
+ ORDER BY
+ jobs.arch""",
+ )
+
+ return { row.arch : row.t for row in res }
+
+
class Builder(base.DataObject):
table = "builders"
{{ _("Create A New Builder") }}
</a>
{% end %}
+
+ <div class="callout">
+ <h5>{{ _("Statistics") }}</h5>
+
+ <div class="grid-x grid-padding-x">
+ <div class="cell large-8">
+ <p>{{ _("Total Build Time") }}</p>
+
+ <div class="stat">
+ {{ format_time(backend.builders.total_build_time) }}
+ </div>
+ </div>
+
+ {% set arches = backend.builders.total_build_time_by_arch %}
+
+ <div class="cell large-4">
+ <p>{{ _("Total Build Time By Architecture") }}</p>
+
+ <table>
+ <tbody>
+ {% for arch in arches %}
+ <tr>
+ <th scope="row">{{ arch }}</th>
+ <td>{{ arches[arch] }}</td>
+ </tr>
+ {% end %}
+ </tbody>
+ </table>
+ </div>
+ </div>
+ </div>
{% end block %}