Skip to content

Commit

Permalink
do not consider completed buildrequests unclaimed
Browse files Browse the repository at this point in the history
  • Loading branch information
djmitche committed Apr 24, 2011
1 parent 340cf2f commit 5c99614
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 4 additions & 2 deletions master/buildbot/db/buildrequests.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ def getBuildRequests(self, buildername=None, complete=None, claimed=None):
claimed status of requests; C{True} to return only claimed builds,
C{False} to return only unclaimed builds, or C{"mine"} to return only
builds claimed by this master instance. A request is considered
unclaimed if its C{claimed_at} column is either NULL or 0.
unclaimed if its C{claimed_at} column is either NULL or 0, and it is
not complete.
A build is considered completed if its C{complete} column is 1; the
C{complete_at} column is not consulted.
Expand Down Expand Up @@ -102,7 +103,8 @@ def thd(conn):
((tbl.c.claimed_at == None) |
(tbl.c.claimed_at == 0)) &
(tbl.c.claimed_by_name == None) &
(tbl.c.claimed_by_incarnation == None))
(tbl.c.claimed_by_incarnation == None) &
(tbl.c.complete == 0))
elif claimed == "mine":
master_name = self.db.master.master_name
master_incarnation = self.db.master.master_incarnation
Expand Down
7 changes: 6 additions & 1 deletion master/buildbot/test/unit/test_db_buildrequests.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ def do_test_getBuildRequests_claim_args(self, **kwargs):
fakedb.BuildRequest(id=52, buildsetid=self.BSID,
claimed_at=0, claimed_by_name=None,
claimed_by_incarnation=None),
# 53: unclaimed but complete (should not appear for claimed=False)
fakedb.BuildRequest(id=53, buildsetid=self.BSID,
claimed_at=0, claimed_by_name=None,
claimed_by_incarnation=None,
complete=1),
])
d.addCallback(lambda _ :
self.db.buildrequests.getBuildRequests(**kwargs))
Expand All @@ -126,7 +131,7 @@ def check(brlist):

def test_getBuildRequests_no_claimed_arg(self):
return self.do_test_getBuildRequests_claim_args(
expected=[50, 51, 52])
expected=[50, 51, 52, 53])

def test_getBuildRequests_claimed_mine(self):
return self.do_test_getBuildRequests_claim_args(
Expand Down

0 comments on commit 5c99614

Please sign in to comment.