| 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 constants | 10 from common import constants |
| 11 from common import git_repository | |
| 12 from common import pubsub_util | 11 from common import pubsub_util |
| 13 from common import time_util | 12 from common import time_util |
| 14 from common.http_client_appengine import HttpClientAppengine | 13 from common.http_client_appengine import HttpClientAppengine |
| 15 from common.pipeline_wrapper import BasePipeline | 14 from common.pipeline_wrapper import BasePipeline |
| 16 from common.pipeline_wrapper import pipeline | 15 from common.pipeline_wrapper import pipeline |
| 17 from crash import findit_for_chromecrash | 16 from crash import findit_for_chromecrash |
| 18 from crash import findit_for_clusterfuzz | 17 from crash import findit_for_clusterfuzz |
| 19 from crash.type_enums import CrashClient | 18 from crash.type_enums import CrashClient |
| 19 from lib.gitiles import gitiles_repository |
| 20 from model import analysis_status | 20 from model import analysis_status |
| 21 from model.crash.crash_config import CrashConfig | 21 from model.crash.crash_config import CrashConfig |
| 22 | 22 |
| 23 | 23 |
| 24 # TODO(http://crbug.com/659346): write complete coverage tests for this. | 24 # TODO(http://crbug.com/659346): write complete coverage tests for this. |
| 25 def FinditForClientID(client_id): # pragma: no cover | 25 def FinditForClientID(client_id): # pragma: no cover |
| 26 """Construct a Findit object from a client id string specifying the class. | 26 """Construct a Findit object from a client id string specifying the class. |
| 27 | 27 |
| 28 We cannot pass Findit objects to the various methods in | 28 We cannot pass Findit objects to the various methods in |
| 29 |crash.crash_pipeline|, because they are not JSON serializable. For now, | 29 |crash.crash_pipeline|, because they are not JSON serializable. For now, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 45 cls = findit_for_chromecrash.FinditForFracas | 45 cls = findit_for_chromecrash.FinditForFracas |
| 46 elif client_id == CrashClient.CRACAS: | 46 elif client_id == CrashClient.CRACAS: |
| 47 cls = findit_for_chromecrash.FinditForCracas | 47 cls = findit_for_chromecrash.FinditForCracas |
| 48 elif client_id == CrashClient.CLUSTERFUZZ: | 48 elif client_id == CrashClient.CLUSTERFUZZ: |
| 49 cls = findit_for_clusterfuzz.FinditForClusterfuzz | 49 cls = findit_for_clusterfuzz.FinditForClusterfuzz |
| 50 else: | 50 else: |
| 51 raise ValueError('FinditForClientID: ' | 51 raise ValueError('FinditForClientID: ' |
| 52 'unknown or unsupported client %s' % client_id) | 52 'unknown or unsupported client %s' % client_id) |
| 53 | 53 |
| 54 return cls( | 54 return cls( |
| 55 git_repository.GitRepository(http_client=HttpClientAppengine()), | 55 gitiles_repository.GitilesRepository(http_client=HttpClientAppengine()), |
| 56 CrashWrapperPipeline) | 56 CrashWrapperPipeline) |
| 57 | 57 |
| 58 | 58 |
| 59 # Some notes about the classes below, for people who are not | 59 # Some notes about the classes below, for people who are not |
| 60 # familiar with AppEngine. The thing that really kicks everything off | 60 # familiar with AppEngine. The thing that really kicks everything off |
| 61 # is |CrashWrapperPipeline.run|. However, an important thing to bear in | 61 # is |CrashWrapperPipeline.run|. However, an important thing to bear in |
| 62 # mind is that whatever arguments are passed to that method will also | 62 # mind is that whatever arguments are passed to that method will also |
| 63 # be passed to the |run| method on whatever objects it yields. Thus, | 63 # be passed to the |run| method on whatever objects it yields. Thus, |
| 64 # all the |run| methods across these different classes must have the same | 64 # all the |run| methods across these different classes must have the same |
| 65 # type. In practice, we end up passing all the arguments to the | 65 # type. In practice, we end up passing all the arguments to the |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 self._crash_identifiers = crash_identifiers | 173 self._crash_identifiers = crash_identifiers |
| 174 self._client_id = client_id | 174 self._client_id = client_id |
| 175 | 175 |
| 176 # TODO(http://crbug.com/659346): write coverage tests. | 176 # TODO(http://crbug.com/659346): write coverage tests. |
| 177 # Arguments number differs from overridden method - pylint: disable=W0221 | 177 # Arguments number differs from overridden method - pylint: disable=W0221 |
| 178 def run(self): # pragma: no cover | 178 def run(self): # pragma: no cover |
| 179 run_analysis = yield CrashAnalysisPipeline( | 179 run_analysis = yield CrashAnalysisPipeline( |
| 180 self._client_id, self._crash_identifiers) | 180 self._client_id, self._crash_identifiers) |
| 181 with pipeline.After(run_analysis): | 181 with pipeline.After(run_analysis): |
| 182 yield PublishResultPipeline(self._client_id, self._crash_identifiers) | 182 yield PublishResultPipeline(self._client_id, self._crash_identifiers) |
| OLD | NEW |