[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 0.45-102-g4c48ac2
Andreas Beckmann
debian at abeckmann.de
Fri Aug 3 08:52:00 UTC 2012
The following commit has been merged in the develop branch:
commit 4c48ac246762b76d10702e13e6d07c8eaf933fd0
Author: Andreas Beckmann <debian at abeckmann.de>
Date: Sun Jul 22 14:08:13 2012 +0200
p-s: issue "idle" command before "reserve"
avoid status computation if master is idle
Signed-off-by: Andreas Beckmann <debian at abeckmann.de>
diff --git a/debian/changelog b/debian/changelog
index ed2b41b..d01290f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -61,6 +61,8 @@ piuparts (0.46) UNRELEASED; urgency=low
processing. Recycle logfiles until a section becomes available for
regular processing. If no logfiles could be recycled, retry after an
hour.
+ - Issue "idle" command before "reserve" and skip status computation and
+ reserving if master is idle.
* 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 597cc08..956e0ee 100644
--- a/piuparts-slave.py
+++ b/piuparts-slave.py
@@ -253,6 +253,15 @@ class Slave:
if line != "ok\n":
raise MasterCantRecycle()
+ def get_idle(self):
+ self._writeline("idle")
+ line = self._readline()
+ words = line.split()
+ if words and words[0] == "ok":
+ return int(words[1])
+ else:
+ raise MasterIsCrazy()
+
def reserve(self):
self._writeline("reserve")
line = self._readline()
@@ -460,6 +469,14 @@ class Section:
if fetch:
max_reserved = int(self._config["max-reserved"])
+ idle = self._slave.get_idle()
+ if idle > 0:
+ logging.info("idle (%d)" % idle)
+ if not recycle:
+ self._idle_wait_until = time.time() + idle
+ else:
+ self._recycle_wait_until = time.time() + idle
+ return 0
while len(self._slave.get_reserved()) < max_reserved and self._slave.reserve():
pass
self._slave.get_status(self._config.section)
--
piuparts git repository
More information about the Piuparts-commits
mailing list