OLD | NEW |
---|---|
(Empty) | |
1 # Copyright 2017 The Chromium Authors. All rights reserved. | |
perezju
2017/08/23 08:59:58
nit: nit: I don't know if "parser" is the right wo
dtu
2017/08/24 23:17:52
Done.
| |
2 # Use of this source code is governed by a BSD-style license that can be | |
3 # found in the LICENSE file. | |
4 | |
5 import json | |
6 | |
7 from dashboard.pinpoint.models import quest as quest_module | |
8 | |
9 | |
10 _DEFAULT_REPEAT_COUNT = 20 | |
11 | |
12 _SWARMING_EXTRA_ARGS = ( | |
13 '--isolated-script-test-output', '${ISOLATED_OUTDIR}/output.json', | |
14 '--isolated-script-test-chartjson-output', | |
15 '${ISOLATED_OUTDIR}/chartjson-output.json', | |
16 ) | |
17 | |
18 | |
19 def ParseQuests(request): | |
perezju
2017/08/23 08:59:59
Add some docstring explaining the args it takes an
dtu
2017/08/24 23:17:52
Done.
| |
20 arguments = {} | |
21 quests = [] | |
22 | |
23 quest_arguments, quest = _FindIsolateQuest(request) | |
24 arguments.update(quest_arguments) | |
25 quests.append(quest) | |
26 | |
27 dimensions = request.get('dimensions') | |
28 if not dimensions: | |
29 return arguments, quests | |
perezju
2017/08/23 08:59:59
nit: I think it's clearer the other way around, so
perezju
2017/08/23 09:16:11
I've just seen the other patch that goes on top of
dtu
2017/08/24 23:17:52
Acknowledged.
| |
30 dimensions = json.loads(dimensions) | |
31 arguments['dimensions'] = json.dumps(dimensions) | |
32 | |
33 if arguments['target'] in ('telemetry_perf_tests', | |
34 'telemetry_perf_webview_tests'): | |
35 quest_arguments, quest = _TelemetryRunTestQuest(request, dimensions) | |
36 arguments.update(quest_arguments) | |
37 quests.append(quest) | |
38 | |
39 metric = request.get('metric') | |
40 if not metric: | |
perezju
2017/08/23 08:59:58
nit: Ditto.
dtu
2017/08/24 23:17:52
Acknowledged.
| |
41 return arguments, quests | |
42 arguments['metric'] = metric | |
43 | |
44 quests.append(quest_module.ReadChartJsonValue(metric, request.get('story'))) | |
45 else: | |
46 raise NotImplementedError() | |
47 | |
48 return arguments, quests | |
49 | |
50 | |
51 def _FindIsolateQuest(request): | |
52 arguments = {} | |
53 | |
54 configuration = request.get('configuration') | |
55 if not configuration: | |
56 raise TypeError('Missing "configuration" argument.') | |
57 arguments['configuration'] = configuration | |
58 | |
59 target = request.get('target') | |
60 if not target: | |
61 raise TypeError('Missing "target" argument.') | |
62 arguments['target'] = target | |
63 | |
64 return arguments, quest_module.FindIsolate(configuration, target) | |
65 | |
66 | |
67 def _TelemetryRunTestQuest(request, dimensions): | |
68 arguments = {} | |
69 swarming_extra_args = [] | |
70 | |
71 benchmark = request.get('benchmark') | |
72 if not benchmark: | |
73 raise TypeError('Missing "benchmark" argument.') | |
74 arguments['benchmark'] = benchmark | |
75 swarming_extra_args.append(benchmark) | |
76 | |
77 story = request.get('story') | |
78 if story: | |
79 arguments['story'] = story | |
80 swarming_extra_args += ('--story-filter', story) | |
81 | |
82 repeat_count = request.get('repeat_count') | |
83 if repeat_count: | |
84 arguments['repeat_count'] = repeat_count | |
85 else: | |
86 repeat_count = '20' | |
87 swarming_extra_args += ('--pageset-repeat', repeat_count) | |
88 | |
89 browser = request.get('browser') | |
90 if not browser: | |
91 raise TypeError('Missing "browser" argument.') | |
92 arguments['browser'] = browser | |
93 swarming_extra_args += ('--browser', browser) | |
94 | |
95 swarming_extra_args += ('-v', '--upload-results', | |
96 '--output-format', 'chartjson') | |
97 swarming_extra_args += _SWARMING_EXTRA_ARGS | |
98 | |
99 return arguments, quest_module.RunTest(dimensions, swarming_extra_args) | |
OLD | NEW |