extras-buildsys/builder builder.py,1.50,1.51

Daniel Williams (dcbw) fedora-extras-commits at redhat.com
Sun Feb 19 06:52:18 UTC 2006


Author: dcbw

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

Modified Files:
	builder.py 
Log Message:
2006-02-19  Dan Williams  <dcbw at redhat.com>

    * builder/builder.py
        - Kill jobs in 'downloaded' state after 30 minutes, because it's
            likely there was an error returning the archjob's UID to the
            server.  In this case, the server has already gone on and
            assigned the job to another builder.
        - (run): Move execution of the status function outside of the try/except
            block so we don't mask AttributeErrors in the code




Index: builder.py
===================================================================
RCS file: /cvs/fedora/extras-buildsys/builder/builder.py,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- builder.py	24 Jan 2006 17:39:40 -0000	1.50
+++ builder.py	19 Feb 2006 06:52:11 -0000	1.51
@@ -85,7 +85,7 @@
         self._status = 'init'
         self._die = False
         self._repo_locked = True
-        self._repo_locked_msg = False
+        self._repo_wait_start = 0
         self._files = []
         self._childpid = 0
         self._target_cfg = target_cfg
@@ -341,9 +341,15 @@
             self._start_build()
         else:
             # Only show this message once
-            if not self._repo_locked_msg:
+            if self._repo_wait_start <= 0:
                 self._log("Waiting for repository to unlock before starting the build...\n")
-                self._repo_locked_msg = True
+                self._repo_wait_start = time.time()
+
+            # Kill a job in 'downloaded' state after 30 minutes because
+            # it's likely orphaned
+            if time.time() > (self._repo_wait_start + (60 * 30)):
+                self._log("Job waited too long for repo to unlock. Killing it...\n")
+                self.die()
 
     def _watch_mock(self, good_exit, bad_exit):
         (aux_pid, status) = os.waitpid(self._childpid, os.WNOHANG)
@@ -457,11 +463,12 @@
             # Execute operations for our current status
             try:
                 func = getattr(self, "_status_%s" % self._status)
-                func()
-                time.sleep(3)
             except AttributeError:
                 self._log("ERROR: internal builder inconsistency, didn't recognize status '%s'.\n" % self._status)
                 self._status = 'failed'
+            else:
+                func()
+            time.sleep(3)
 
         self._job_done()
         self._endtime = time.time()




More information about the scm-commits mailing list