From df1436f0e57d8db2c1f745c5c8a41290ea402b6b Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Thu, 8 Dec 2016 12:08:47 -0700 Subject: [PATCH] worker: reload teuthology config before each job The new suite_repo setting was persisting between jobs, which is... undesirable. Signed-off-by: Zack Cerza --- teuthology/worker.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/teuthology/worker.py b/teuthology/worker.py index c82f70b6..e5e3efc8 100644 --- a/teuthology/worker.py +++ b/teuthology/worker.py @@ -46,6 +46,18 @@ def stop(): sys.exit(0) +def load_config(ctx=None): + teuth_config.load() + if ctx is not None: + if not os.path.isdir(ctx.archive_dir): + sys.exit("{prog}: archive directory must exist: {path}".format( + prog=os.path.basename(sys.argv[0]), + path=ctx.archive_dir, + )) + else: + teuth_config.archive_base = ctx.archive_dir + + def install_except_hook(): """ Install an exception hook that first logs any uncaught exception, then @@ -71,13 +83,7 @@ def main(ctx): install_except_hook() - if not os.path.isdir(ctx.archive_dir): - sys.exit("{prog}: archive directory must exist: {path}".format( - prog=os.path.basename(sys.argv[0]), - path=ctx.archive_dir, - )) - else: - teuth_config.archive_base = ctx.archive_dir + load_config(ctx=ctx) set_config_attr(ctx) @@ -103,6 +109,8 @@ def main(ctx): elif sentinel(stop_file_path): stop() + load_config() + job = connection.reserve(timeout=60) if job is None: continue -- 2.47.3