Merge lp:~doanac/qa-dashboard/smoke-kpi-fix into lp:qa-dashboard

Proposed by Andy Doan
Status: Merged
Approved by: Chris Johnston
Approved revision: 717
Merged at revision: 720
Proposed branch: lp:~doanac/qa-dashboard/smoke-kpi-fix
Merge into: lp:qa-dashboard
Diff against target: 66 lines (+8/-10)
3 files modified
smokeng/dashboard.py (+1/-1)
smokeng/management/commands/jenkins_pull_smokeng.py (+0/-9)
smokeng/models.py (+7/-0)
To merge this branch: bzr merge lp:~doanac/qa-dashboard/smoke-kpi-fix
Reviewer Review Type Date Requested Status
Chris Johnston Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+205893@code.launchpad.net

Commit message

smoke kpi: fix calculation

now that we have results that can be "running" and "syncing" we need to
update what we query for. Additionally I noticed that "pass_rate" wasn't
being set for results that were "syncing". I could have fixed this from
api.py, but it seemed better to do this in a single place and then
simplify our pull-script logic.

Description of the change

smoke kpi: fix calculation

now that we have results that can be "running" and "syncing" we need to
update what we query for. Additionally I noticed that "pass_rate" wasn't
being set for results that were "syncing". I could have fixed this from
api.py, but it seemed better to do this in a single place and then
simplify our pull-script logic.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:717
http://s-jenkins.ubuntu-ci:8080/job/dashboard-ci/303/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/dashboard-ci/303/rebuild

review: Approve (continuous-integration)
Revision history for this message
Chris Johnston (cjohnston) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'smokeng/dashboard.py'
2--- smokeng/dashboard.py 2013-10-30 17:06:40 +0000
3+++ smokeng/dashboard.py 2014-02-12 04:54:32 +0000
4@@ -79,9 +79,9 @@
5 qs = SmokeResult.objects.filter(
6 publish=True,
7 image__release__in=KPI_RELEASES,
8+ status__in=(SmokeResult.COMPLETE, SmokeResult.SYNCING),
9 ).exclude(
10 image__build_number__contains='?',
11- ).exclude(
12 image__variant__in=KPI_VARIANT_EXCLUDES,
13 ).values(
14 'image__arch',
15
16=== modified file 'smokeng/management/commands/jenkins_pull_smokeng.py'
17--- smokeng/management/commands/jenkins_pull_smokeng.py 2014-01-08 01:53:34 +0000
18+++ smokeng/management/commands/jenkins_pull_smokeng.py 2014-02-12 04:54:32 +0000
19@@ -216,13 +216,6 @@
20
21 logging.info("Adding smoke result.")
22
23- pass_rate = 0.0
24-
25- if dashboard_data['total'] != 0:
26- pass_rate = float(
27- dashboard_data['passes']
28- ) / dashboard_data['total']
29-
30 result, new_result = SmokeResult.objects.get_or_create(
31 publish=True,
32 image=self.image,
33@@ -234,7 +227,6 @@
34 fail_count=dashboard_data['failures'],
35 error_count=dashboard_data['errors'],
36 total_count=dashboard_data['total'],
37- pass_rate=pass_rate,
38 status=SmokeResult.COMPLETE,
39 )
40 )
41@@ -245,7 +237,6 @@
42 result.fail_count = dashboard_data['failures']
43 result.error_count = dashboard_data['errors']
44 result.total_count = dashboard_data['total']
45- result.pass_rate = pass_rate
46 result.status = SmokeResult.COMPLETE
47 result.save()
48
49
50=== modified file 'smokeng/models.py'
51--- smokeng/models.py 2014-01-23 20:38:50 +0000
52+++ smokeng/models.py 2014-02-12 04:54:32 +0000
53@@ -194,6 +194,13 @@
54 status = models.IntegerField(choices=STATUS_CHOICES, default=COMPLETE)
55 pass_rate = models.FloatField(default=0.0)
56
57+ def save(self, **kwargs):
58+ '''ensure we store the pass_rate'''
59+ self.pass_rate = 0
60+ if self.total_count > 0:
61+ self.pass_rate = float(self.pass_count) / self.total_count
62+ return super(SmokeResult, self).save(**kwargs)
63+
64 @staticmethod
65 def create_queued_results(image, build, tests):
66 ran_at = datetime.datetime.now()

Subscribers

People subscribed via source and target branches