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

Side by Side Diff: appengine/findit/waterfall/buildbot.py

Issue 2116073002: [Findit] Fix redirect bug and update template for waterfall/culprit. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Add one unittest. 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
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 contextlib 5 import contextlib
6 from datetime import datetime 6 from datetime import datetime
7 import gzip 7 import gzip
8 import json 8 import json
9 import re 9 import re
10 import urllib 10 import urllib
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 for item in properties: 171 for item in properties:
172 if item[0] == property_name: 172 if item[0] == property_name:
173 return item[1] 173 return item[1]
174 return None 174 return None
175 175
176 176
177 def GetBuildStartTime(build_data_json): 177 def GetBuildStartTime(build_data_json):
178 times = build_data_json.get('times') 178 times = build_data_json.get('times')
179 if not times: 179 if not times:
180 return None 180 return None
181 # TODO: convert to PST time?
182 return datetime.utcfromtimestamp(times[0]) 181 return datetime.utcfromtimestamp(times[0])
183 182
184 183
184 def GetBuildEndTime(build_data_json):
185 times = build_data_json.get('times')
186 if not times or len(times) < 2 or not times[1]:
187 return None
188 return datetime.utcfromtimestamp(times[1])
189
190
185 def GetBuildResult(build_data_json): 191 def GetBuildResult(build_data_json):
186 return build_data_json.get('results') 192 return build_data_json.get('results')
187 193
188 194
189 def ExtractBuildInfo(master_name, builder_name, build_number, build_data): 195 def ExtractBuildInfo(master_name, builder_name, build_number, build_data):
190 """Extracts and returns build information as an instance of BuildInfo.""" 196 """Extracts and returns build information as an instance of BuildInfo."""
191 build_info = BuildInfo(master_name, builder_name, build_number) 197 build_info = BuildInfo(master_name, builder_name, build_number)
192 198
193 data_json = json.loads(build_data) 199 data_json = json.loads(build_data)
194 chromium_revision = GetBuildProperty( 200 chromium_revision = GetBuildProperty(
195 data_json.get('properties', []), 'got_revision') 201 data_json.get('properties', []), 'got_revision')
196 202
197 build_info.build_start_time = GetBuildStartTime(data_json) 203 build_info.build_start_time = GetBuildStartTime(data_json)
204 build_info.build_end_time = GetBuildEndTime(data_json)
198 build_info.chromium_revision = chromium_revision 205 build_info.chromium_revision = chromium_revision
199 build_info.completed = data_json.get('currentStep') is None 206 build_info.completed = data_json.get('currentStep') is None
200 build_info.result = GetBuildResult(data_json) 207 build_info.result = GetBuildResult(data_json)
201 208
202 changes = data_json.get('sourceStamp', {}).get('changes', []) 209 changes = data_json.get('sourceStamp', {}).get('changes', [])
203 for change in changes: 210 for change in changes:
204 if change['revision'] not in build_info.blame_list: 211 if change['revision'] not in build_info.blame_list:
205 build_info.blame_list.append(change['revision']) 212 build_info.blame_list.append(change['revision'])
206 213
207 # Step categories: 214 # Step categories:
(...skipping 21 matching lines...) Expand all
229 # the annotating step like "steps" fail too. Such annotating steps have a 236 # the annotating step like "steps" fail too. Such annotating steps have a
230 # log with name "preamble". 237 # log with name "preamble".
231 continue 238 continue
232 239
233 if step_result in (SUCCESS, WARNINGS): 240 if step_result in (SUCCESS, WARNINGS):
234 build_info.passed_steps.append(step_name) 241 build_info.passed_steps.append(step_name)
235 elif step_result == FAILURE: 242 elif step_result == FAILURE:
236 build_info.failed_steps.append(step_name) 243 build_info.failed_steps.append(step_name)
237 244
238 return build_info 245 return build_info
OLDNEW
« no previous file with comments | « appengine/findit/waterfall/build_util.py ('k') | appengine/findit/waterfall/send_notification_for_culprit_pipeline.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698