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 import copy | 5 import copy |
| 6 import json | 6 import json |
| 7 import logging | 7 import logging |
| 8 | 8 |
| 9 from common import appengine_util | 9 from common import appengine_util |
| 10 from common import pubsub_util | 10 from common import pubsub_util |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 172 def run(self, *_args, **_kwargs): # pragma: no cover | 172 def run(self, *_args, **_kwargs): # pragma: no cover |
| 173 """Publish the results of our analysis back into the ndb.Model. | 173 """Publish the results of our analysis back into the ndb.Model. |
| 174 | 174 |
| 175 N.B., due to the structure of AppEngine pipelines, this method must | 175 N.B., due to the structure of AppEngine pipelines, this method must |
| 176 accept the same arguments as are passed to ``__init__``; however, | 176 accept the same arguments as are passed to ``__init__``; however, |
| 177 because they were already passed to ``__init__`` there's no use in | 177 because they were already passed to ``__init__`` there's no use in |
| 178 recieving them here. Thus, we discard all the arguments to this method | 178 recieving them here. Thus, we discard all the arguments to this method |
| 179 (except for ``self``, naturally). | 179 (except for ``self``, naturally). |
| 180 """ | 180 """ |
| 181 analysis = self._findit.GetAnalysis(self._crash_identifiers) | 181 analysis = self._findit.GetAnalysis(self._crash_identifiers) |
| 182 if analysis.failed: | |
| 183 logging.info('Analysis of %s failed, abort publishing result to %s', | |
| 184 repr(self._crash_identifiers), self.client_id) | |
|
wrengr
2016/11/22 18:37:49
Since the crash identifiers might be long, I'd rep
Sharu Jiang
2016/11/22 18:58:56
Done.
| |
| 185 return | |
| 186 | |
| 182 result = analysis.ToPublishableResult(self._crash_identifiers) | 187 result = analysis.ToPublishableResult(self._crash_identifiers) |
| 183 messages_data = [json.dumps(result, sort_keys=True)] | 188 messages_data = [json.dumps(result, sort_keys=True)] |
| 184 | 189 |
| 185 # TODO(http://crbug.com/659354): remove Findit's dependency on CrashConfig. | 190 # TODO(http://crbug.com/659354): remove Findit's dependency on CrashConfig. |
| 186 client_config = self._findit.config | 191 client_config = self._findit.config |
| 187 # TODO(katesonia): Clean string uses in config. | 192 # TODO(katesonia): Clean string uses in config. |
| 188 topic = client_config['analysis_result_pubsub_topic'] | 193 topic = client_config['analysis_result_pubsub_topic'] |
| 189 pubsub_util.PublishMessagesToTopic(messages_data, topic) | 194 pubsub_util.PublishMessagesToTopic(messages_data, topic) |
| 190 logging.info('Published %s analysis result for %s', self.client_id, | 195 logging.info('Published %s analysis result for %s', self.client_id, |
| 191 repr(self._crash_identifiers)) | 196 repr(self._crash_identifiers)) |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 215 N.B., due to the structure of AppEngine pipelines, this method must | 220 N.B., due to the structure of AppEngine pipelines, this method must |
| 216 accept the same arguments as are passed to ``__init__``; however, | 221 accept the same arguments as are passed to ``__init__``; however, |
| 217 because they were already passed to ``__init__`` there's no use in | 222 because they were already passed to ``__init__`` there's no use in |
| 218 recieving them here. Thus, we discard all the arguments to this method | 223 recieving them here. Thus, we discard all the arguments to this method |
| 219 (except for ``self``, naturally). | 224 (except for ``self``, naturally). |
| 220 """ | 225 """ |
| 221 run_analysis = yield CrashAnalysisPipeline( | 226 run_analysis = yield CrashAnalysisPipeline( |
| 222 self._client_id, self._crash_identifiers) | 227 self._client_id, self._crash_identifiers) |
| 223 with pipeline.After(run_analysis): | 228 with pipeline.After(run_analysis): |
| 224 yield PublishResultPipeline(self._client_id, self._crash_identifiers) | 229 yield PublishResultPipeline(self._client_id, self._crash_identifiers) |
| OLD | NEW |