[Piuparts-commits] [SCM] piuparts git repository branch, master, updated. eda668423fa87898c59d1075118693714aa5a053

Andreas Beckmann debian at abeckmann.de
Fri Dec 23 10:28:21 UTC 2011


The following commit has been merged in the master branch:
commit 2bb86b0adca71c6fdc6e201f8247c6e04e52038a
Author: Andreas Beckmann <debian at abeckmann.de>
Date:   Sun Nov 27 18:40:12 2011 +0100

    implement a precedence setting to prioritize sections
    
    implement a precedence setting to suspend lower priority sections
    while the more important ones have packages waiting for processing
    
    Signed-off-by: Andreas Beckmann <debian at abeckmann.de>

diff --git a/README.txt b/README.txt
index 8daf4eb..e6932b5 100644
--- a/README.txt
+++ b/README.txt
@@ -440,6 +440,8 @@ is being run.
 
 * "keep-sources-list" controls whether the slave runs piuparts with the '--keep-sources-list' option.  This option does not apply to upgrade tests.  The value should be "yes" or "no", with the default being "no".  Use this option for dists that you need a custom sources.list for, such as "stable-proposed-updates".
 
+* "precedence" controls the order the sections are being processed by the slave. Sections with a larger precedence value will be run only if all sections with a smaller precedence value are idle, i.e. master does not have any packages that this slave could test. Sections with the same precedence value will be processed round-robin until they are all idle (or a more important section has packages to be tested). The default is 1.
+
 * "debug" tells the slave whether to log debug level messages. The value should be "yes" or "no", with the default being "no". piuparts itself currently always produces debug output and there is no way to disable that.
 
 Some of the configuration items are not required, but it is best
diff --git a/debian/changelog b/debian/changelog
index 4e19eeb..177973d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -106,6 +106,9 @@ piuparts (0.42) UNRELEASED; urgency=low
     - Log tarball creation in *.tgz.log.
     - Request and print package counts from master.
     - Reload section config every time a section is being run.
+    - Add precedence attribute to allow prioritizing different sections and to
+      suspend processing of low priority ones while there are packages waiting
+      in more important sections.
   * piuparts-report.py: 
     - state-*.html: Sort package lists by name, display state of all
       alternative dependencies and packages providing a virtual dependency.
diff --git a/piuparts-slave.py b/piuparts-slave.py
index 1ed1ecc..436900a 100644
--- a/piuparts-slave.py
+++ b/piuparts-slave.py
@@ -81,6 +81,7 @@ class Config(piupartslib.conf.Config):
                 "debug": "no",
                 "keep-sources-list": "no",
                 "arch": None,
+                "precedence": "1",
             }, "")
 
 
@@ -283,9 +284,12 @@ class Section:
             create_or_replace_chroot_tgz(self._config, tarball,
                       self._base_tgz_ctrl, self._config["upgrade-test-distros"].split()[0])
 
+    def precedence(self):
+        return int(self._config["precedence"])
+
     def run(self):
         logging.info("-------------------------------------------")
-        logging.info("Running section " + self._config.section)
+        logging.info("Running section %s (precedence=%d)" % (self._config.section, self.precedence()))
         self._config = Config(section=self._config.section)
         self._config.read(CONFIG_FILE)
         self._slave.connect_to_master(self._log_file)
@@ -561,9 +565,14 @@ def main():
 
     while True:
         test_count = 0
-
-        for section in sections:
-            test_count += section.run()
+        precedence = None
+
+        for section in sorted(sections, key=lambda section: section.precedence()):
+            if precedence is None or section.precedence() <= precedence:
+                processed = section.run()
+                if processed > 0:
+                    test_count += processed
+                    precedence = section.precedence()
 
         if test_count == 0:
             sleep_time = int(global_config["idle-sleep"])

-- 
piuparts git repository



More information about the Piuparts-commits mailing list