| 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 import copy | 5 import copy |
| 6 import json | 6 import json |
| 7 import logging | 7 import logging |
| 8 | 8 |
| 9 from crash import monitoring |
| 10 |
| 9 from common import appengine_util | 11 from common import appengine_util |
| 10 from common import pubsub_util | 12 from common import pubsub_util |
| 11 from common.http_client_appengine import HttpClientAppengine | 13 from common.http_client_appengine import HttpClientAppengine |
| 12 from common.pipeline_wrapper import BasePipeline | 14 from common.pipeline_wrapper import BasePipeline |
| 13 from common.pipeline_wrapper import pipeline | 15 from common.pipeline_wrapper import pipeline |
| 14 from crash import findit_for_chromecrash | 16 from crash import findit_for_chromecrash |
| 15 from crash import findit_for_clusterfuzz | 17 from crash import findit_for_clusterfuzz |
| 16 from crash.type_enums import CrashClient | 18 from crash.type_enums import CrashClient |
| 17 from lib import time_util | 19 from lib import time_util |
| 18 from lib.gitiles import gitiles_repository | 20 from lib.gitiles import gitiles_repository |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 } | 153 } |
| 152 | 154 |
| 153 # Update model's status to say we're done, and save the results. | 155 # Update model's status to say we're done, and save the results. |
| 154 analysis.completed_time = time_util.GetUTCNow() | 156 analysis.completed_time = time_util.GetUTCNow() |
| 155 analysis.result = result | 157 analysis.result = result |
| 156 for tag_name, tag_value in tags.iteritems(): | 158 for tag_name, tag_value in tags.iteritems(): |
| 157 # TODO(http://crbug.com/602702): make it possible to add arbitrary tags. | 159 # TODO(http://crbug.com/602702): make it possible to add arbitrary tags. |
| 158 # TODO(http://crbug.com/659346): we misplaced the coverage test; find it! | 160 # TODO(http://crbug.com/659346): we misplaced the coverage test; find it! |
| 159 if hasattr(analysis, tag_name): # pragma: no cover | 161 if hasattr(analysis, tag_name): # pragma: no cover |
| 160 setattr(analysis, tag_name, tag_value) | 162 setattr(analysis, tag_name, tag_value) |
| 163 |
| 164 if hasattr(monitoring, tag_name): |
| 165 metric = getattr(monitoring, tag_name) |
| 166 metric.increment({tag_name: tag_value, |
| 167 'client_id': self.client_id}) |
| 168 |
| 161 analysis.status = analysis_status.COMPLETED | 169 analysis.status = analysis_status.COMPLETED |
| 162 analysis.put() | 170 analysis.put() |
| 163 | 171 |
| 164 | 172 |
| 165 class PublishResultPipeline(CrashBasePipeline): | 173 class PublishResultPipeline(CrashBasePipeline): |
| 166 def finalized(self): | 174 def finalized(self): |
| 167 if self.was_aborted: # pragma: no cover. | 175 if self.was_aborted: # pragma: no cover. |
| 168 logging.error('Failed to publish %s analysis result for %s', | 176 logging.error('Failed to publish %s analysis result for %s', |
| 169 repr(self._crash_identifiers), self.client_id) | 177 repr(self._crash_identifiers), self.client_id) |
| 170 | 178 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 N.B., due to the structure of AppEngine pipelines, this method must | 228 N.B., due to the structure of AppEngine pipelines, this method must |
| 221 accept the same arguments as are passed to ``__init__``; however, | 229 accept the same arguments as are passed to ``__init__``; however, |
| 222 because they were already passed to ``__init__`` there's no use in | 230 because they were already passed to ``__init__`` there's no use in |
| 223 recieving them here. Thus, we discard all the arguments to this method | 231 recieving them here. Thus, we discard all the arguments to this method |
| 224 (except for ``self``, naturally). | 232 (except for ``self``, naturally). |
| 225 """ | 233 """ |
| 226 run_analysis = yield CrashAnalysisPipeline( | 234 run_analysis = yield CrashAnalysisPipeline( |
| 227 self._client_id, self._crash_identifiers) | 235 self._client_id, self._crash_identifiers) |
| 228 with pipeline.After(run_analysis): | 236 with pipeline.After(run_analysis): |
| 229 yield PublishResultPipeline(self._client_id, self._crash_identifiers) | 237 yield PublishResultPipeline(self._client_id, self._crash_identifiers) |
| OLD | NEW |