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 |
| 11 from common import time_util | |
| 12 from common.http_client_appengine import HttpClientAppengine | 11 from common.http_client_appengine import HttpClientAppengine |
| 13 from common.pipeline_wrapper import BasePipeline | 12 from common.pipeline_wrapper import BasePipeline |
| 14 from common.pipeline_wrapper import pipeline | 13 from common.pipeline_wrapper import pipeline |
| 15 from crash import findit_for_chromecrash | 14 from crash import findit_for_chromecrash |
| 16 from crash import findit_for_clusterfuzz | 15 from crash import findit_for_clusterfuzz |
| 17 from crash.type_enums import CrashClient | 16 from crash.type_enums import CrashClient |
| 17 from lib import time_util | |
| 18 from lib.gitiles import gitiles_repository | 18 from lib.gitiles import gitiles_repository |
| 19 from model import analysis_status | 19 from model import analysis_status |
| 20 | 20 |
| 21 | 21 |
| 22 # TODO(http://crbug.com/659346): this needs complete coverage tests. | 22 # TODO(http://crbug.com/659346): this needs complete coverage tests. |
| 23 def FinditForClientID(client_id): | 23 def FinditForClientID(client_id): |
| 24 """Construct a Findit object from a client id string specifying the class. | 24 """Construct a Findit object from a client id string specifying the class. |
| 25 | 25 |
| 26 We cannot pass Findit objects to the various methods in | 26 We cannot pass Findit objects to the various methods in |
| 27 ``crash.crash_pipeline``, because they are not JSON serializable. For | 27 ``crash.crash_pipeline``, because they are not JSON serializable. For |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 # N.B., this method must be factored out for unittest reasons; since | 108 # N.B., this method must be factored out for unittest reasons; since |
| 109 # ``finalized`` takes no arguments (by AppEngine's spec) and | 109 # ``finalized`` takes no arguments (by AppEngine's spec) and |
| 110 # ``was_aborted`` can't be altered directly. | 110 # ``was_aborted`` can't be altered directly. |
| 111 def _PutAbortedError(self): | 111 def _PutAbortedError(self): |
| 112 """Update the ndb.Model to indicate that this pipeline was aborted.""" | 112 """Update the ndb.Model to indicate that this pipeline was aborted.""" |
| 113 logging.error('Aborted analysis for %s', repr(self._crash_identifiers)) | 113 logging.error('Aborted analysis for %s', repr(self._crash_identifiers)) |
| 114 analysis = self._findit.GetAnalysis(self._crash_identifiers) | 114 analysis = self._findit.GetAnalysis(self._crash_identifiers) |
| 115 analysis.status = analysis_status.ERROR | 115 analysis.status = analysis_status.ERROR |
| 116 analysis.put() | 116 analysis.put() |
| 117 | 117 |
| 118 def run(self, *_args, **_kwargs): | 118 # TODO(http://crbug.com/659346): we misplaced the coverage test; find it! |
| 119 # Arguments number differs from overridden method - pylint: disable=W0221 | |
| 120 def run(self, *_args, **_kargs): | |
|
stgao
2016/11/03 22:14:05
nit: _kwargs
Sharu Jiang
2016/11/04 01:02:35
Done.
| |
| 119 """Call predator to do the analysis of the given crash. | 121 """Call predator to do the analysis of the given crash. |
| 120 | 122 |
| 121 N.B., due to the structure of AppEngine pipelines, this method must | 123 N.B., due to the structure of AppEngine pipelines, this method must |
| 122 accept the same arguments as are passed to ``__init__``; however, | 124 accept the same arguments as are passed to ``__init__``; however, |
| 123 because they were already passed to ``__init__`` there's no use in | 125 because they were already passed to ``__init__`` there's no use in |
| 124 recieving them here. Thus, we discard all the arguments to this method | 126 recieving them here. Thus, we discard all the arguments to this method |
| 125 (except for ``self``, naturally). | 127 (except for ``self``, naturally). |
| 126 """ | 128 """ |
| 127 # TODO(wrengr): shouldn't this method somehow call _NeedsNewAnalysis | 129 # TODO(wrengr): shouldn't this method somehow call _NeedsNewAnalysis |
| 128 # to guard against race conditions? | 130 # to guard against race conditions? |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 214 N.B., due to the structure of AppEngine pipelines, this method must | 216 N.B., due to the structure of AppEngine pipelines, this method must |
| 215 accept the same arguments as are passed to ``__init__``; however, | 217 accept the same arguments as are passed to ``__init__``; however, |
| 216 because they were already passed to ``__init__`` there's no use in | 218 because they were already passed to ``__init__`` there's no use in |
| 217 recieving them here. Thus, we discard all the arguments to this method | 219 recieving them here. Thus, we discard all the arguments to this method |
| 218 (except for ``self``, naturally). | 220 (except for ``self``, naturally). |
| 219 """ | 221 """ |
| 220 run_analysis = yield CrashAnalysisPipeline( | 222 run_analysis = yield CrashAnalysisPipeline( |
| 221 self._client_id, self._crash_identifiers) | 223 self._client_id, self._crash_identifiers) |
| 222 with pipeline.After(run_analysis): | 224 with pipeline.After(run_analysis): |
| 223 yield PublishResultPipeline(self._client_id, self._crash_identifiers) | 225 yield PublishResultPipeline(self._client_id, self._crash_identifiers) |
| OLD | NEW |