extras-buildsys/server BuildMaster.py, 1.28, 1.29 PackageJob.py, 1.20, 1.21

Daniel Williams (dcbw) fedora-extras-commits at redhat.com
Sat Aug 6 17:58:36 UTC 2005


Author: dcbw

Update of /cvs/fedora/extras-buildsys/server
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv367/server

Modified Files:
	BuildMaster.py PackageJob.py 
Log Message:
Ensure existing status updates get written to the db before the job gets finished, and make sure job result gets written on job finish as well


Index: BuildMaster.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/server/BuildMaster.py,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- BuildMaster.py	5 Aug 2005 16:24:12 -0000	1.28
+++ BuildMaster.py	6 Aug 2005 17:58:34 -0000	1.29
@@ -269,8 +269,17 @@
 
         for job in self._done_queue:
             uid = job.get_uid()
+
+            # Write any existing status update first
+            self._status_updates_lock.acquire()
+            if self._status_updates.has_key(uid):
+                self._write_job_status_to_db(uid, self._status_updates[uid])
+                del self._status_updates[uid]
+            self._status_updates_lock.release()
+
             attrdict = {}
             attrdict['status'] = job.get_cur_stage()
+            attrdict['result'] = job.get_result()
             self._write_job_status_to_db(uid, attrdict)
 
             # Update job end time
@@ -280,12 +289,6 @@
                 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):
-                del self._status_updates[uid]
-            self._status_updates_lock.release()
-
             print "%s (%s): Job finished." % (uid, job.package)
 
             self._building_jobs_lock.acquire()


Index: PackageJob.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/server/PackageJob.py,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- PackageJob.py	6 Aug 2005 16:01:38 -0000	1.20
+++ PackageJob.py	6 Aug 2005 17:58:34 -0000	1.21
@@ -149,6 +149,9 @@
     def get_cur_stage(self):
         return self.curstage
 
+    def get_result(self):
+        return self.result
+
     def _set_cur_stage(self, stage, result_msg=None):
         """ Update our internal job stage, and notify the BuildMaster that
             we've changed as well.
@@ -158,8 +161,7 @@
         if oldstage != stage:
             attrdict = {}
             attrdict['status'] = copy.copy(stage)
-            if self.result:
-                attrdict['result'] = copy.copy(self.result)
+            attrdict['result'] = copy.copy(self.result)
             if self.name and self.epoch and self.ver and self.release:
                 attrdict['epoch'] = self.epoch
                 attrdict['version'] = self.ver




More information about the scm-commits mailing list