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

Side by Side Diff: third_party/WebKit/Tools/Scripts/webkitpy/common/net/buildbot.py

Issue 2014063002: Run format-webkit on webkitpy code (without string conversion). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 (c) 2009, Google Inc. All rights reserved. 1 # Copyright (c) 2009, Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 def _fetch_revision_to_build_map(self): 131 def _fetch_revision_to_build_map(self):
132 # All _fetch requests go through _buildbot for easier mocking 132 # All _fetch requests go through _buildbot for easier mocking
133 # FIXME: This should use NetworkTransaction's 404 handling instead. 133 # FIXME: This should use NetworkTransaction's 404 handling instead.
134 try: 134 try:
135 # FIXME: This method is horribly slow due to the huge network load. 135 # FIXME: This method is horribly slow due to the huge network load.
136 # FIXME: This is a poor way to do revision -> build mapping. 136 # FIXME: This is a poor way to do revision -> build mapping.
137 # Better would be to ask buildbot through some sort of API. 137 # Better would be to ask buildbot through some sort of API.
138 _log.info("Loading revision/build list from %s." % self.results_url( )) 138 _log.info("Loading revision/build list from %s." % self.results_url( ))
139 _log.info("This may take a while...") 139 _log.info("This may take a while...")
140 result_files = self._buildbot._fetch_twisted_directory_listing(self. results_url()) 140 result_files = self._buildbot._fetch_twisted_directory_listing(self. results_url())
141 except urllib2.HTTPError, error: 141 except urllib2.HTTPError as error:
142 if error.code != 404: 142 if error.code != 404:
143 raise 143 raise
144 _log.debug("Revision/build list failed to load.") 144 _log.debug("Revision/build list failed to load.")
145 result_files = [] 145 result_files = []
146 return dict(self._file_info_list_to_revision_to_build_list(result_files) ) 146 return dict(self._file_info_list_to_revision_to_build_list(result_files) )
147 147
148 def _file_info_list_to_revision_to_build_list(self, file_info_list): 148 def _file_info_list_to_revision_to_build_list(self, file_info_list):
149 # This assumes there was only one build per revision, which is false but we don't care for now. 149 # This assumes there was only one build per revision, which is false but we don't care for now.
150 revisions_and_builds = [] 150 revisions_and_builds = []
151 for file_info in file_info_list: 151 for file_info in file_info_list:
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 279
280 # FIXME: These _fetch methods should move to a networking class. 280 # FIXME: These _fetch methods should move to a networking class.
281 def _fetch_build_dictionary(self, builder, build_number): 281 def _fetch_build_dictionary(self, builder, build_number):
282 # Note: filter=1 will remove None and {} and '', which cuts noise but ca n 282 # Note: filter=1 will remove None and {} and '', which cuts noise but ca n
283 # cause keys to be missing which you might otherwise expect. 283 # cause keys to be missing which you might otherwise expect.
284 # FIXME: The bot sends a *huge* amount of data for each request, we shou ld 284 # FIXME: The bot sends a *huge* amount of data for each request, we shou ld
285 # find a way to reduce the response size further. 285 # find a way to reduce the response size further.
286 json_url = "%s/json/builders/%s/builds/%s?filter=1" % (self.buildbot_url , urllib.quote(builder.name()), build_number) 286 json_url = "%s/json/builders/%s/builds/%s?filter=1" % (self.buildbot_url , urllib.quote(builder.name()), build_number)
287 try: 287 try:
288 return json.load(urllib2.urlopen(json_url)) 288 return json.load(urllib2.urlopen(json_url))
289 except urllib2.URLError, err: 289 except urllib2.URLError as err:
290 build_url = Build.build_url(builder, build_number) 290 build_url = Build.build_url(builder, build_number)
291 _log.error("Error fetching data for %s build %s (%s, json: %s): %s" % 291 _log.error("Error fetching data for %s build %s (%s, json: %s): %s" %
292 (builder.name(), build_number, build_url, json_url, err)) 292 (builder.name(), build_number, build_url, json_url, err))
293 return None 293 return None
294 except ValueError, err: 294 except ValueError as err:
295 build_url = Build.build_url(builder, build_number) 295 build_url = Build.build_url(builder, build_number)
296 _log.error("Error decoding json data from %s: %s" % (build_url, err) ) 296 _log.error("Error decoding json data from %s: %s" % (build_url, err) )
297 return None 297 return None
298 298
299 def _file_cell_text(self, file_cell): 299 def _file_cell_text(self, file_cell):
300 """Traverses down through firstChild elements until one containing a str ing is found, then returns that string""" 300 """Traverses down through firstChild elements until one containing a str ing is found, then returns that string"""
301 element = file_cell 301 element = file_cell
302 while element.string is None and element.contents: 302 while element.string is None and element.contents:
303 element = element.contents[0] 303 element = element.contents[0]
304 return element.string 304 return element.string
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 if not revision_statuses[future_revision]: 395 if not revision_statuses[future_revision]:
396 break 396 break
397 builders_succeeded_in_future = builders_succeeded_in_future.unio n(revision_statuses[future_revision]) 397 builders_succeeded_in_future = builders_succeeded_in_future.unio n(revision_statuses[future_revision])
398 398
399 builders_succeeded_in_past = set() 399 builders_succeeded_in_past = set()
400 for past_revision in revisions_in_order[i:]: 400 for past_revision in revisions_in_order[i:]:
401 if not revision_statuses[past_revision]: 401 if not revision_statuses[past_revision]:
402 break 402 break
403 builders_succeeded_in_past = builders_succeeded_in_past.union(re vision_statuses[past_revision]) 403 builders_succeeded_in_past = builders_succeeded_in_past.union(re vision_statuses[past_revision])
404 404
405 if len(builders_succeeded_in_future) == len(builder_revisions) and l en(builders_succeeded_in_past) == len(builder_revisions): 405 if len(builders_succeeded_in_future) == len(builder_revisions) and l en(
406 builders_succeeded_in_past) == len(builder_revisions):
406 return revision 407 return revision
407 return None 408 return None
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698