From: Michael Tremer Date: Mon, 9 Oct 2017 21:38:14 +0000 (+0100) Subject: Drop jobs duration statistics handler X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=af348ef8f55428fdbc881be63c885a9fdc50786b;p=pbs.git Drop jobs duration statistics handler Signed-off-by: Michael Tremer --- diff --git a/src/buildservice/builds.py b/src/buildservice/builds.py index a102f6e0..16bf2d56 100644 --- a/src/buildservice/builds.py +++ b/src/buildservice/builds.py @@ -1516,27 +1516,6 @@ class Jobs(base.Object): return ret - def get_build_durations(self): - res = self.db.query("SELECT platform, MIN(duration) AS minimum, \ - MAX(duration) AS maximum, AVG(duration) AS average, \ - STDDEV_POP(duration) AS stddev \ - FROM builds_times GROUP BY platform \ - UNION SELECT 'all', MIN(duration) AS minimum, \ - MAX(duration) AS maximum, AVG(duration) AS average, \ - STDDEV_POP(duration) AS stddev \ - FROM builds_times") - - ret = {} - for row in res: - ret[row.platform] = { - "minimum" : int(row.minimum), - "maximum" : int(row.maximum), - "average" : int(row.average), - "stddev" : int(row.stddev), - } - - return ret - class Job(base.DataObject): table = "jobs" diff --git a/src/database.sql b/src/database.sql index 5ea33a8d..28d2aae4 100644 --- a/src/database.sql +++ b/src/database.sql @@ -951,13 +951,10 @@ ALTER TABLE jobs OWNER TO pakfire; CREATE VIEW builds_times AS SELECT builds.id AS build_id, jobs.arch, - arches.platform, jobs.type AS job_type, (jobs.time_finished - jobs.time_started) AS duration - FROM (((jobs + FROM (jobs LEFT JOIN builds ON ((jobs.build_id = builds.id))) - LEFT JOIN packages ON ((builds.pkg_id = packages.id))) - LEFT JOIN arches ON ((jobs.arch = arches.name))) WHERE (jobs.state = 'finished'::jobs_state); diff --git a/src/hub/__init__.py b/src/hub/__init__.py index fa25c61f..0576d18b 100644 --- a/src/hub/__init__.py +++ b/src/hub/__init__.py @@ -40,7 +40,6 @@ class Application(tornado.web.Application): # Statistics (r"/statistics/builds/types", handlers.StatsBuildsTypesHandler), - (r"/statistics/jobs/durations", handlers.StatsJobsDurationsHandler), (r"/statistics/jobs/queue", handlers.StatsJobsQueueHandler), (r"/statistics/jobs/states", handlers.StatsJobsStatesHandler), diff --git a/src/hub/handlers.py b/src/hub/handlers.py index b623c789..d38ebc0e 100644 --- a/src/hub/handlers.py +++ b/src/hub/handlers.py @@ -153,21 +153,6 @@ class StatsJobsHandler(BaseHandler): self.write(ret) -class StatsJobsDurationsHandler(BaseHandler): - def get(self): - durations = self.backend.jobs.get_build_durations() - - ret = {} - for platform, d in durations.items(): - ret.update({ - "jobs_durations_%s_minimum" % platform : d.get("minimum", None), - "jobs_durations_%s_maximum" % platform : d.get("maximum", None), - "jobs_durations_%s_average" % platform : d.get("average", None), - "jobs_durations_%s_stddev" % platform : d.get("stddev", None), - }) - - self.write(ret) - class StatsJobsStatesHandler(BaseHandler): def get(self): ret = {}