]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
minor fix
authorShraddha Agrawal <shraddha.agrawal000@gmail.com>
Tue, 25 Aug 2020 20:14:05 +0000 (01:44 +0530)
committerShraddha Agrawal <shraddha.agrawal000@gmail.com>
Tue, 25 Aug 2020 20:25:13 +0000 (01:55 +0530)
Signed-off-by: Shraddha Agrawal <shraddha.agrawal000@gmail.com>
scripts/dispatcher.py
teuthology/dispatcher/supervisor.py
teuthology/lock/ops.py

index 5c65d8a401fb3125cb750251c4e13370ae4dc686..7c75f38b7ccb0276e3ccdf8e60bea55844dc6bc8 100644 (file)
@@ -17,7 +17,7 @@ standard arguments:
   -v, --verbose                  be more verbose
   -t, --tube TUBE                which beanstalk tube to read jobs from
   -l, --log-dir LOG_DIR          path in which to store logs
-  -a DIR, --archive-dir DIR     path to archive results in
+  -a DIR, --archive-dir DIR      path to archive results in
   --supervisor                   run dispatcher in job supervisor mode
   --bin-path BIN_PATH            teuthology bin path
   --job-config CONFIG            file descriptor of job's config file
index bc58e2788d1107274a077a5ad16853c79a06d255..28d03686d084bbc013e79019b5f67edc48c1c93d 100644 (file)
@@ -12,7 +12,7 @@ from teuthology import safepath
 from teuthology.config import config as teuth_config
 from teuthology.exceptions import SkipJob
 from teuthology import setup_log_file, install_except_hook
-from teuthology.lock.ops import reimage_many
+from teuthology.lock.ops import reimage_machines
 from teuthology.misc import get_user, archive_logs, compress_logs
 from teuthology.config import FakeNamespace
 from teuthology.job_status import get_status
@@ -47,7 +47,7 @@ def main(args):
 
     # reimage target machines before running the job
     if 'targets' in job_config:
-        reimage_machines(job_config)
+        reimage(job_config)
         with open(config_file_path, 'w') as f:
             yaml.safe_dump(job_config, f, default_flow_style=False)
 
@@ -152,7 +152,7 @@ def run_job(job_config, teuth_bin_path, archive_dir, verbose):
         unlock_targets(job_config)
 
 
-def reimage_machines(job_config):
+def reimage(job_config):
     # Reimage the targets specified in job config
     # and update their keys in config after reimaging
     ctx = create_fake_context(job_config)
@@ -160,7 +160,7 @@ def reimage_machines(job_config):
     report.try_push_job_info(ctx.config, dict(status='waiting'))
     targets = job_config['targets']
     try:
-        reimaged = reimage_many(ctx, targets, job_config['machine_type'])
+        reimaged = reimage_machines(ctx, targets, job_config['machine_type'])
     except Exception:
         log.info('Reimaging error. Nuking machines...')
         # Reimage failures should map to the 'dead' status instead of 'fail'
index 8f625af82414e72fac5eb220ef08d93b6f317925..2becfbff2a3e8b6b7992b11d5328aaf633bf3006 100644 (file)
@@ -133,7 +133,7 @@ def lock_many(ctx, num, machine_type, user=None, description=None,
                 update_nodes(ok_machs)
                 return ok_machs
             elif reimage and machine_type in reimage_types:
-                return reimage_many(ctx, machines, machine_type)
+                return reimage_machines(ctx, machines, machine_type)
             return machines
         elif response.status_code == 503:
             log.error('Insufficient nodes available to lock %d %s nodes.',
@@ -287,20 +287,7 @@ def push_new_keys(keys_dict, reference):
     return ret
 
 
-def reimage(ctx, machines, machine_type):
-    reimaged = dict()
-    with teuthology.parallel.parallel() as p:
-        for machine in machines:
-            log.info("Start node '%s' reimaging", machine)
-            update_nodes([machine], True)
-            p.spawn(teuthology.provision.reimage, ctx,
-                    machine, machine_type)
-            reimaged[machine] = machines[machine]
-            log.info("Node '%s' reimaging is complete", machine)
-    return reimaged
-
-
-def reimage_many(ctx, machines, machine_type):
+def reimage_machines(ctx, machines, machine_type):
     # Setup log file, reimage machines and update their keys
     reimaged = dict()
     console_log_conf = dict(
@@ -309,7 +296,14 @@ def reimage_many(ctx, machines, machine_type):
                  for machine in machines],
     )
     with console_log.task(ctx, console_log_conf):
-        reimaged = reimage(ctx, machines, machine_type)
+        with teuthology.parallel.parallel() as p:
+            for machine in machines:
+                log.info("Start node '%s' reimaging", machine)
+                update_nodes([machine], True)
+                p.spawn(teuthology.provision.reimage, ctx,
+                        machine, machine_type)
+                reimaged[machine] = machines[machine]
+                log.info("Node '%s' reimaging is complete", machine)
     reimaged = do_update_keys(list(reimaged.keys()))[1]
     update_nodes(reimaged)
     return reimaged