]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
dispatcher: Log the path to the supervisor logfile dispatcher-signal
authorZack Cerza <zack@redhat.com>
Mon, 20 Feb 2023 20:06:07 +0000 (13:06 -0700)
committerZack Cerza <zack@redhat.com>
Mon, 20 Feb 2023 20:08:03 +0000 (13:08 -0700)
Since we're no longer logging that output from the dispatcher, make it
easy to find the supervisor log.

Signed-off-by: Zack Cerza <zack@redhat.com>
scripts/dispatcher.py
teuthology/dispatcher/__init__.py
teuthology/dispatcher/supervisor.py

index 4cb1abdea665803c62ecc5d0ef19fd2fa77f1e07..2d9c4a64ab3086ff845cb702450e5249033f79fc 100644 (file)
@@ -19,6 +19,7 @@ standard arguments:
   -l, --log-dir LOG_DIR          path in which to store logs
   -a DIR, --archive-dir DIR      path to archive results in
   --supervisor                   run dispatcher in job supervisor mode
+  --supervisor-log PATH          in supervisor mode, log to this file
   --bin-path BIN_PATH            teuthology bin path
   --job-config CONFIG            file descriptor of job's config file
   --exit-on-empty-queue          if the queue is empty, exit
index 6684d67d2978bda9489d154f5ee1289046c11485..50769305bb1ccf6bd109108d83418cc9de2ecb21 100644 (file)
@@ -142,6 +142,10 @@ def main(args):
         log.info('Config is: %s', job.body)
         job_config = yaml.safe_load(job.body)
         job_config['job_id'] = str(job_id)
+        supervisor_log = os.path.join(
+            job_config['archive_path'],
+            f"supervisor.{job_id}.log",
+        )
 
         if job_config.get('stop_worker'):
             keep_running = False
@@ -154,6 +158,7 @@ def main(args):
             )
         except SkipJob:
             continue
+        log.info(f"Archive: {archive_dir}")
 
         # lock machines but do not reimage them
         if 'roles' in job_config:
@@ -165,6 +170,7 @@ def main(args):
             '-v',
             '--bin-path', teuth_bin_path,
             '--archive-dir', archive_dir,
+            '--supervisor-log', supervisor_log,
         ]
 
         # Create run archive directory if not already created and
@@ -187,7 +193,7 @@ def main(args):
                 stdin=subprocess.STDOUT,
             )
             job_procs.add(job_proc)
-            log.info('Job supervisor PID: %s', job_proc.pid)
+            log.info(f"Job supervisor PID: {job_proc.pid}, log: {supervisor_log}")
         except Exception:
             error_message = "Saw error while trying to spawn supervisor."
             log.exception(error_message)
index d7a695475d1033d612b15ac1a7084c47c9380a5e..9b653e1e26c32d2b7e09438319366a17008fc8c7 100644 (file)
@@ -33,6 +33,7 @@ def main(args):
     archive_dir = args["--archive-dir"]
     teuth_bin_path = args["--bin-path"]
     config_file_path = args["--job-config"]
+    log_file_path = args["--supervisor-log"]
 
     with open(config_file_path, 'r') as config_file:
         job_config = yaml.safe_load(config_file)
@@ -42,8 +43,6 @@ def main(args):
         loglevel = logging.DEBUG
     log.setLevel(loglevel)
 
-    log_file_path = os.path.join(job_config['archive_path'],
-                                 f"supervisor.{job_config['job_id']}.log")
     setup_log_file(log_file_path)
     install_except_hook()