~linaro-graphics-wg/linaro-graphics-dashboard/trunk

« back to all changes in this revision

Viewing changes to linaro_graphics_app/views/util.py

  • Committer: Alexandros Frantzis
  • Date: 2012-07-10 13:22:19 UTC
  • Revision ID: alexandros.frantzis@linaro.org-20120710132219-e46a2tsju0to319p
util: Add support for harvesting data from Android daily runs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
import sys
4
4
import time
5
5
 
 
6
from django.db.models import Q
 
7
 
6
8
DAILY_STREAM = "/private/team/linaro/linaro-gfx-daily/"
 
9
DAILY_STREAM_ANDROID = "/private/team/linaro/android-daily/"
7
10
BOARD_LIST = ["panda", "snowball", "origen"]
8
11
TEST_MODULE_PREFIX = "linaro_graphics_app.views."
9
12
 
10
13
def get_test_run_query(test_id, board_name, session, days):
11
 
    q = TestRun.objects.filter(
12
 
            bundle__bundle_stream__pathname = DAILY_STREAM,
13
 
            test__test_id__endswith = test_id,
 
14
    if board_name == "snowball":
 
15
        board_name = "snowball_sd"
 
16
 
 
17
    android_names = {
 
18
            "panda": "linaro-android_panda-ics-gcc47-tilt-stable-blob",
 
19
            "snowball_sd": "linaro-android_snowball-ics-gcc46-igloo-stable-blob",
 
20
            "origen": "linaro-android_origen-ics-gcc47-samsunglt-stable-blob"
 
21
            }
 
22
 
 
23
    android_name = android_names[board_name]
 
24
 
 
25
    test_id_android = test_id
 
26
    if test_id_android == "glmark2_es2":
 
27
        test_id_android = "glmark2"
 
28
 
 
29
    q_common = Q(
14
30
            analyzer_assigned_date__gt = datetime.datetime.now() -
15
31
                                         datetime.timedelta(days=days),
16
32
            attributes__name = "target.device_type",
17
33
            attributes__value = board_name)
18
34
 
19
 
    if session is not None:
20
 
        q.filter(attributes__name = "gfx.session",
21
 
                 attributes__value = session)
22
 
 
23
 
    return q.order_by("analyzer_assigned_date")
 
35
    q_x11 = Q(
 
36
            bundle__bundle_stream__pathname = DAILY_STREAM,
 
37
            test__test_id__endswith = test_id)
 
38
 
 
39
    q_android = Q(
 
40
            bundle__bundle_stream__pathname = DAILY_STREAM_ANDROID,
 
41
            attributes__name = "android.name",
 
42
            attributes__value = android_name,
 
43
            test__test_id__endswith = test_id_android)
 
44
 
 
45
    q_session = Q(
 
46
            attributes__name = "gfx.session",
 
47
            attributes__value = session)
 
48
 
 
49
    q = None
 
50
 
 
51
    if session is None:
 
52
        q = (q_x11 | q_android)
 
53
    elif session is not None:
 
54
        if session.startswith("android"):
 
55
            q = q_android
 
56
        else:
 
57
            q = (q_x11 & q_session)
 
58
 
 
59
    return TestRun.objects.filter(q_common).filter(q).distinct().order_by("analyzer_assigned_date")
24
60
 
25
61
def get_test_runs_around(test_id, board_name, session, days, run_time):
26
62
    # Get the test runs for the range specified
105
141
    try:
106
142
        test_run_session = test_run.attributes.get(name="gfx.session").value
107
143
    except:
108
 
        pass
 
144
        try:
 
145
            android_name = test_run.attributes.get(name="android.name").value
 
146
            if android_name.find("-stable") != -1:
 
147
                test_run_session = "android-stable"
 
148
            elif android_name.find("-tracking") != -1:
 
149
                test_run_session = "android-tracking"
 
150
        except:
 
151
            test_run_session = "default"
109
152
 
110
153
    return test_run_session