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

Side by Side Diff: third_party/buildbot_8_4p1/README.chromium

Issue 13619004: Only calculate slave->build mapping once in json output. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Added readme.chromium changes. Created 7 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 | Annotate | Revision Log
OLDNEW
1 URL: http://buildbot.net/trac 1 URL: http://buildbot.net/trac
2 Version: 0.8.4p1 2 Version: 0.8.4p1
3 License: GNU General Public License (GPL) Version 2 3 License: GNU General Public License (GPL) Version 2
4 4
5 This is a forked copy of buildbot v0.8.4p1. 5 This is a forked copy of buildbot v0.8.4p1.
6 6
7 Make hidden steps stay hidden even if not finished, add brDoStepIf 7 Make hidden steps stay hidden even if not finished, add brDoStepIf
8 to support buildrunner. 8 to support buildrunner.
9 9
10 10
11
iannucci 2013/06/30 08:16:16 don't need this, I think?
Mike Stip (use stip instead) 2013/06/30 08:29:54 Done, now sure how that snuck in.
11 diff --git a/third_party/buildbot_8_4p1/buildbot/process/buildstep.py b/third_pa rty/buildbot_8_4p1/buildbot/process/buildstep.py 12 diff --git a/third_party/buildbot_8_4p1/buildbot/process/buildstep.py b/third_pa rty/buildbot_8_4p1/buildbot/process/buildstep.py
12 index 4aa307d..21044ea 100644 13 index 4aa307d..21044ea 100644
13 --- a/third_party/buildbot_8_4p1/buildbot/process/buildstep.py 14 --- a/third_party/buildbot_8_4p1/buildbot/process/buildstep.py
14 +++ b/third_party/buildbot_8_4p1/buildbot/process/buildstep.py 15 +++ b/third_party/buildbot_8_4p1/buildbot/process/buildstep.py
15 @@ -621,6 +621,7 @@ class BuildStep: 16 @@ -621,6 +621,7 @@ class BuildStep:
16 'progressMetrics', 17 'progressMetrics',
17 'doStepIf', 18 'doStepIf',
18 'hideStepIf', 19 'hideStepIf',
19 + 'brDoStepIf', 20 + 'brDoStepIf',
20 ] 21 ]
(...skipping 2919 matching lines...) Expand 10 before | Expand all | Expand 10 after
2940 doStepIf = True 2941 doStepIf = True
2941 hideStepIf = False 2942 hideStepIf = False
2942 # like doStepIf, but evaluated at runtime if executing under runbuild.py 2943 # like doStepIf, but evaluated at runtime if executing under runbuild.py
2943 - # we also overload 'False' to signify this isn't a buildrunner step 2944 - # we also overload 'False' to signify this isn't a buildrunner step
2944 - brDoStepIf = False 2945 - brDoStepIf = False
2945 + # We use None to signify that a step is not a buildrunner step. 2946 + # We use None to signify that a step is not a buildrunner step.
2946 + brDoStepIf = None 2947 + brDoStepIf = None
2947 2948
2948 def __init__(self, **kwargs): 2949 def __init__(self, **kwargs):
2949 self.factory = (self.__class__, dict(kwargs)) 2950 self.factory = (self.__class__, dict(kwargs))
2951 diff --git a/third_party/buildbot_8_4p1/buildbot/status/web/status_json.py b/thi rd_party/buildbot_8_4p1/buildbot/status/web/status_json.py
2952 index b656563..054432c 100644
2953 --- a/third_party/buildbot_8_4p1/buildbot/status/web/status_json.py
2954 +++ b/third_party/buildbot_8_4p1/buildbot/status/web/status_json.py
2955 @@ -16,6 +16,7 @@
2956
2957 """Simple JSON exporter."""
2958
2959 +import collections
2960 import datetime
2961 import os
2962 import re
2963 @@ -635,21 +636,39 @@ class SlaveJsonResource(JsonResource):
2964 self.builders.append(builderName)
2965 return self.builders
2966
2967 + def getSlaveBuildMap(self, buildcache, buildercache):
2968 + for builderName in self.getBuilders():
2969 + if builderName not in buildercache:
2970 + # This builder hasn't been processed in this request yet.
2971 + buildercache.add(builderName)
2972 + builder_status = self.status.getBuilder(builderName)
2973 + for i in range(1, builder_status.buildCacheSize - 1):
2974 + build_status = builder_status.getBuild(-i)
2975 + if not build_status or not build_status.isFinished():
2976 + # If not finished, it will appear in runningBuilds.
2977 + break
2978 + slave = buildcache[build_status.getSlavename()]
2979 + slave.setdefault(builderName, []).append(
2980 + build_status.getNumber())
2981 + return buildcache[self.name]
2982 +
2983 def asDict(self, request):
2984 + if not hasattr(request, 'requestdata'):
2985 + request.requestdata = {}
2986 + if 'buildcache' not in request.requestdata:
2987 + # buildcache is used to cache build information across multiple
2988 + # invocations of SlaveJsonResource. It should be set to an empty
2989 + # collections.defaultdict(dict).
2990 + request.requestdata['buildcache'] = collections.defaultdict(dict)
2991 +
2992 + # Tracks which builders have been stored in the buildcache.
2993 + request.requestdata['buildercache'] = set()
2994 +
2995 results = self.slave_status.asDict()
2996 # Enhance it by adding more informations.
2997 - results['builders'] = {}
2998 - for builderName in self.getBuilders():
2999 - builds = []
3000 - builder_status = self.status.getBuilder(builderName)
3001 - for i in range(1, builder_status.buildCacheSize - 1):
3002 - build_status = builder_status.getBuild(-i)
3003 - if not build_status or not build_status.isFinished():
3004 - # If not finished, it will appear in runningBuilds.
3005 - break
3006 - if build_status.getSlavename() == self.name:
3007 - builds.append(build_status.getNumber())
3008 - results['builders'][builderName] = builds
3009 + results['builders'] = self.getSlaveBuildMap(
3010 + request.requestdata['buildcache'],
3011 + request.requestdata['buildercache'])
3012 return results
3013
3014
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698