Trees | Indices | Help |
|
---|
|
1 # This file is part of Buildbot. Buildbot is free software: you can 2 # redistribute it and/or modify it under the terms of the GNU General Public 3 # License as published by the Free Software Foundation, version 2. 4 # 5 # This program is distributed in the hope that it will be useful, but WITHOUT 6 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 7 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more 8 # details. 9 # 10 # You should have received a copy of the GNU General Public License along with 11 # this program; if not, write to the Free Software Foundation, Inc., 51 12 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 13 # 14 # Copyright Buildbot Team Members 15 16 from twisted.internet import reactor 17 from buildbot.db import base 18 from buildbot.util import epoch2datetime 1921 # Documentation is in developer/database.rst 223524 def thd(conn): 25 tbl = self.db.model.builds 26 res = conn.execute(tbl.select(whereclause=(tbl.c.id == bid))) 27 row = res.fetchone() 28 29 rv = None 30 if row: 31 rv = self._bdictFromRow(row) 32 res.close() 33 return rv34 return self.db.pool.do(thd)37 def thd(conn): 38 tbl = self.db.model.builds 39 q = tbl.select(whereclause=(tbl.c.brid == brid)) 40 res = conn.execute(q) 41 return [ self._bdictFromRow(row) for row in res.fetchall() ]42 return self.db.pool.do(thd) 4345 def thd(conn): 46 start_time = _reactor.seconds() 47 r = conn.execute(self.db.model.builds.insert(), 48 dict(number=number, brid=brid, start_time=start_time, 49 finish_time=None)) 50 return r.inserted_primary_key[0]51 return self.db.pool.do(thd) 5254 def thd(conn): 55 transaction = conn.begin() 56 tbl = self.db.model.builds 57 now = _reactor.seconds() 58 59 # split the bids into batches, so as not to overflow the parameter 60 # lists of the database interface 61 remaining = bids 62 while remaining: 63 batch, remaining = remaining[:100], remaining[100:] 64 q = tbl.update(whereclause=(tbl.c.id.in_(batch))) 65 conn.execute(q, finish_time=now) 66 67 transaction.commit()68 return self.db.pool.do(thd) 69 74 75 return dict( 76 bid=row.id, 77 brid=row.brid, 78 number=row.number, 79 start_time=mkdt(row.start_time), 80 finish_time=mkdt(row.finish_time)) 81
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Nov 21 16:23:01 2012 | http://epydoc.sourceforge.net |