[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

extras-buildsys/server BuildMaster.py, 1.3, 1.4 client_manager.py, 1.19, 1.20



Author: dcbw

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

Modified Files:
	BuildMaster.py client_manager.py 
Log Message:
2005-06-24  Dan Williams <dcbw redhat com>

    * server/BuildMaster.py
      server/client_manager.py
        - Trap more errors




Index: BuildMaster.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/server/BuildMaster.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- BuildMaster.py	19 Jun 2005 03:05:50 -0000	1.3
+++ BuildMaster.py	24 Jun 2005 10:55:15 -0000	1.4
@@ -22,7 +22,7 @@
 import sqlite
 import threading
 import os
-import commands
+import Repo
 
 
 def ensure_build_db_tables(dbcx):
@@ -34,12 +34,22 @@
         dbcx.commit()
     except Exception, e:
         # If DB wasn't created, try to create it
-        curs.execute('CREATE TABLE jobs (uid INTEGER PRIMARY KEY, ' \
+        try:
+            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))')
-        dbcx.commit()
+        except sqlite.OperationalError, e:
+            print "Could not access the job database.  Reason: '%s'.  Exiting..." % e
+            os._exit(1)
+        except sqlite.DatabaseError, e:
+            s = "%s" % e
+            if s != "table jobs already exists":
+                print "Could not access the job database.  Reason: '%s'.  Exiting..." % e
+                os._exit(1)
+        else:
+            dbcx.commit()
 
 
 class BuildMaster(threading.Thread):
@@ -48,7 +58,7 @@
         self.hostname = hostname
         self.building_jobs = []
         self.should_stop = False
-        self.dbcx = sqlite.connect("jobdb", encoding="utf-8", timeout=2)
+        self.dbcx = sqlite.connect("jobdb", encoding="utf-8", timeout=4)
         self.curs = self.dbcx.cursor()
         self.createrepo_lock = threading.Lock()
         self._repo_invalid = True
@@ -102,17 +112,22 @@
                     self.building_jobs.remove(job)
 
             # Grab one waiting job from database and start it
-            self.curs.execute('SELECT uid, username, package, cvs_tag, target' \
-                    ' FROM jobs WHERE status="waiting"')
-            self.dbcx.commit()
-            item = self.curs.fetchone()
-            if item:
-                print "%s (%s): Starting tag '%s' on target '%s'" % (item['uid'], \
-                        item['package'], item['cvs_tag'], item['target'])
-                job = BuildJob.BuildJob(item['uid'], item['username'], item['package'],
-                        item['cvs_tag'], item['target'], self, self.hostname)
-                self.building_jobs.append(job)
-                job.start()
+            try:
+                self.curs.execute('SELECT uid, username, package, cvs_tag, target' \
+                        ' FROM jobs WHERE status="waiting"')
+            except sqlite.OperationalError, e:
+                pass
+            else:
+                self.dbcx.commit()
+                item = self.curs.fetchone()
+                if item:
+                    print "%s (%s): Starting tag '%s' on target '%s'" % (item['uid'], \
+                            item['package'], item['cvs_tag'], item['target'])
+                    repo = self.repos[item['target']]
+                    job = BuildJob.BuildJob(item['uid'], item['username'], item['package'],
+                            item['cvs_tag'], repo, self, self.hostname)
+                    self.building_jobs.append(job)
+                    job.start()
 
             time.sleep(5)
 


Index: client_manager.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/server/client_manager.py,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- client_manager.py	20 Jun 2005 16:20:49 -0000	1.19
+++ client_manager.py	24 Jun 2005 10:55:15 -0000	1.20
@@ -250,7 +250,7 @@
         except SSL.SSLError, e:
             if CommonErrors.canIgnoreSSLError(e):
                 self._unavail_count = self._unavail_count + 1
-        except ProtocolError, e:
+        except xmlrpclib.ProtocolError, e:
             self._unavail_count = self._unavail_count + 1
         else:
             self._unavail_count = 0


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]