Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: appengine/findit/crash/crash_pipeline.py

Issue 2523343002: [Predator] Refactor ToPublishResult and fix keyerror 'found' (Closed)
Patch Set: Rebase. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | appengine/findit/crash/findit.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 9 from crash import monitoring
10 10
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 def run(self, *_args, **_kwargs): # pragma: no cover 180 def run(self, *_args, **_kwargs): # pragma: no cover
181 """Publish the results of our analysis back into the ndb.Model. 181 """Publish the results of our analysis back into the ndb.Model.
182 182
183 N.B., due to the structure of AppEngine pipelines, this method must 183 N.B., due to the structure of AppEngine pipelines, this method must
184 accept the same arguments as are passed to ``__init__``; however, 184 accept the same arguments as are passed to ``__init__``; however,
185 because they were already passed to ``__init__`` there's no use in 185 because they were already passed to ``__init__`` there's no use in
186 recieving them here. Thus, we discard all the arguments to this method 186 recieving them here. Thus, we discard all the arguments to this method
187 (except for ``self``, naturally). 187 (except for ``self``, naturally).
188 """ 188 """
189 analysis = self._findit.GetAnalysis(self._crash_identifiers) 189 analysis = self._findit.GetAnalysis(self._crash_identifiers)
190 if analysis.failed: 190 if not analysis or not analysis.result or analysis.failed:
191 logging.info('Can\'t publish result to %s because analysis failed:\n%s', 191 logging.info('Can\'t publish result to %s because analysis failed:\n%s',
192 self.client_id, repr(self._crash_identifiers)) 192 self.client_id, repr(self._crash_identifiers))
193 return 193 return
194 194
195 result = analysis.ToPublishableResult(self._crash_identifiers) 195 result = self._findit.GetPublishableResult(self._crash_identifiers,
196 analysis)
196 messages_data = [json.dumps(result, sort_keys=True)] 197 messages_data = [json.dumps(result, sort_keys=True)]
197 198
198 # TODO(http://crbug.com/659354): remove Findit's dependency on CrashConfig. 199 # TODO(http://crbug.com/659354): remove Findit's dependency on CrashConfig.
199 client_config = self._findit.config 200 client_config = self._findit.config
200 # TODO(katesonia): Clean string uses in config. 201 # TODO(katesonia): Clean string uses in config.
201 topic = client_config['analysis_result_pubsub_topic'] 202 topic = client_config['analysis_result_pubsub_topic']
202 pubsub_util.PublishMessagesToTopic(messages_data, topic) 203 pubsub_util.PublishMessagesToTopic(messages_data, topic)
203 logging.info('Published %s analysis result for %s', self.client_id, 204 logging.info('Published %s analysis result for %s', self.client_id,
204 repr(self._crash_identifiers)) 205 repr(self._crash_identifiers))
205 206
(...skipping 22 matching lines...) Expand all
228 N.B., due to the structure of AppEngine pipelines, this method must 229 N.B., due to the structure of AppEngine pipelines, this method must
229 accept the same arguments as are passed to ``__init__``; however, 230 accept the same arguments as are passed to ``__init__``; however,
230 because they were already passed to ``__init__`` there's no use in 231 because they were already passed to ``__init__`` there's no use in
231 recieving them here. Thus, we discard all the arguments to this method 232 recieving them here. Thus, we discard all the arguments to this method
232 (except for ``self``, naturally). 233 (except for ``self``, naturally).
233 """ 234 """
234 run_analysis = yield CrashAnalysisPipeline( 235 run_analysis = yield CrashAnalysisPipeline(
235 self._client_id, self._crash_identifiers) 236 self._client_id, self._crash_identifiers)
236 with pipeline.After(run_analysis): 237 with pipeline.After(run_analysis):
237 yield PublishResultPipeline(self._client_id, self._crash_identifiers) 238 yield PublishResultPipeline(self._client_id, self._crash_identifiers)
OLDNEW
« no previous file with comments | « no previous file | appengine/findit/crash/findit.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698