[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 0.47-31-g82abac6

Andreas Beckmann debian at abeckmann.de
Mon Nov 5 10:46:33 UTC 2012


The following commit has been merged in the develop branch:
commit a0adbcd6112930f55c42b06b4361534066c68d79
Author: Andreas Beckmann <debian at abeckmann.de>
Date:   Sat Nov 3 12:44:15 2012 +0100

    p-s: retry sections with higher precedence more often
    
    Signed-off-by: Andreas Beckmann <debian at abeckmann.de>

diff --git a/debian/changelog b/debian/changelog
index 3d82781..448a6a4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -19,6 +19,7 @@ piuparts (0.48) UNRELEASED; urgency=low
     - Enable logging by default and set default log-file to
       $SECTION/master.log. Use "/dev/null" to disable logging.
   * piuparts-slave.py:
+    - Retry sections with higher precedence more often.
   * piuparts-report.py:
   * detect_piuparts_issues: Catch the chroot running out of space.
   * reschedule_oldest_logs: Implement logfile expiration. Delete logfiles that
diff --git a/piuparts-slave.py b/piuparts-slave.py
index aedda59..3185ca9 100644
--- a/piuparts-slave.py
+++ b/piuparts-slave.py
@@ -378,12 +378,10 @@ class Section:
         return max(self._error_wait_until, self._idle_wait_until)
 
 
-    def run(self, precedence=None, recycle=False):
+    def run(self, do_processing=True, recycle=False):
         if time.time() < self.sleep_until(recycle=recycle):
             return 0
 
-        do_processing = not got_sighup and \
-                (precedence is None or self.precedence() <= precedence)
         if not do_processing and self._count_submittable_logs() == 0:
             return 0
 
@@ -425,7 +423,11 @@ class Section:
                             if recycle:
                                 self._recycle_wait_until = self._idle_wait_until + 3600
                         else:
-                            return self._process()
+                            processed = self._process()
+                            # put this section at the end of the round-robin runnable queue
+                            self._idle_wait_until = time.time()
+                            self._recycle_wait_until = time.time()
+                            return processed
             finally:
                 os.chdir(oldcwd)
         return 0
@@ -471,6 +473,7 @@ class Section:
                     max_reserved = int(self._config["max-reserved"])
                     idle = self._slave.get_idle()
                     if idle > 0:
+                        idle = min(idle, int(self._config["idle-sleep"]))
                         logging.info("idle (%d)" % idle)
                         if not recycle:
                             self._idle_wait_until = time.time() + idle
@@ -540,7 +543,6 @@ class Section:
             self._slave.forget_reserved(package_name, version)
             if interrupted:
                 break
-        self._recycle_wait_until = time.time()
         self._talk_to_master(unreserve=interrupted)
         if interrupted:
             raise KeyboardInterrupt
@@ -792,16 +794,12 @@ def main():
                 for section_name in section_names]
 
     while True:
+        global got_sighup
         test_count = 0
-        precedence = None
 
-        for section in sorted(sections, key=lambda section: section.precedence()):
-            processed = section.run(precedence=precedence)
-            if processed > 0:
-                test_count += processed
-                precedence = section.precedence()
+        for section in sorted(sections, key=lambda section: (section.precedence(), section.sleep_until())):
+            test_count += section.run(do_processing=(test_count == 0 and not got_sighup))
 
-        global got_sighup
         if test_count == 0 and got_sighup:
             # clear SIGHUP state after flushing all sections
             got_sighup = False

-- 
piuparts git repository



More information about the Piuparts-commits mailing list