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

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: 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,
stgao 2016/05/05 17:32:28 Should we include the ``client_id`` here too? This
Sharu Jiang 2016/05/05 20:26:45 Done.
84 'result': analysis.result, 83 'result': analysis.result,
85 } 84 }
86 messages_data = [json.dumps(result, sort_keys=True)] 85 messages_data = [json.dumps(result, sort_keys=True)]
87 86
88 crash_config = CrashConfig.Get() 87 crash_config = CrashConfig.Get()
89 topic = crash_config.fracas['analysis_result_pubsub_topic'] 88 topic = crash_config.fracas['analysis_result_pubsub_topic']
90 pubsub_util.PublishMessagesToTopic(messages_data, topic) 89 pubsub_util.PublishMessagesToTopic(messages_data, topic)
91 logging.info('Published analysis result for %s', repr(crash_identifiers)) 90 logging.info('Published analysis result for %s', repr(crash_identifiers))
92 91
93 92
94 class FracasCrashWrapperPipeline(BasePipeline): 93 class FracasCrashWrapperPipeline(BasePipeline):
95 # Arguments number differs from overridden method - pylint: disable=W0221 94 # Arguments number differs from overridden method - pylint: disable=W0221
96 def run(self, crash_identifiers): 95 def run(self, crash_identifiers):
97 run_analysis = yield FracasAnalysisPipeline(crash_identifiers) 96 run_analysis = yield FracasAnalysisPipeline(crash_identifiers)
98 with pipeline.After(run_analysis): 97 with pipeline.After(run_analysis):
99 yield PublishResultPipeline(crash_identifiers) 98 yield PublishResultPipeline(crash_identifiers)
100 99
101 100
102 @ndb.transactional 101 @ndb.transactional
103 def _NeedsNewAnalysis( 102 def _NeedsNewAnalysis(
104 crash_identifiers, chrome_version, signature, client_id, 103 crash_identifiers, chrome_version, signature, client_id,
105 platform, stack_trace, channel, historic_metadata): 104 platform, stack_trace, channel, historic_metadata):
106 analysis = FracasCrashAnalysis.Get(crash_identifiers) 105 analysis = FracasCrashAnalysis.Get(crash_identifiers)
107 if analysis and not analysis.failed: 106 if analysis and not analysis.failed:
108 # A new analysis is not needed if last one didn't complete or succeeded. 107 # 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 108 # TODO(http://crbug.com/600535): re-analyze if stack trace or regression
110 # range changed. 109 # range changed.
111 print 'lala'
112 return False 110 return False
113 111
114 if not analysis: 112 if not analysis:
115 # A new analysis is needed if there is no analysis yet. 113 # A new analysis is needed if there is no analysis yet.
116 analysis = FracasCrashAnalysis.Create(crash_identifiers) 114 analysis = FracasCrashAnalysis.Create(crash_identifiers)
117 115
118 analysis.Reset() 116 analysis.Reset()
119 117
120 # Set common properties. 118 # Set common properties.
121 analysis.crashed_version = chrome_version 119 analysis.crashed_version = chrome_version
(...skipping 29 matching lines...) Expand all
151 if _NeedsNewAnalysis(crash_identifiers, chrome_version, signature, client_id, 149 if _NeedsNewAnalysis(crash_identifiers, chrome_version, signature, client_id,
152 platform, stack_trace, channel, historic_metadata): 150 platform, stack_trace, channel, historic_metadata):
153 analysis_pipeline = FracasCrashWrapperPipeline(crash_identifiers) 151 analysis_pipeline = FracasCrashWrapperPipeline(crash_identifiers)
154 analysis_pipeline.target = appengine_util.GetTargetNameForModule( 152 analysis_pipeline.target = appengine_util.GetTargetNameForModule(
155 constants.CRASH_BACKEND_FRACAS) 153 constants.CRASH_BACKEND_FRACAS)
156 analysis_pipeline.start(queue_name=queue_name) 154 analysis_pipeline.start(queue_name=queue_name)
157 logging.info('New analysis is scheduled for %s', repr(crash_identifiers)) 155 logging.info('New analysis is scheduled for %s', repr(crash_identifiers))
158 return True 156 return True
159 157
160 return False 158 return False
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698