]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
supervisor: Check for job expiration 1983/head
authorZack Cerza <zack@redhat.com>
Thu, 1 Aug 2024 18:16:04 +0000 (12:16 -0600)
committerZack Cerza <zack@redhat.com>
Thu, 8 Aug 2024 00:06:32 +0000 (18:06 -0600)
This commit isn't strictly necessary for the feature's implementation, but will
allow testing the feature on the production teuthology cluster before merging.

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

index d2e86de364ceb4bfefa9743bda735ef749d0c898..83e6d997c5d3949d4d08cb7094a023926697c9a8 100644 (file)
@@ -8,7 +8,7 @@ import requests
 
 from urllib.parse import urljoin
 
-from teuthology import exporter, kill, report, safepath
+from teuthology import exporter, dispatcher, kill, report, safepath
 from teuthology.config import config as teuth_config
 from teuthology.exceptions import SkipJob, MaxWhileTries
 from teuthology import setup_log_file, install_except_hook
@@ -37,6 +37,10 @@ def main(args):
                                  f"supervisor.{job_config['job_id']}.log")
     setup_log_file(log_file_path)
     install_except_hook()
+    try:
+        dispatcher.check_job_expiration(job_config)
+    except SkipJob:
+        return 0
 
     # reimage target machines before running the job
     if 'targets' in job_config:
@@ -54,25 +58,22 @@ def main(args):
         with open(args.job_config, 'w') as f:
             yaml.safe_dump(job_config, f, default_flow_style=False)
 
-    try:
-        suite = job_config.get("suite")
-        if suite:
-            with exporter.JobTime().time(suite=suite):
-                return run_job(
-                    job_config,
-                    args.bin_path,
-                    args.archive_dir,
-                    args.verbose
-                )
-        else:
+    suite = job_config.get("suite")
+    if suite:
+        with exporter.JobTime().time(suite=suite):
             return run_job(
                 job_config,
                 args.bin_path,
                 args.archive_dir,
                 args.verbose
             )
-    except SkipJob:
-        return 0
+    else:
+        return run_job(
+            job_config,
+            args.bin_path,
+            args.archive_dir,
+            args.verbose
+        )
 
 
 def run_job(job_config, teuth_bin_path, archive_dir, verbose):