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

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

Issue 2523343002: [Predator] Refactor ToPublishResult and fix keyerror 'found' (Closed)
Patch Set: . 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
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 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
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: 182 if analysis.failed or not analysis.result:
183 logging.info('Can\'t publish result to %s because analysis failed:\n%s', 183 logging.info('Can\'t publish result to %s because analysis failed:\n%s',
184 self.client_id, repr(self._crash_identifiers)) 184 self.client_id, repr(self._crash_identifiers))
185 return 185 return
186 186
187 result = analysis.ToPublishableResult(self._crash_identifiers) 187 result = analysis.ToPublishableResult(self._crash_identifiers)
188 messages_data = [json.dumps(result, sort_keys=True)] 188 messages_data = [json.dumps(result, sort_keys=True)]
189 189
190 # TODO(http://crbug.com/659354): remove Findit's dependency on CrashConfig. 190 # TODO(http://crbug.com/659354): remove Findit's dependency on CrashConfig.
191 client_config = self._findit.config 191 client_config = self._findit.config
192 # TODO(katesonia): Clean string uses in config. 192 # TODO(katesonia): Clean string uses in config.
(...skipping 27 matching lines...) Expand all
220 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
221 accept the same arguments as are passed to ``__init__``; however, 221 accept the same arguments as are passed to ``__init__``; however,
222 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
223 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
224 (except for ``self``, naturally). 224 (except for ``self``, naturally).
225 """ 225 """
226 run_analysis = yield CrashAnalysisPipeline( 226 run_analysis = yield CrashAnalysisPipeline(
227 self._client_id, self._crash_identifiers) 227 self._client_id, self._crash_identifiers)
228 with pipeline.After(run_analysis): 228 with pipeline.After(run_analysis):
229 yield PublishResultPipeline(self._client_id, self._crash_identifiers) 229 yield PublishResultPipeline(self._client_id, self._crash_identifiers)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698