From 95e53828f7072840c25a0fe4e934fec209d9b227 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Thibaut=20VAR=C3=88NE?= Date: Fri, 22 Jun 2018 16:17:06 +0200 Subject: [PATCH] phase1: move max_builds to slave properties MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Thibaut VARÈNE --- phase1/master.cfg | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/phase1/master.cfg b/phase1/master.cfg index 4132f27..15a1be8 100644 --- a/phase1/master.cfg +++ b/phase1/master.cfg @@ -48,18 +48,18 @@ if ini.has_option("general", "port"): slave_port = ini.getint("general", "port") c['slaves'] = [] -max_builds = dict() NetLocks = dict() for section in ini.sections(): if section.startswith("slave "): if ini.has_option(section, "name") and ini.has_option(section, "password"): - sl_props = { 'dl_lock':None, 'ul_lock':None, 'do_cleanup':False } + sl_props = { 'dl_lock':None, 'ul_lock':None, 'do_cleanup':False, 'max_builds':1 } name = ini.get(section, "name") password = ini.get(section, "password") - max_builds[name] = 1 + max_builds = 1 if ini.has_option(section, "builds"): - max_builds[name] = ini.getint(section, "builds") + max_builds = ini.getint(section, "builds") + sl_props['max_builds'] = max_builds if ini.has_option(section, "cleanup"): sl_props['do_cleanup'] = ini.getboolean(section, "cleanup") if ini.has_option(section, "dl_lock"): @@ -72,7 +72,7 @@ for section in ini.sections(): sl_props['ul_lock'] = lockname if lockname not in NetLocks: NetLocks[lockname] = locks.MasterLock(lockname) - c['slaves'].append(BuildSlave(name, password, max_builds = max_builds[name], properties = sl_props)) + c['slaves'].append(BuildSlave(name, password, max_builds = max_builds, properties = sl_props)) # 'slavePortnum' defines the TCP port to listen on for connections from slaves. # This must match the value configured into the buildslaves (with their @@ -283,8 +283,8 @@ def GetVersionPrefix(props): return "" def GetNumJobs(props): - if props.hasProperty("slavename") and props.hasProperty("nproc"): - return (int(props["nproc"]) / (max_builds[props["slavename"]] + other_builds)) + if props.hasProperty("max_builds") and props.hasProperty("nproc"): + return (int(props["nproc"]) / (props["max_builds"] + other_builds)) else: return 1 -- 2.30.2