Skip to content

Commit

Permalink
restore master.addBuildset, with deprecation warning
Browse files Browse the repository at this point in the history
  • Loading branch information
djmitche committed Oct 14, 2012
1 parent 99b215d commit 4738611
Showing 1 changed file with 47 additions and 1 deletion.
48 changes: 47 additions & 1 deletion master/buildbot/master.py
Expand Up @@ -26,7 +26,7 @@

import buildbot
import buildbot.pbmanager
from buildbot.util import datetime2epoch, ascii2unicode
from buildbot.util import epoch2datetime, datetime2epoch, ascii2unicode
from buildbot.status.master import Status
from buildbot.changes import changes
from buildbot.changes.manager import ChangeManager
Expand All @@ -42,6 +42,7 @@
from buildbot.process import metrics
from buildbot.process import cache
from buildbot.process.users.manager import UserManagerManager
from buildbot.status.results import SUCCESS, WARNINGS, FAILURE
from buildbot import monkeypatches
from buildbot import config

Expand Down Expand Up @@ -407,6 +408,51 @@ def handle_deprec(oldname, newname):
change = yield changes.Change.fromChdict(self, chdict)
defer.returnValue(change)

@defer.inlineCallbacks
def addBuildset(self, scheduler, **kwargs):
log.msg("WARNING: master.addBuildset is deprecated; "
"use the data API update method")
bsid, brids = yield self.data.updates.addBuildset(
scheduler=scheduler, **kwargs)
defer.returnValue((bsid,brids))

@defer.inlineCallbacks
def maybeBuildsetComplete(self, bsid, _reactor=reactor):
"""
Instructs the master to check whether the buildset is complete,
and notify appropriately if it is.
Note that buildset completions are only reported on the master
on which the last build request completes.
"""
brdicts = yield self.db.buildrequests.getBuildRequests(
bsid=bsid, complete=False)

# if there are incomplete buildrequests, bail out
if brdicts:
return

brdicts = yield self.db.buildrequests.getBuildRequests(bsid=bsid)

# figure out the overall results of the buildset
cumulative_results = SUCCESS
for brdict in brdicts:
if brdict['results'] not in (SUCCESS, WARNINGS):
cumulative_results = FAILURE

# mark it as completed in the database
complete_at_epoch = _reactor.seconds()
complete_at = epoch2datetime(complete_at_epoch)
yield self.db.buildsets.completeBuildset(bsid, cumulative_results,
complete_at=complete_at)

# new-style notification
msg = dict(
bsid=bsid,
complete_at=complete_at_epoch,
results=cumulative_results)
self.mq.produce(('buildset', str(bsid), 'complete'), msg)


## state maintenance (private)

Expand Down

0 comments on commit 4738611

Please sign in to comment.