Chromium Code Reviews| 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 |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 38 | 38 |
| 39 class _FindIsolateExecution(execution.Execution): | 39 class _FindIsolateExecution(execution.Execution): |
| 40 | 40 |
| 41 def __init__(self, builder_name, target, change): | 41 def __init__(self, builder_name, target, change): |
| 42 super(_FindIsolateExecution, self).__init__() | 42 super(_FindIsolateExecution, self).__init__() |
| 43 self._builder_name = builder_name | 43 self._builder_name = builder_name |
| 44 self._target = target | 44 self._target = target |
| 45 self._change = change | 45 self._change = change |
| 46 self._build = None | 46 self._build = None |
| 47 | 47 |
| 48 def _AsDict(self): | |
| 49 return { | |
| 50 'build': self._build or '', | |
|
perezju
2017/08/22 09:49:48
nit: maybe it's fine to return None if the build i
| |
| 51 } | |
| 52 | |
| 48 def _Poll(self): | 53 def _Poll(self): |
| 49 # Look for the .isolate in our cache. | 54 # Look for the .isolate in our cache. |
| 50 try: | 55 try: |
| 51 isolate_hash = isolate.Get(self._builder_name, self._change, self._target) | 56 isolate_hash = isolate.Get(self._builder_name, self._change, self._target) |
| 52 except KeyError: | 57 except KeyError: |
| 53 isolate_hash = None | 58 isolate_hash = None |
| 54 | 59 |
| 55 if isolate_hash: | 60 if isolate_hash: |
| 56 self._Complete(result_arguments={'isolate_hash': isolate_hash}) | 61 self._Complete( |
| 62 result_arguments={'isolate_hash': isolate_hash}) | |
| 57 return | 63 return |
| 58 | 64 |
| 59 # Check the status of a previously requested build. | 65 # Check the status of a previously requested build. |
| 60 if self._build: | 66 if self._build: |
| 61 status = buildbucket_service.GetJobStatus(self._build) | 67 status = buildbucket_service.GetJobStatus(self._build) |
| 62 | 68 |
| 63 if status['build']['status'] != 'COMPLETED': | 69 if status['build']['status'] != 'COMPLETED': |
| 64 return | 70 return |
| 65 | 71 |
| 66 if status['build']['result'] == 'FAILURE': | 72 if status['build']['result'] == 'FAILURE': |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 126 # https://github.com/catapult-project/catapult/issues/3599 | 132 # https://github.com/catapult-project/catapult/issues/3599 |
| 127 parameters['properties'].update({ | 133 parameters['properties'].update({ |
| 128 'patch_storage': 'rietveld', | 134 'patch_storage': 'rietveld', |
| 129 'rietveld': change.patch.server, | 135 'rietveld': change.patch.server, |
| 130 'issue': change.patch.issue, | 136 'issue': change.patch.issue, |
| 131 'patchset': change.patch.patchset, | 137 'patchset': change.patch.patchset, |
| 132 }) | 138 }) |
| 133 | 139 |
| 134 # TODO: Look up Buildbucket bucket from builder_name. | 140 # TODO: Look up Buildbucket bucket from builder_name. |
| 135 return buildbucket_service.Put(BUCKET, parameters) | 141 return buildbucket_service.Put(BUCKET, parameters) |
| OLD | NEW |