extras-buildsys/server BuildMaster.py, 1.17, 1.18 UserInterface.py, 1.22, 1.23
Daniel Williams (dcbw)
fedora-extras-commits at redhat.com
Wed Jul 20 18:11:39 UTC 2005
Author: dcbw
Update of /cvs/fedora/extras-buildsys/server
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv17471/server
Modified Files:
BuildMaster.py UserInterface.py
Log Message:
Add an endtime to jobs
Index: BuildMaster.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/server/BuildMaster.py,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- BuildMaster.py 18 Jul 2005 21:11:27 -0000 1.17
+++ BuildMaster.py 20 Jul 2005 18:11:37 -0000 1.18
@@ -55,8 +55,8 @@
curs.execute('CREATE TABLE jobs (uid INTEGER PRIMARY KEY, ' \
'username VARCHAR(20), package VARCHAR(50), ' \
'cvs_tag VARCHAR(255), target VARCHAR(20), ' \
- 'buildreq VARCHAR(75), time_submitted BIGINT, ' \
- 'status VARCHAR(15))')
+ 'buildreq VARCHAR(75), starttime BIGINT, ' \
+ 'endtime BIGINT, status VARCHAR(15))')
except sqlite.OperationalError, e:
print "Could not access the job database. Reason: '%s'. Exiting..." % e
os._exit(1)
@@ -215,6 +215,13 @@
uid = job.get_uid()
self._write_job_status_to_db(uid, curstage)
+ # Update job end time
+ try:
+ self.curs.execute('UPDATE jobs SET endtime=%d WHERE uid=%d' % (time.time(), uid))
+ except sqlite.OperationalError, e:
+ print "DB Error: could not access jobs database. Reason: '%s'" % e
+ self.dbcx.commit()
+
# If there are any status updates in the queue for this job, remove them
self._status_updates_lock.acquire()
if self._status_updates.has_key(uid):
@@ -286,8 +293,8 @@
continue
self.curs.execute('INSERT INTO jobs (uid, username, package,' \
- ' cvs_tag, target, buildreq, time_submitted, status)' \
- ' VALUES (NULL, "%s", "%s", "%s", "%s", "%s", %d, "%s")' \
+ ' cvs_tag, target, buildreq, starttime, endtime, status)' \
+ ' VALUES (NULL, "%s", "%s", "%s", "%s", "%s", %d, 0, "%s")' \
% (item['email'], item['package'], locator, item['target'], \
item['buildreq'], item['time'], 'waiting'))
self.dbcx.commit()
@@ -295,7 +302,7 @@
# Find the UID
self.curs.execute('SELECT uid FROM jobs WHERE username="%s" AND' \
' package="%s" AND cvs_tag="%s" AND target="%s" AND' \
- ' buildreq="%s" AND time_submitted=%d AND status="waiting"' \
+ ' buildreq="%s" AND starttime=%d AND status="waiting"' \
% (item['email'], item['package'], locator, item['target'], \
item['buildreq'], item['time']))
self.dbcx.commit()
Index: UserInterface.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/server/UserInterface.py,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- UserInterface.py 20 Jul 2005 16:10:39 -0000 1.22
+++ UserInterface.py 20 Jul 2005 18:11:37 -0000 1.23
@@ -151,7 +151,7 @@
def list_jobs(self, args_dict):
""" Query job information and return it to the user """
- sql = 'SELECT uid, username, package, cvs_tag, target, time_submitted, status FROM jobs WHERE '
+ sql = 'SELECT uid, username, package, cvs_tag, target, starttime, endtime, status FROM jobs WHERE '
sql_args = []
if args_dict.has_key('email') and args_dict['email']:
@@ -211,8 +211,9 @@
jobrec['package'] = row[2]
jobrec['source'] = row[3]
jobrec['target'] = row[4]
- jobrec['submit_time'] = row[5]
- jobrec['status'] = row[6]
+ jobrec['starttime'] = row[5]
+ jobrec['endtime'] = row[6]
+ jobrec['status'] = row[7]
jobrec['archjobs'] = []
jobs.append(copy.deepcopy(jobrec))
More information about the scm-commits
mailing list