[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 0.42-59-gc28b2f1

Andreas Beckmann debian at abeckmann.de
Sat Mar 10 09:08:53 UTC 2012


The following commit has been merged in the develop branch:
commit db66a0b7cb753be1019fe908652b98837c8be4d2
Author: Andreas Beckmann <debian at abeckmann.de>
Date:   Mon Mar 5 17:57:37 2012 +0100

    let sections sleep on error/idle
    
    let sections sleep after error conditions (master failed, busy)
    and if idle (15/60 minutes, currently hardcoded)
    (processing of other sections continues)
    
    Signed-off-by: Andreas Beckmann <debian at abeckmann.de>

diff --git a/debian/changelog b/debian/changelog
index 8daf45a..bc99dfc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -21,6 +21,7 @@ piuparts (0.44) UNRELEASED; urgency=low
     - Do not leak the logfile file descriptor to piuparts.
     - Do not abort if connection to master failed, just skip the section.
     - Implement simple section locking to allow concurrent slave instances.
+    - Sections wait before retry 15 minutes after error and one hour if idle.
   * piuparts-report.py:
     - Add link to the list of untestable logs.
     - Add more known problem reports: forgotten alternatives, warnings in
diff --git a/piuparts-slave.py b/piuparts-slave.py
index 22724f9..8abb754 100644
--- a/piuparts-slave.py
+++ b/piuparts-slave.py
@@ -247,6 +247,7 @@ class Section:
     def __init__(self, section):
         self._config = Config(section=section)
         self._config.read(CONFIG_FILE)
+        self._sleep_until = 0
         self._slave_directory = os.path.abspath(self._config["slave-directory"])
         if not os.path.exists(self._slave_directory):
             os.mkdir(self._slave_directory)
@@ -298,6 +299,9 @@ class Section:
         return int(self._config["precedence"])
 
     def run(self):
+        if time.time() < self._sleep_until:
+            return 0
+
         logging.info("-------------------------------------------")
         logging.info("Running section %s (precedence=%d)" % (self._config.section, self.precedence()))
         self._config = Config(section=self._config.section)
@@ -308,6 +312,7 @@ class Section:
             fcntl.flock(lock, fcntl.LOCK_EX | fcntl.LOCK_NB)
         except IOError:
             logging.info("busy")
+            self._sleep_until = time.time() + 900
             lock.close()
             return 0
 
@@ -327,9 +332,11 @@ class Section:
             raise
         except MasterIsBusy:
             logging.error("master is busy")
+            self._sleep_until = time.time() + 300
             return 0
         except:
             logging.error("connection to master failed")
+            self._sleep_until = time.time() + 900
             return 0
 
         for logdir in ["pass", "fail", "untestable"]:
@@ -347,6 +354,10 @@ class Section:
         self._slave.get_status(self._config.section)
         self._slave.close()
 
+        if not self._slave.get_reserved():
+            self._sleep_until = time.time() + 3600
+            return 0
+
         test_count = 0
         if self._slave.get_reserved():
             self._check_tarball()

-- 
piuparts git repository



More information about the Piuparts-commits mailing list