OLD | NEW |
1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 from dashboard.pinpoint.models import isolate | 5 from dashboard.pinpoint.models import isolate |
6 from dashboard.pinpoint.models.quest import execution | 6 from dashboard.pinpoint.models.quest import execution |
7 from dashboard.pinpoint.models.quest import quest | 7 from dashboard.pinpoint.models.quest import quest |
8 from dashboard.services import buildbucket_service | 8 from dashboard.services import buildbucket_service |
9 | 9 |
10 | 10 |
11 BUCKET = 'master.tryserver.chromium.perf' | 11 BUCKET = 'master.tryserver.chromium.perf' |
12 | 12 |
13 | 13 |
14 class BuildError(Exception): | 14 class BuildError(Exception): |
15 """Raised when the build fails.""" | 15 """Raised when the build fails.""" |
16 | 16 |
17 | 17 |
18 class FindIsolate(quest.Quest): | 18 class FindIsolate(quest.Quest): |
19 | 19 |
20 def __init__(self, configuration, target): | 20 def __init__(self, configuration, target): |
21 self._builder_name = _BuilderNameForConfiguration(configuration) | 21 self._builder_name = _BuilderNameForConfiguration(configuration) |
22 self._target = target | 22 self._target = target |
23 | 23 |
| 24 self._previous_builds = {} |
| 25 |
24 def __eq__(self, other): | 26 def __eq__(self, other): |
25 return (isinstance(other, type(self)) and | 27 return (isinstance(other, type(self)) and |
26 self._builder_name == other._builder_name) | 28 self._builder_name == other._builder_name) |
27 | 29 |
28 def __str__(self): | 30 def __str__(self): |
29 return 'Build' | 31 return 'Build' |
30 | 32 |
31 def Start(self, change): | 33 def Start(self, change): |
32 return _FindIsolateExecution(self._builder_name, self._target, change) | 34 return _FindIsolateExecution(self._builder_name, self._target, change, |
| 35 self._previous_builds) |
33 | 36 |
34 | 37 |
35 class _FindIsolateExecution(execution.Execution): | 38 class _FindIsolateExecution(execution.Execution): |
36 | 39 |
37 _previous_builds = {} | 40 def __init__(self, builder_name, target, change, previous_builds): |
38 | |
39 def __init__(self, builder_name, target, change): | |
40 super(_FindIsolateExecution, self).__init__() | 41 super(_FindIsolateExecution, self).__init__() |
41 self._builder_name = builder_name | 42 self._builder_name = builder_name |
42 self._target = target | 43 self._target = target |
43 self._change = change | 44 self._change = change |
| 45 # previous_builds is shared among all Executions of the same Quest. |
| 46 self._previous_builds = previous_builds |
| 47 |
44 self._build = None | 48 self._build = None |
45 | 49 |
46 def _AsDict(self): | 50 def _AsDict(self): |
47 return { | 51 return { |
48 'build': self._build, | 52 'build': self._build, |
49 } | 53 } |
50 | 54 |
51 def _Poll(self): | 55 def _Poll(self): |
52 if self._CheckCompleted(): | 56 if self._CheckCompleted(): |
53 return | 57 return |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 # https://github.com/catapult-project/catapult/issues/3599 | 159 # https://github.com/catapult-project/catapult/issues/3599 |
156 parameters['properties'].update({ | 160 parameters['properties'].update({ |
157 'patch_storage': 'rietveld', | 161 'patch_storage': 'rietveld', |
158 'rietveld': change.patch.server, | 162 'rietveld': change.patch.server, |
159 'issue': change.patch.issue, | 163 'issue': change.patch.issue, |
160 'patchset': change.patch.patchset, | 164 'patchset': change.patch.patchset, |
161 }) | 165 }) |
162 | 166 |
163 # TODO: Look up Buildbucket bucket from builder_name. | 167 # TODO: Look up Buildbucket bucket from builder_name. |
164 return buildbucket_service.Put(BUCKET, parameters) | 168 return buildbucket_service.Put(BUCKET, parameters) |
OLD | NEW |