diff -r 9de92a82b7cc buildbot/scheduler.py
|
a
|
b
|
|
| 46 | 46 | # TODO: why can't id() return a positive number? %d is ugly. |
| 47 | 47 | return "<Scheduler '%s' at %d>" % (self.name, id(self)) |
| 48 | 48 | |
| 49 | | def submitBuildSet(self, bs): |
| 50 | | self.parent.submitBuildSet(bs) |
| | 49 | def submitBuildSet(self, bs, notifyScheduler=None): |
| | 50 | self.parent.submitBuildSet(bs, notifyScheduler) |
| 51 | 51 | |
| 52 | 52 | def addChange(self, change): |
| 53 | 53 | pass |
| … |
… |
|
| 55 | 55 | class BaseUpstreamScheduler(BaseScheduler): |
| 56 | 56 | implements(interfaces.IUpstreamScheduler) |
| 57 | 57 | |
| 58 | | def __init__(self, name, properties={}): |
| | 58 | def __init__(self, name, properties={}, notifyScheduler=None): |
| 59 | 59 | BaseScheduler.__init__(self, name, properties) |
| 60 | 60 | self.successWatchers = [] |
| | 61 | self.notifyScheduler = notifyScheduler |
| 61 | 62 | |
| 62 | 63 | def subscribeToSuccessfulBuilds(self, watcher): |
| 63 | 64 | self.successWatchers.append(watcher) |
| … |
… |
|
| 67 | 68 | def submitBuildSet(self, bs): |
| 68 | 69 | d = bs.waitUntilFinished() |
| 69 | 70 | d.addCallback(self.buildSetFinished) |
| 70 | | BaseScheduler.submitBuildSet(self, bs) |
| | 71 | BaseScheduler.submitBuildSet(self, bs, self.notifyScheduler) |
| 71 | 72 | |
| 72 | 73 | def buildSetFinished(self, bss): |
| 73 | 74 | if not self.running: |
| … |
… |
|
| 88 | 89 | |
| 89 | 90 | fileIsImportant = None |
| 90 | 91 | compare_attrs = ('name', 'treeStableTimer', 'builderNames', 'branch', |
| 91 | | 'fileIsImportant', 'properties') |
| | 92 | 'fileIsImportant', 'properties', 'notifyScheduler') |
| 92 | 93 | |
| 93 | 94 | def __init__(self, name, branch, treeStableTimer, builderNames, |
| 94 | | fileIsImportant=None, properties={}): |
| | 95 | fileIsImportant=None, properties={}, notifyScheduler=None): |
| 95 | 96 | """ |
| 96 | 97 | @param name: the name of this Scheduler |
| 97 | 98 | @param branch: The branch name that the Scheduler should pay |
| … |
… |
|
| 118 | 119 | scheduler |
| 119 | 120 | """ |
| 120 | 121 | |
| 121 | | BaseUpstreamScheduler.__init__(self, name, properties) |
| | 122 | BaseUpstreamScheduler.__init__(self, name, properties, notifyScheduler) |
| 122 | 123 | self.treeStableTimer = treeStableTimer |
| 123 | 124 | errmsg = ("The builderNames= argument to Scheduler must be a list " |
| 124 | 125 | "of Builder description names (i.e. the 'name' key of the " |
| … |
… |
|
| 210 | 211 | fileIsImportant = None |
| 211 | 212 | |
| 212 | 213 | compare_attrs = ('name', 'branches', 'treeStableTimer', 'builderNames', |
| 213 | | 'fileIsImportant', 'properties') |
| | 214 | 'fileIsImportant', 'properties', 'notifyScheduler') |
| 214 | 215 | |
| 215 | 216 | def __init__(self, name, branches, treeStableTimer, builderNames, |
| 216 | | fileIsImportant=None, properties={}): |
| | 217 | fileIsImportant=None, properties={}, notifyScheduler=None): |
| 217 | 218 | """ |
| 218 | 219 | @param name: the name of this Scheduler |
| 219 | 220 | @param branches: The branch names that the Scheduler should pay |
| … |
… |
|
| 260 | 261 | if fileIsImportant: |
| 261 | 262 | assert callable(fileIsImportant) |
| 262 | 263 | self.fileIsImportant = fileIsImportant |
| | 264 | self.notifyScheduler = notifyScheduler |
| 263 | 265 | self.schedulers = {} # one per branch |
| 264 | 266 | |
| 265 | 267 | def __repr__(self): |
| … |
… |
|
| 289 | 291 | s = self.schedulerFactory(name, branch, |
| 290 | 292 | self.treeStableTimer, |
| 291 | 293 | self.builderNames, |
| 292 | | self.fileIsImportant) |
| | 294 | self.fileIsImportant, |
| | 295 | notifyScheduler=self.notifyScheduler) |
| 293 | 296 | s.successWatchers = self.successWatchers |
| 294 | 297 | s.setServiceParent(self) |
| 295 | 298 | # TODO: does this result in schedulers that stack up forever? |
| 296 | 299 | # When I make the persistify-pass, think about this some more. |
| 297 | 300 | self.schedulers[branch] = s |
| 298 | 301 | s.addChange(change) |
| | 302 | |
| | 303 | # for some reason, the unittests don't pass unless AnyBranchScheduler has |
| | 304 | # this method. if BaseUpstreamScheduler is modified in this way, they still |
| | 305 | # fail. i suspect it has something to do with me not understanding |
| | 306 | # twisted services enough |
| | 307 | def submitBuildSet(self, bs, junk): |
| | 308 | BaseUpstreamScheduler.submitBuildSet(self, bs) |
| 299 | 309 | |
| 300 | 310 | |
| 301 | 311 | class Dependent(BaseUpstreamScheduler): |