From 0094010b32bddf5cb4096521fa98fd92ba93e276 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 10 Nov 2021 16:22:44 -0600 Subject: [PATCH] task/clock: parallelize Signed-off-by: Sage Weil --- teuthology/task/clock.py | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/teuthology/task/clock.py b/teuthology/task/clock.py index 022eeaf717..a3f3ecde54 100644 --- a/teuthology/task/clock.py +++ b/teuthology/task/clock.py @@ -30,8 +30,9 @@ def task(ctx, config): """ log.info('Syncing clocks and checking initial clock skew...') - for rem in ctx.cluster.remotes.keys(): - rem.run( + + run.wait( + ctx.cluster.run( args = [ 'sudo', 'systemctl', 'stop', 'ntp.service', run.Raw('||'), 'sudo', 'systemctl', 'stop', 'ntpd.service', run.Raw('||'), @@ -50,22 +51,26 @@ def task(ctx, config): 'true' ], timeout = 360, + wait=False, ) + ) try: yield finally: log.info('Checking final clock skew...') - for rem in ctx.cluster.remotes.keys(): - rem.run( + run.wait( + ctx.cluster.run( args=[ 'PATH=/usr/bin:/usr/sbin', 'ntpq', '-p', run.Raw('||'), 'PATH=/usr/bin:/usr/sbin', 'chronyc', 'sources', run.Raw('||'), 'true' - ], - ) + ], + wait=False, + ) + ) @contextlib.contextmanager @@ -77,27 +82,31 @@ def check(ctx, config): :param config: Configuration """ log.info('Checking initial clock skew...') - for rem in ctx.cluster.remotes.keys(): - rem.run( + run.wait( + ctx.cluster.run( args=[ 'PATH=/usr/bin:/usr/sbin', 'ntpq', '-p', run.Raw('||'), 'PATH=/usr/bin:/usr/sbin', 'chronyc', 'sources', run.Raw('||'), 'true' - ], - ) + ], + wait=False, + ) + ) try: yield finally: log.info('Checking final clock skew...') - for rem in ctx.cluster.remotes.keys(): - rem.run( + run.wait( + ctx.cluster.run( args=[ 'PATH=/usr/bin:/usr/sbin', 'ntpq', '-p', run.Raw('||'), 'PATH=/usr/bin:/usr/sbin', 'chronyc', 'sources', run.Raw('||'), 'true' - ], - ) + ], + wait=False, + ) + ) -- 2.39.5