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

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

Issue 1946513003: [Findit] Modify the handler for fracas input message. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Created 4 years, 7 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
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 channel, platform, signature, analysis.stack_trace, 63 channel, platform, signature, analysis.stack_trace,
64 analysis.crashed_version, analysis.versions_to_cpm) 64 analysis.crashed_version, analysis.versions_to_historical)
Martin Barbella 2016/05/03 18:43:09 Left a comment on Mimee's CL as well, but this is
Sharu Jiang 2016/05/03 23:48:03 Changed to historic_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 26 matching lines...) Expand all
101 class FracasCrashWrapperPipeline(BasePipeline): 101 class FracasCrashWrapperPipeline(BasePipeline):
102 # Arguments number differs from overridden method - pylint: disable=W0221 102 # Arguments number differs from overridden method - pylint: disable=W0221
103 def run(self, channel, platform, signature): 103 def run(self, channel, platform, signature):
104 run_analysis = yield FracasAnalysisPipeline(channel, platform, signature) 104 run_analysis = yield FracasAnalysisPipeline(channel, platform, signature)
105 with pipeline.After(run_analysis): 105 with pipeline.After(run_analysis):
106 yield PublishResultPipeline(channel, platform, signature) 106 yield PublishResultPipeline(channel, platform, signature)
107 107
108 108
109 @ndb.transactional 109 @ndb.transactional
110 def _NeedsNewAnalysis( 110 def _NeedsNewAnalysis(
111 channel, platform, signature, stack_trace, chrome_version, versions_to_cpm): 111 channel, platform, signature, stack_trace,
112 chrome_version, versions_to_historical):
112 analysis = FracasCrashAnalysis.Get(channel, platform, signature) 113 analysis = FracasCrashAnalysis.Get(channel, platform, signature)
113 if analysis and not analysis.failed: 114 if analysis and not analysis.failed:
114 # A new analysis is not needed if last one didn't complete or succeeded. 115 # A new analysis is not needed if last one didn't complete or succeeded.
115 # TODO(http://crbug.com/600535): re-analyze if stack trace or regression 116 # TODO(http://crbug.com/600535): re-analyze if stack trace or regression
116 # range changed. 117 # range changed.
117 return False 118 return False
118 119
119 if not analysis: 120 if not analysis:
120 # A new analysis is needed if there is no analysis yet. 121 # A new analysis is needed if there is no analysis yet.
121 analysis = FracasCrashAnalysis.Create(channel, platform, signature) 122 analysis = FracasCrashAnalysis.Create(channel, platform, signature)
122 123
123 analysis.Reset() 124 analysis.Reset()
124 analysis.crashed_version = chrome_version 125 analysis.crashed_version = chrome_version
125 analysis.stack_trace = stack_trace 126 analysis.stack_trace = stack_trace
126 analysis.versions_to_cpm = versions_to_cpm 127 analysis.versions_to_historical = versions_to_historical
127 analysis.status = analysis_status.PENDING 128 analysis.status = analysis_status.PENDING
128 analysis.requested_time = datetime.datetime.utcnow() 129 analysis.requested_time = datetime.datetime.utcnow()
129 analysis.put() 130 analysis.put()
130 return True 131 return True
131 132
132 133
133 def ScheduleNewAnalysisForCrash( 134 def ScheduleNewAnalysisForCrash(
134 channel, platform, signature, stack_trace, chrome_version, versions_to_cpm, 135 channel, platform, signature, stack_trace, chrome_version,
136 versions_to_historical,
135 queue_name=constants.DEFAULT_QUEUE): 137 queue_name=constants.DEFAULT_QUEUE):
136 """Schedules an analysis.""" 138 """Schedules an analysis."""
137 crash_config = CrashConfig.Get() 139 crash_config = CrashConfig.Get()
138 if platform not in crash_config.fracas.get( 140 if platform not in crash_config.fracas.get(
139 'supported_platform_list_by_channel', {}).get(channel, []): 141 'supported_platform_list_by_channel', {}).get(channel, []):
140 # Bail out if either the channel or platform is not supported yet. 142 # Bail out if either the channel or platform is not supported yet.
141 return False 143 return False
142 144
143 if _NeedsNewAnalysis(channel, platform, signature, stack_trace, 145 if _NeedsNewAnalysis(channel, platform, signature, stack_trace,
144 chrome_version, versions_to_cpm): 146 chrome_version, versions_to_historical):
145 analysis_pipeline = FracasCrashWrapperPipeline(channel, platform, signature) 147 analysis_pipeline = FracasCrashWrapperPipeline(channel, platform, signature)
146 analysis_pipeline.target = appengine_util.GetTargetNameForModule( 148 analysis_pipeline.target = appengine_util.GetTargetNameForModule(
147 constants.CRASH_BACKEND_FRACAS) 149 constants.CRASH_BACKEND_FRACAS)
148 analysis_pipeline.start(queue_name=queue_name) 150 analysis_pipeline.start(queue_name=queue_name)
149 logging.info('New analysis is scheduled for %s, %s, %s', 151 logging.info('New analysis is scheduled for %s, %s, %s',
150 channel, platform, signature) 152 channel, platform, signature)
151 return True 153 return True
152 154
153 return False 155 return False
OLDNEW
« no previous file with comments | « no previous file | appengine/findit/handlers/crash/fracas_crash.py » ('j') | appengine/findit/handlers/crash/fracas_crash.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698