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

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

Issue 1950123003: [Findit] Fetch DEPS from buildspec/ instead of trunk for chrome official builds. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Add signature filtering. 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 48
49 # Update analysis status. 49 # Update analysis status.
50 analysis.pipeline_status_path = self.pipeline_status_path() 50 analysis.pipeline_status_path = self.pipeline_status_path()
51 analysis.status = analysis_status.RUNNING 51 analysis.status = analysis_status.RUNNING
52 analysis.started_time = datetime.datetime.utcnow() 52 analysis.started_time = datetime.datetime.utcnow()
53 analysis.findit_version = appengine_util.GetCurrentVersion() 53 analysis.findit_version = appengine_util.GetCurrentVersion()
54 analysis.put() 54 analysis.put()
55 55
56 # Run the analysis. 56 # Run the analysis.
57 result, tags = fracas.FindCulpritForChromeCrash( 57 result, tags = fracas.FindCulpritForChromeCrash(
58 analysis.channel, analysis.platform, analysis.signature, 58 analysis.signature, analysis.platform, analysis.stack_trace,
59 analysis.stack_trace, analysis.crashed_version, 59 analysis.crashed_version, analysis.historic_metadata)
60 analysis.historic_metadata)
61 60
62 # Update analysis status and save the analysis result. 61 # Update analysis status and save the analysis result.
63 analysis.completed_time = datetime.datetime.utcnow() 62 analysis.completed_time = datetime.datetime.utcnow()
64 analysis.result = result 63 analysis.result = result
65 for tag_name, tag_value in tags.iteritems(): 64 for tag_name, tag_value in tags.iteritems():
66 # TODO(http://crbug.com/602702): make it possible to add arbitrary tags. 65 # TODO(http://crbug.com/602702): make it possible to add arbitrary tags.
67 if hasattr(analysis, tag_name): 66 if hasattr(analysis, tag_name):
68 setattr(analysis, tag_name, tag_value) 67 setattr(analysis, tag_name, tag_value)
69 analysis.status = analysis_status.COMPLETED 68 analysis.status = analysis_status.COMPLETED
70 analysis.put() 69 analysis.put()
71 70
72 71
73 class PublishResultPipeline(FracasBasePipeline): 72 class PublishResultPipeline(FracasBasePipeline):
74 def finalized(self): 73 def finalized(self):
75 if self.was_aborted: # pragma: no cover. 74 if self.was_aborted: # pragma: no cover.
76 logging.error('Failed to publish analysis result for %s', 75 logging.error('Failed to publish analysis result for %s',
77 repr(self.crash_identifiers)) 76 repr(self.crash_identifiers))
78 77
79 # Arguments number differs from overridden method - pylint: disable=W0221 78 # Arguments number differs from overridden method - pylint: disable=W0221
80 def run(self, crash_identifiers): 79 def run(self, crash_identifiers):
81 analysis = FracasCrashAnalysis.Get(crash_identifiers) 80 analysis = FracasCrashAnalysis.Get(crash_identifiers)
82 result = { 81 result = {
83 'crash_identifiers': crash_identifiers, 82 'crash_identifiers': crash_identifiers,
83 'client_id': analysis.client_id,
84 'result': analysis.result, 84 'result': analysis.result,
85 } 85 }
86 messages_data = [json.dumps(result, sort_keys=True)] 86 messages_data = [json.dumps(result, sort_keys=True)]
87 87
88 crash_config = CrashConfig.Get() 88 crash_config = CrashConfig.Get()
89 topic = crash_config.fracas['analysis_result_pubsub_topic'] 89 topic = crash_config.fracas['analysis_result_pubsub_topic']
90 pubsub_util.PublishMessagesToTopic(messages_data, topic) 90 pubsub_util.PublishMessagesToTopic(messages_data, topic)
91 logging.info('Published analysis result for %s', repr(crash_identifiers)) 91 logging.info('Published analysis result for %s', repr(crash_identifiers))
92 92
93 93
94 class FracasCrashWrapperPipeline(BasePipeline): 94 class FracasCrashWrapperPipeline(BasePipeline):
95 # Arguments number differs from overridden method - pylint: disable=W0221 95 # Arguments number differs from overridden method - pylint: disable=W0221
96 def run(self, crash_identifiers): 96 def run(self, crash_identifiers):
97 run_analysis = yield FracasAnalysisPipeline(crash_identifiers) 97 run_analysis = yield FracasAnalysisPipeline(crash_identifiers)
98 with pipeline.After(run_analysis): 98 with pipeline.After(run_analysis):
99 yield PublishResultPipeline(crash_identifiers) 99 yield PublishResultPipeline(crash_identifiers)
100 100
101 101
102 @ndb.transactional 102 @ndb.transactional
103 def _NeedsNewAnalysis( 103 def _NeedsNewAnalysis(
104 crash_identifiers, chrome_version, signature, client_id, 104 crash_identifiers, chrome_version, signature, client_id,
105 platform, stack_trace, channel, historic_metadata): 105 platform, stack_trace, channel, historic_metadata):
106 analysis = FracasCrashAnalysis.Get(crash_identifiers) 106 analysis = FracasCrashAnalysis.Get(crash_identifiers)
107 if analysis and not analysis.failed: 107 if analysis and not analysis.failed:
108 # A new analysis is not needed if last one didn't complete or succeeded. 108 # A new analysis is not needed if last one didn't complete or succeeded.
109 # TODO(http://crbug.com/600535): re-analyze if stack trace or regression 109 # TODO(http://crbug.com/600535): re-analyze if stack trace or regression
110 # range changed. 110 # range changed.
111 print 'lala'
112 return False 111 return False
113 112
114 if not analysis: 113 if not analysis:
115 # A new analysis is needed if there is no analysis yet. 114 # A new analysis is needed if there is no analysis yet.
116 analysis = FracasCrashAnalysis.Create(crash_identifiers) 115 analysis = FracasCrashAnalysis.Create(crash_identifiers)
117 116
118 analysis.Reset() 117 analysis.Reset()
119 118
120 # Set common properties. 119 # Set common properties.
121 analysis.crashed_version = chrome_version 120 analysis.crashed_version = chrome_version
(...skipping 29 matching lines...) Expand all
151 if _NeedsNewAnalysis(crash_identifiers, chrome_version, signature, client_id, 150 if _NeedsNewAnalysis(crash_identifiers, chrome_version, signature, client_id,
152 platform, stack_trace, channel, historic_metadata): 151 platform, stack_trace, channel, historic_metadata):
153 analysis_pipeline = FracasCrashWrapperPipeline(crash_identifiers) 152 analysis_pipeline = FracasCrashWrapperPipeline(crash_identifiers)
154 analysis_pipeline.target = appengine_util.GetTargetNameForModule( 153 analysis_pipeline.target = appengine_util.GetTargetNameForModule(
155 constants.CRASH_BACKEND_FRACAS) 154 constants.CRASH_BACKEND_FRACAS)
156 analysis_pipeline.start(queue_name=queue_name) 155 analysis_pipeline.start(queue_name=queue_name)
157 logging.info('New analysis is scheduled for %s', repr(crash_identifiers)) 156 logging.info('New analysis is scheduled for %s', repr(crash_identifiers))
158 return True 157 return True
159 158
160 return False 159 return False
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698