| 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): | 20 def __init__(self, configuration, target): |
| 21 self._builder_name = _BuilderNameForConfiguration(configuration) | 21 self._builder_name = _BuilderNameForConfiguration(configuration) |
| 22 self._target = target |
| 22 | 23 |
| 23 def __eq__(self, other): | 24 def __eq__(self, other): |
| 24 return (isinstance(other, type(self)) and | 25 return (isinstance(other, type(self)) and |
| 25 self._builder_name == other._builder_name) | 26 self._builder_name == other._builder_name) |
| 26 | 27 |
| 27 def __str__(self): | 28 def __str__(self): |
| 28 return 'Build on ' + self._builder_name | 29 return 'Build on ' + self._builder_name |
| 29 | 30 |
| 30 @property | 31 @property |
| 31 def retry_count(self): | 32 def retry_count(self): |
| 32 return 1 | 33 return 1 |
| 33 | 34 |
| 34 def Start(self, change): | 35 def Start(self, change): |
| 35 return _FindIsolateExecution(self._builder_name, change) | 36 return _FindIsolateExecution(self._builder_name, self._target, change) |
| 36 | 37 |
| 37 | 38 |
| 38 class _FindIsolateExecution(execution.Execution): | 39 class _FindIsolateExecution(execution.Execution): |
| 39 | 40 |
| 40 def __init__(self, builder_name, change): | 41 def __init__(self, builder_name, target, change): |
| 41 super(_FindIsolateExecution, self).__init__() | 42 super(_FindIsolateExecution, self).__init__() |
| 42 self._builder_name = builder_name | 43 self._builder_name = builder_name |
| 44 self._target = target |
| 43 self._change = change | 45 self._change = change |
| 44 self._build = None | 46 self._build = None |
| 45 | 47 |
| 46 def _Poll(self): | 48 def _Poll(self): |
| 47 # Look for the .isolate in our cache. | 49 # Look for the .isolate in our cache. |
| 48 # TODO: Support other isolate targets. | |
| 49 target = 'telemetry_perf_tests' | |
| 50 try: | 50 try: |
| 51 isolate_hash = isolate.Get(self._builder_name, self._change, target) | 51 isolate_hash = isolate.Get(self._builder_name, self._change, self._target) |
| 52 except KeyError: | 52 except KeyError: |
| 53 isolate_hash = None | 53 isolate_hash = None |
| 54 | 54 |
| 55 if isolate_hash: | 55 if isolate_hash: |
| 56 self._Complete(result_arguments={'isolate_hash': isolate_hash}) | 56 self._Complete(result_arguments={'isolate_hash': isolate_hash}) |
| 57 return | 57 return |
| 58 | 58 |
| 59 # Check the status of a previously requested build. | 59 # Check the status of a previously requested build. |
| 60 if self._build: | 60 if self._build: |
| 61 status = buildbucket_service.GetJobStatus(self._build) | 61 status = buildbucket_service.GetJobStatus(self._build) |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 # https://github.com/catapult-project/catapult/issues/3599 | 126 # https://github.com/catapult-project/catapult/issues/3599 |
| 127 parameters['properties'].update({ | 127 parameters['properties'].update({ |
| 128 'patch_storage': 'rietveld', | 128 'patch_storage': 'rietveld', |
| 129 'rietveld': change.patch.server, | 129 'rietveld': change.patch.server, |
| 130 'issue': change.patch.issue, | 130 'issue': change.patch.issue, |
| 131 'patchset': change.patch.patchset, | 131 'patchset': change.patch.patchset, |
| 132 }) | 132 }) |
| 133 | 133 |
| 134 # TODO: Look up Buildbucket bucket from builder_name. | 134 # TODO: Look up Buildbucket bucket from builder_name. |
| 135 return buildbucket_service.Put(BUCKET, parameters) | 135 return buildbucket_service.Put(BUCKET, parameters) |
| OLD | NEW |