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

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

Issue 1953463002: Empty webkitpy/common/net/buildbot/__init__.py and update imports. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove the net/buildbot/ subdirectory; move the files into net/ and fix pylint warnings 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 (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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 return None 129 return None
130 return (int(match.group("revision")), int(match.group("build_number"))) 130 return (int(match.group("revision")), int(match.group("build_number")))
131 131
132 def _fetch_revision_to_build_map(self): 132 def _fetch_revision_to_build_map(self):
133 # All _fetch requests go through _buildbot for easier mocking 133 # All _fetch requests go through _buildbot for easier mocking
134 # FIXME: This should use NetworkTransaction's 404 handling instead. 134 # FIXME: This should use NetworkTransaction's 404 handling instead.
135 try: 135 try:
136 # FIXME: This method is horribly slow due to the huge network load. 136 # FIXME: This method is horribly slow due to the huge network load.
137 # FIXME: This is a poor way to do revision -> build mapping. 137 # FIXME: This is a poor way to do revision -> build mapping.
138 # Better would be to ask buildbot through some sort of API. 138 # Better would be to ask buildbot through some sort of API.
139 print "Loading revision/build list from %s." % self.results_url() 139 _log.info("Loading revision/build list from %s." % self.results_url( ))
140 print "This may take a while..." 140 _log.info("This may take a while...")
qyearsley 2016/05/06 17:31:23 The style check in the presubmit gave warnings abo
141 result_files = self._buildbot._fetch_twisted_directory_listing(self. results_url()) 141 result_files = self._buildbot._fetch_twisted_directory_listing(self. results_url())
142 except urllib2.HTTPError, error: 142 except urllib2.HTTPError, error:
143 if error.code != 404: 143 if error.code != 404:
144 raise 144 raise
145 _log.debug("Revision/build list failed to load.") 145 _log.debug("Revision/build list failed to load.")
146 result_files = [] 146 result_files = []
147 return dict(self._file_info_list_to_revision_to_build_list(result_files) ) 147 return dict(self._file_info_list_to_revision_to_build_list(result_files) )
148 148
149 def _file_info_list_to_revision_to_build_list(self, file_info_list): 149 def _file_info_list_to_revision_to_build_list(self, file_info_list):
150 # This assumes there was only one build per revision, which is false but we don't care for now. 150 # This assumes there was only one build per revision, which is false but we don't care for now.
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 continue 369 continue
370 if revision_anchor and revision_anchor.string and re.match(r'^\d+$', revision_anchor.string): 370 if revision_anchor and revision_anchor.string and re.match(r'^\d+$', revision_anchor.string):
371 revisions.append((int(revision_anchor.string), 'success' in tabl e_cells[2].string)) 371 revisions.append((int(revision_anchor.string), 'success' in tabl e_cells[2].string))
372 return revisions 372 return revisions
373 373
374 def _find_green_revision(self, builder_revisions): 374 def _find_green_revision(self, builder_revisions):
375 revision_statuses = {} 375 revision_statuses = {}
376 for builder in builder_revisions: 376 for builder in builder_revisions:
377 for revision, succeeded in builder_revisions[builder]: 377 for revision, succeeded in builder_revisions[builder]:
378 revision_statuses.setdefault(revision, set()) 378 revision_statuses.setdefault(revision, set())
379 if succeeded and revision_statuses[revision] != None: 379 if succeeded and revision_statuses[revision] is not None:
380 revision_statuses[revision].add(builder) 380 revision_statuses[revision].add(builder)
381 else: 381 else:
382 revision_statuses[revision] = None 382 revision_statuses[revision] = None
383 383
384 # In descending order, look for a revision X with successful builds 384 # In descending order, look for a revision X with successful builds
385 # Once we found X, check if remaining builders succeeded in the neighbor hood of X. 385 # Once we found X, check if remaining builders succeeded in the neighbor hood of X.
386 revisions_in_order = sorted(revision_statuses.keys(), reverse=True) 386 revisions_in_order = sorted(revision_statuses.keys(), reverse=True)
387 for i, revision in enumerate(revisions_in_order): 387 for i, revision in enumerate(revisions_in_order):
388 if not revision_statuses[revision]: 388 if not revision_statuses[revision]:
389 continue 389 continue
390 390
391 builders_succeeded_in_future = set() 391 builders_succeeded_in_future = set()
392 for future_revision in sorted(revisions_in_order[:i + 1]): 392 for future_revision in sorted(revisions_in_order[:i + 1]):
393 if not revision_statuses[future_revision]: 393 if not revision_statuses[future_revision]:
394 break 394 break
395 builders_succeeded_in_future = builders_succeeded_in_future.unio n(revision_statuses[future_revision]) 395 builders_succeeded_in_future = builders_succeeded_in_future.unio n(revision_statuses[future_revision])
396 396
397 builders_succeeded_in_past = set() 397 builders_succeeded_in_past = set()
398 for past_revision in revisions_in_order[i:]: 398 for past_revision in revisions_in_order[i:]:
399 if not revision_statuses[past_revision]: 399 if not revision_statuses[past_revision]:
400 break 400 break
401 builders_succeeded_in_past = builders_succeeded_in_past.union(re vision_statuses[past_revision]) 401 builders_succeeded_in_past = builders_succeeded_in_past.union(re vision_statuses[past_revision])
402 402
403 if len(builders_succeeded_in_future) == len(builder_revisions) and l en(builders_succeeded_in_past) == len(builder_revisions): 403 if len(builders_succeeded_in_future) == len(builder_revisions) and l en(builders_succeeded_in_past) == len(builder_revisions):
404 return revision 404 return revision
405 return None 405 return None
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698