]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
task/clock: parallelize
authorSage Weil <sage@newdream.net>
Wed, 10 Nov 2021 22:22:44 +0000 (16:22 -0600)
committerSage Weil <sage@newdream.net>
Thu, 11 Nov 2021 23:05:40 +0000 (17:05 -0600)
Signed-off-by: Sage Weil <sage@newdream.net>
teuthology/task/clock.py

index 022eeaf7173b091f58cf863dda5d099ae56bd873..a3f3ecde5412c4527b19348121674785849d7061 100644 (file)
@@ -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,
+            )
+        )