| 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 google.appengine.api import app_identity | 9 from google.appengine.api import app_identity |
| 10 from google.appengine.ext import ndb | 10 from google.appengine.ext import ndb |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 logging.info('The analysis of %s has already been done.', | 115 logging.info('The analysis of %s has already been done.', |
| 116 repr(crash_identifiers)) | 116 repr(crash_identifiers)) |
| 117 return False | 117 return False |
| 118 | 118 |
| 119 # Create analysis for findit to run if this is not a rerun. | 119 # Create analysis for findit to run if this is not a rerun. |
| 120 if not analysis: | 120 if not analysis: |
| 121 analysis = findit_for_client.CreateAnalysisForClient(crash_identifiers, | 121 analysis = findit_for_client.CreateAnalysisForClient(crash_identifiers, |
| 122 client_id) | 122 client_id) |
| 123 | 123 |
| 124 findit_for_client.ResetAnalysis(analysis, chrome_version, signature, | 124 findit_for_client.ResetAnalysis(analysis, chrome_version, signature, |
| 125 client_id, platform, stack_trace, | 125 client_id, platform, stack_trace, |
| 126 customized_data) | 126 customized_data) |
| 127 return True | 127 return True |
| 128 | 128 |
| 129 | 129 |
| 130 def ScheduleNewAnalysisForCrash( | 130 def ScheduleNewAnalysisForCrash( |
| 131 crash_identifiers, chrome_version, signature, client_id, | 131 crash_identifiers, chrome_version, signature, client_id, |
| 132 platform, stack_trace, customized_data, | 132 platform, stack_trace, customized_data, |
| 133 queue_name=constants.DEFAULT_QUEUE): | 133 queue_name=constants.DEFAULT_QUEUE): |
| 134 """Schedules an analysis.""" | 134 """Schedules an analysis.""" |
| 135 # Check policy and tune arguments if needed. | 135 # Check policy and tune arguments if needed. |
| 136 pass_policy, updated_analysis_args = findit_for_client.CheckPolicyForClient( | 136 pass_policy, updated_analysis_args = findit_for_client.CheckPolicyForClient( |
| 137 crash_identifiers, chrome_version, signature, | 137 crash_identifiers, chrome_version, signature, |
| 138 client_id, platform, stack_trace, | 138 client_id, platform, stack_trace, |
| 139 customized_data) | 139 customized_data) |
| 140 | 140 |
| 141 if not pass_policy: | 141 if not pass_policy: |
| 142 return False | 142 return False |
| 143 | 143 |
| 144 if _NeedsNewAnalysis(*updated_analysis_args): | 144 if _NeedsNewAnalysis(*updated_analysis_args): |
| 145 analysis_pipeline = CrashWrapperPipeline(crash_identifiers, client_id) | 145 analysis_pipeline = CrashWrapperPipeline(crash_identifiers, client_id) |
| 146 # Attribute defined outside __init__ - pylint: disable=W0201 | 146 # Attribute defined outside __init__ - pylint: disable=W0201 |
| 147 analysis_pipeline.target = appengine_util.GetTargetNameForModule( | 147 analysis_pipeline.target = appengine_util.GetTargetNameForModule( |
| 148 constants.CRASH_BACKEND[client_id]) | 148 constants.CRASH_BACKEND[client_id]) |
| 149 analysis_pipeline.start(queue_name=queue_name) | 149 analysis_pipeline.start(queue_name=queue_name) |
| 150 logging.info('New %s analysis is scheduled for %s', client_id, | 150 logging.info('New %s analysis is scheduled for %s', client_id, |
| 151 repr(crash_identifiers)) | 151 repr(crash_identifiers)) |
| 152 return True | 152 return True |
| 153 | 153 |
| 154 return False | 154 return False |
| OLD | NEW |