[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 0.45-56-gf60418b

Andreas Beckmann debian at abeckmann.de
Wed Jul 18 19:28:47 UTC 2012


The following commit has been merged in the develop branch:
commit 8ee54abc23621a8472eeae096afa11c1e2a3b164
Author: Andreas Beckmann <debian at abeckmann.de>
Date:   Wed Jun 20 22:08:33 2012 +0200

    p-s: talk to master only if we submit or reserve logs
    
    skip connection if we have reserved logs, but nothing to submit
    
    do not request new logs if we are not going to process them
    
    status computation is expensive, request status only after
    after reserving more logs (which requires status computation)
    
    Signed-off-by: Andreas Beckmann <debian at abeckmann.de>

diff --git a/debian/changelog b/debian/changelog
index 4396a05..1bff37f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -21,6 +21,7 @@ piuparts (0.46) UNRELEASED; urgency=low
       packages: skip the section but keep the slave running.
     - Flush finished logs from sections that have processing postponed due to
       precedence settings.
+    - Skip connection to master if we have reserved but no submittable logs.
   * piuparts-report.py:
   * Simplify running piuparts from GIT.
   * Reorganize layout in the GIT repository to reduce path nesting and length.
diff --git a/piuparts-slave.py b/piuparts-slave.py
index c96887a..c5222b4 100644
--- a/piuparts-slave.py
+++ b/piuparts-slave.py
@@ -372,7 +372,7 @@ class Section:
                 logging.info("busy")
                 self._error_wait_until = time.time() + 900
             else:
-                if self._talk_to_master():
+                if self._talk_to_master(fetch=do_processing):
                     if do_processing:
                         if not self._slave.get_reserved():
                             self._idle_wait_until = time.time() + int(self._config["idle-sleep"])
@@ -383,7 +383,12 @@ class Section:
         return 0
 
 
-    def _talk_to_master(self):
+    def _talk_to_master(self, fetch=False):
+        flush = self._count_submittable_logs() > 0
+        fetch = fetch and not self._slave.get_reserved()
+        if not flush and not fetch:
+            return True
+
         try:
             self._connect_to_master()
         except KeyboardInterrupt:
@@ -403,12 +408,11 @@ class Section:
                             self._slave.send_log(self._config.section, logdir, fullname)
                             os.remove(fullname)
 
-                if not self._slave.get_reserved():
+                if fetch:
                     max_reserved = int(self._config["max-reserved"])
                     while len(self._slave.get_reserved()) < max_reserved and self._slave.reserve():
                         pass
-
-                self._slave.get_status(self._config.section)
+                    self._slave.get_status(self._config.section)
             except MasterNotOK:
                 logging.error("master did not respond with 'ok'")
                 self._error_wait_until = time.time() + 900

-- 
piuparts git repository



More information about the Piuparts-commits mailing list