Chromium Code Reviews| Index: third_party/buildbot_8_4p1/buildbot/process/builder.py |
| diff --git a/third_party/buildbot_8_4p1/buildbot/process/builder.py b/third_party/buildbot_8_4p1/buildbot/process/builder.py |
| index e92e2d1a34fa1e47532343f21a4beca500dd0080..c8a7bb0c7cb31ab72cdb0a84c136d1adf8781fd3 100644 |
| --- a/third_party/buildbot_8_4p1/buildbot/process/builder.py |
| +++ b/third_party/buildbot_8_4p1/buildbot/process/builder.py |
| @@ -853,12 +853,30 @@ class Builder(pb.Referenceable, service.MultiService): |
| breq_object = unclaimed_request_objects.pop( |
| unclaimed_requests.index(breq)) |
| + # Make sure the merge-requests function can take the queue lengths. Old |
| + # style functions only take two parameters. |
| + if getattr(mergeRequests_fn, 'with_length', False): |
| + mergeRequests_with_length_fn = mergeRequests_fn |
| + else: |
| + mergeRequests_with_length_fn = ( |
| + lambda a, b, *_ : mergeRequests_fn(a, b)) |
| + |
| + # This might not reflect the exact number of items that could be merged |
| + # (this depends on the canBeMergedWith algorithm), but it can help |
| + # indicating how loaded this builder is. |
| + queue_length = len(unclaimed_request_objects) |
| + |
| # gather the mergeable requests |
| merged_request_objects = [breq_object] |
| for other_breq_object in unclaimed_request_objects: |
| wfd = defer.waitForDeferred( |
| defer.maybeDeferred(lambda : |
| - mergeRequests_fn(breq_object, other_breq_object))) |
| + 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.
|
| + breq_object, |
| + other_breq_object, |
| + queue_length, |
| + len(merged_request_objects), |
| + ))) |
| yield wfd |
| if wfd.getResult(): |
| merged_request_objects.append(other_breq_object) |