| 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 analysis = self._findit.GetAnalysis(self._crash_identifiers) | 113 analysis = self._findit.GetAnalysis(self._crash_identifiers) |
| 114 | 114 |
| 115 # Update the model's status to say we're in the process of doing analysis. | 115 # Update the model's status to say we're in the process of doing analysis. |
| 116 analysis.pipeline_status_path = self.pipeline_status_path() | 116 analysis.pipeline_status_path = self.pipeline_status_path() |
| 117 analysis.status = analysis_status.RUNNING | 117 analysis.status = analysis_status.RUNNING |
| 118 analysis.started_time = time_util.GetUTCNow() | 118 analysis.started_time = time_util.GetUTCNow() |
| 119 analysis.findit_version = appengine_util.GetCurrentVersion() | 119 analysis.findit_version = appengine_util.GetCurrentVersion() |
| 120 analysis.put() | 120 analysis.put() |
| 121 | 121 |
| 122 # Actually do the analysis. | 122 # Actually do the analysis. |
| 123 result, tags = self._findit.FindCulprit(analysis).ToDicts() | 123 culprit = self._findit.FindCulprit(analysis) |
| 124 if culprit is not None: |
| 125 result, tags = culprit.ToDicts() |
| 126 else: |
| 127 result = {'found': False} |
| 128 tags = { |
| 129 'found_suspects': False, |
| 130 'found_project': False, |
| 131 'found_components': False, |
| 132 'has_regression_range': False, |
| 133 'solution': None, |
| 134 } |
| 124 | 135 |
| 125 # Update model's status to say we're done, and save the results. | 136 # Update model's status to say we're done, and save the results. |
| 126 analysis.completed_time = time_util.GetUTCNow() | 137 analysis.completed_time = time_util.GetUTCNow() |
| 127 analysis.result = result | 138 analysis.result = result |
| 128 for tag_name, tag_value in tags.iteritems(): | 139 for tag_name, tag_value in tags.iteritems(): |
| 129 # TODO(http://crbug.com/602702): make it possible to add arbitrary tags. | 140 # TODO(http://crbug.com/602702): make it possible to add arbitrary tags. |
| 130 if hasattr(analysis, tag_name): | 141 if hasattr(analysis, tag_name): |
| 131 setattr(analysis, tag_name, tag_value) | 142 setattr(analysis, tag_name, tag_value) |
| 132 analysis.status = analysis_status.COMPLETED | 143 analysis.status = analysis_status.COMPLETED |
| 133 analysis.put() | 144 analysis.put() |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 self._crash_identifiers = crash_identifiers | 183 self._crash_identifiers = crash_identifiers |
| 173 self._client_id = client_id | 184 self._client_id = client_id |
| 174 | 185 |
| 175 # TODO(http://crbug.com/659346): write coverage tests. | 186 # TODO(http://crbug.com/659346): write coverage tests. |
| 176 # Arguments number differs from overridden method - pylint: disable=W0221 | 187 # Arguments number differs from overridden method - pylint: disable=W0221 |
| 177 def run(self): # pragma: no cover | 188 def run(self): # pragma: no cover |
| 178 run_analysis = yield CrashAnalysisPipeline( | 189 run_analysis = yield CrashAnalysisPipeline( |
| 179 self._client_id, self._crash_identifiers) | 190 self._client_id, self._crash_identifiers) |
| 180 with pipeline.After(run_analysis): | 191 with pipeline.After(run_analysis): |
| 181 yield PublishResultPipeline(self._client_id, self._crash_identifiers) | 192 yield PublishResultPipeline(self._client_id, self._crash_identifiers) |
| OLD | NEW |