task/clock: parallelize
@@ -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,6 +51,8 @@ def task(ctx, config):
'true'
],
timeout = 360,
+ wait=False,
+ )
)
try:
@@ -57,14 +60,16 @@ def task(ctx, config):
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,
+ )
)
@@ -77,14 +82,16 @@ 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:
@@ -92,12 +99,14 @@ def check(ctx, config):
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,
+ )
)
