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

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

Issue 2043973002: [Findit] Fracas crash triage dashboard (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Surpass pylint errors. Created 4 years, 5 months 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
« no previous file with comments | « appengine/findit/crash/fracas.py ('k') | appengine/findit/crash/test/fracas_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 base64 5 import base64
6 import datetime 6 import datetime
7 import json 7 import json
8 import logging 8 import logging
9 9
10 from google.appengine.ext import ndb 10 from google.appengine.ext import ndb
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 # Update analysis status. 54 # Update analysis status.
55 analysis.pipeline_status_path = self.pipeline_status_path() 55 analysis.pipeline_status_path = self.pipeline_status_path()
56 analysis.status = analysis_status.RUNNING 56 analysis.status = analysis_status.RUNNING
57 analysis.started_time = datetime.datetime.utcnow() 57 analysis.started_time = datetime.datetime.utcnow()
58 analysis.findit_version = appengine_util.GetCurrentVersion() 58 analysis.findit_version = appengine_util.GetCurrentVersion()
59 analysis.put() 59 analysis.put()
60 60
61 # Run the analysis. 61 # Run the analysis.
62 result, tags = fracas.FindCulpritForChromeCrash( 62 result, tags = fracas.FindCulpritForChromeCrash(
63 analysis.signature, analysis.platform, analysis.stack_trace, 63 analysis.signature, analysis.platform, analysis.stack_trace,
64 analysis.crashed_version, analysis.historic_metadata) 64 analysis.crashed_version, analysis.historical_metadata)
65 65
66 # Update analysis status and save the analysis result. 66 # Update analysis status and save the analysis result.
67 analysis.completed_time = datetime.datetime.utcnow() 67 analysis.completed_time = datetime.datetime.utcnow()
68 analysis.result = result 68 analysis.result = result
69 for tag_name, tag_value in tags.iteritems(): 69 for tag_name, tag_value in tags.iteritems():
70 # TODO(http://crbug.com/602702): make it possible to add arbitrary tags. 70 # TODO(http://crbug.com/602702): make it possible to add arbitrary tags.
71 if hasattr(analysis, tag_name): 71 if hasattr(analysis, tag_name):
72 setattr(analysis, tag_name, tag_value) 72 setattr(analysis, tag_name, tag_value)
73 analysis.status = analysis_status.COMPLETED 73 analysis.status = analysis_status.COMPLETED
74 analysis.put() 74 analysis.put()
(...skipping 25 matching lines...) Expand all
100 # Arguments number differs from overridden method - pylint: disable=W0221 100 # Arguments number differs from overridden method - pylint: disable=W0221
101 def run(self, crash_identifiers): 101 def run(self, crash_identifiers):
102 run_analysis = yield FracasAnalysisPipeline(crash_identifiers) 102 run_analysis = yield FracasAnalysisPipeline(crash_identifiers)
103 with pipeline.After(run_analysis): 103 with pipeline.After(run_analysis):
104 yield PublishResultPipeline(crash_identifiers) 104 yield PublishResultPipeline(crash_identifiers)
105 105
106 106
107 @ndb.transactional 107 @ndb.transactional
108 def _NeedsNewAnalysis( 108 def _NeedsNewAnalysis(
109 crash_identifiers, chrome_version, signature, client_id, 109 crash_identifiers, chrome_version, signature, client_id,
110 platform, stack_trace, channel, historic_metadata): 110 platform, stack_trace, channel, historical_metadata):
111 analysis = FracasCrashAnalysis.Get(crash_identifiers) 111 analysis = FracasCrashAnalysis.Get(crash_identifiers)
112 if analysis and not analysis.failed: 112 if analysis and not analysis.failed:
113 # A new analysis is not needed if last one didn't complete or succeeded. 113 # A new analysis is not needed if last one didn't complete or succeeded.
114 # TODO(http://crbug.com/600535): re-analyze if stack trace or regression 114 # TODO(http://crbug.com/600535): re-analyze if stack trace or regression
115 # range changed. 115 # range changed.
116 logging.info('The analysis of %s has already been done.', 116 logging.info('The analysis of %s has already been done.',
117 repr(crash_identifiers)) 117 repr(crash_identifiers))
118 return False 118 return False
119 119
120 if not analysis: 120 if not analysis:
121 # A new analysis is needed if there is no analysis yet. 121 # A new analysis is needed if there is no analysis yet.
122 analysis = FracasCrashAnalysis.Create(crash_identifiers) 122 analysis = FracasCrashAnalysis.Create(crash_identifiers)
123 123
124 analysis.Reset() 124 analysis.Reset()
125 125
126 # Set common properties. 126 # Set common properties.
127 analysis.crashed_version = chrome_version 127 analysis.crashed_version = chrome_version
128 analysis.stack_trace = stack_trace 128 analysis.stack_trace = stack_trace
129 analysis.signature = signature 129 analysis.signature = signature
130 analysis.platform = platform 130 analysis.platform = platform
131 analysis.client_id = client_id 131 analysis.client_id = client_id
132 132
133 # Set customized properties. 133 # Set customized properties.
134 analysis.historic_metadata = historic_metadata 134 analysis.historical_metadata = historical_metadata
135 analysis.channel = channel 135 analysis.channel = channel
136 136
137 # Set analysis progress properties. 137 # Set analysis progress properties.
138 analysis.status = analysis_status.PENDING 138 analysis.status = analysis_status.PENDING
139 analysis.requested_time = datetime.datetime.utcnow() 139 analysis.requested_time = datetime.datetime.utcnow()
140 140
141 analysis.put() 141 analysis.put()
142 142
143 return True 143 return True
144 144
145 145
146 def ScheduleNewAnalysisForCrash( 146 def ScheduleNewAnalysisForCrash(
147 crash_identifiers, chrome_version, signature, client_id, 147 crash_identifiers, chrome_version, signature, client_id,
148 platform, stack_trace, channel, historic_metadata, 148 platform, stack_trace, channel, historical_metadata,
149 queue_name=constants.DEFAULT_QUEUE): 149 queue_name=constants.DEFAULT_QUEUE):
150 """Schedules an analysis.""" 150 """Schedules an analysis."""
151 crash_config = CrashConfig.Get() 151 crash_config = CrashConfig.Get()
152 if platform not in crash_config.fracas.get( 152 if platform not in crash_config.fracas.get(
153 'supported_platform_list_by_channel', {}).get(channel, []): 153 'supported_platform_list_by_channel', {}).get(channel, []):
154 # Bail out if either the channel or platform is not supported yet. 154 # Bail out if either the channel or platform is not supported yet.
155 logging.info('Ananlysis of channel %s, platform %s is not supported. ' 155 logging.info('Ananlysis of channel %s, platform %s is not supported. '
156 'No analysis is scheduled for %s', 156 'No analysis is scheduled for %s',
157 channel, platform, repr(crash_identifiers)) 157 channel, platform, repr(crash_identifiers))
158 return False 158 return False
159 159
160 for blacklist_marker in _SIGNATURE_BLACKLIST_MARKERS: 160 for blacklist_marker in _SIGNATURE_BLACKLIST_MARKERS:
161 if blacklist_marker in signature: 161 if blacklist_marker in signature:
162 logging.info('%s signature is not supported. ' 162 logging.info('%s signature is not supported. '
163 'No analysis is scheduled for %s', blacklist_marker, 163 'No analysis is scheduled for %s', blacklist_marker,
164 repr(crash_identifiers)) 164 repr(crash_identifiers))
165 return False 165 return False
166 166
167 if platform in _PLATFORM_RENAME: 167 if platform in _PLATFORM_RENAME:
168 platform = _PLATFORM_RENAME[platform] 168 platform = _PLATFORM_RENAME[platform]
169 169
170 if _NeedsNewAnalysis(crash_identifiers, chrome_version, signature, client_id, 170 if _NeedsNewAnalysis(crash_identifiers, chrome_version, signature, client_id,
171 platform, stack_trace, channel, historic_metadata): 171 platform, stack_trace, channel, historical_metadata):
172 analysis_pipeline = FracasCrashWrapperPipeline(crash_identifiers) 172 analysis_pipeline = FracasCrashWrapperPipeline(crash_identifiers)
173 # Attribute defined outside __init__ - pylint: disable=W0201
173 analysis_pipeline.target = appengine_util.GetTargetNameForModule( 174 analysis_pipeline.target = appengine_util.GetTargetNameForModule(
174 constants.CRASH_BACKEND_FRACAS) 175 constants.CRASH_BACKEND_FRACAS)
175 analysis_pipeline.start(queue_name=queue_name) 176 analysis_pipeline.start(queue_name=queue_name)
176 logging.info('New analysis is scheduled for %s', repr(crash_identifiers)) 177 logging.info('New analysis is scheduled for %s', repr(crash_identifiers))
177 return True 178 return True
178 179
179 return False 180 return False
OLDNEW
« no previous file with comments | « appengine/findit/crash/fracas.py ('k') | appengine/findit/crash/test/fracas_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698