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

Side by Side Diff: third_party/buildbot_8_4p1/buildbot/process/builder.py

Issue 2415703004: Enable merging buildbot builds dependent on queue length (Closed)
Patch Set: Review Created 4 years, 2 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
« no previous file with comments | « masters/master.client.v8/master.cfg ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # This file is part of Buildbot. Buildbot is free software: you can 1 # This file is part of Buildbot. Buildbot is free software: you can
2 # redistribute it and/or modify it under the terms of the GNU General Public 2 # redistribute it and/or modify it under the terms of the GNU General Public
3 # License as published by the Free Software Foundation, version 2. 3 # License as published by the Free Software Foundation, version 2.
4 # 4 #
5 # This program is distributed in the hope that it will be useful, but WITHOUT 5 # This program is distributed in the hope that it will be useful, but WITHOUT
6 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 6 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
7 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 7 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
8 # details. 8 # details.
9 # 9 #
10 # You should have received a copy of the GNU General Public License along with 10 # You should have received a copy of the GNU General Public License along with
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 # we'll need BuildRequest objects, so get those first 846 # we'll need BuildRequest objects, so get those first
847 wfd = defer.waitForDeferred( 847 wfd = defer.waitForDeferred(
848 defer.gatherResults( 848 defer.gatherResults(
849 [ self._brdictToBuildRequest(brdict) 849 [ self._brdictToBuildRequest(brdict)
850 for brdict in unclaimed_requests ])) 850 for brdict in unclaimed_requests ]))
851 yield wfd 851 yield wfd
852 unclaimed_request_objects = wfd.getResult() 852 unclaimed_request_objects = wfd.getResult()
853 breq_object = unclaimed_request_objects.pop( 853 breq_object = unclaimed_request_objects.pop(
854 unclaimed_requests.index(breq)) 854 unclaimed_requests.index(breq))
855 855
856 # Make sure the merge-requests function can take the queue lengths. Old
857 # style functions only take two parameters.
858 if getattr(mergeRequests_fn, 'with_length', False):
859 mergeRequests_with_length_fn = mergeRequests_fn
860 else:
861 mergeRequests_with_length_fn = (
862 lambda a, b, *_ : mergeRequests_fn(a, b))
863
864 # This might not reflect the exact number of items that could be merged
865 # (this depends on the canBeMergedWith algorithm), but it can help
866 # indicating how loaded this builder is.
867 queue_length = len(unclaimed_request_objects)
868
856 # gather the mergeable requests 869 # gather the mergeable requests
857 merged_request_objects = [breq_object] 870 merged_request_objects = [breq_object]
858 for other_breq_object in unclaimed_request_objects: 871 for other_breq_object in unclaimed_request_objects:
859 wfd = defer.waitForDeferred( 872 wfd = defer.waitForDeferred(
860 defer.maybeDeferred(lambda : 873 defer.maybeDeferred(lambda :
861 mergeRequests_fn(breq_object, other_breq_object))) 874 mergeRequests_with_length_fn(
agable 2016/10/13 17:58:36 It might be less confusing if the "if fn.with_leng
Michael Achenbach 2016/10/13 19:05:07 Done.
875 breq_object,
876 other_breq_object,
877 queue_length,
878 len(merged_request_objects),
879 )))
862 yield wfd 880 yield wfd
863 if wfd.getResult(): 881 if wfd.getResult():
864 merged_request_objects.append(other_breq_object) 882 merged_request_objects.append(other_breq_object)
865 883
866 # convert them back to brdicts and return 884 # convert them back to brdicts and return
867 merged_requests = [ br.brdict for br in merged_request_objects ] 885 merged_requests = [ br.brdict for br in merged_request_objects ]
868 yield merged_requests 886 yield merged_requests
869 887
870 def _brdictToBuildRequest(self, brdict): 888 def _brdictToBuildRequest(self, brdict):
871 """ 889 """
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 d = defer.DeferredList(dl) 997 d = defer.DeferredList(dl)
980 d.addCallback(self._gatherPingResults) 998 d.addCallback(self._gatherPingResults)
981 return d 999 return d
982 1000
983 def _gatherPingResults(self, res): 1001 def _gatherPingResults(self, res):
984 for ignored,success in res: 1002 for ignored,success in res:
985 if not success: 1003 if not success:
986 return False 1004 return False
987 return True 1005 return True
988 1006
OLDNEW
« no previous file with comments | « masters/master.client.v8/master.cfg ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698