]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
teuthology/dispatcher: handle exception while spawning subprocess
authorShraddha Agrawal <shraddha.agrawal000@gmail.com>
Tue, 1 Sep 2020 02:51:41 +0000 (08:21 +0530)
committerJosh Durgin <jdurgin@redhat.com>
Sat, 16 Jan 2021 21:36:26 +0000 (16:36 -0500)
Signed-off-by: Shraddha Agrawal <shraddha.agrawal000@gmail.com>
teuthology/dispatcher/__init__.py

index b460d624dfb823041c73b84bc5a6ddfb13e25e60..ccf2c1312ce870b5e7fb38f030f01b66e1abe314 100644 (file)
@@ -15,6 +15,7 @@ from teuthology.lock.ops import block_and_lock_machines
 from teuthology.dispatcher import supervisor
 from teuthology.worker import prep_job
 from teuthology import safepath
+from teuthology.nuke import nuke
 
 log = logging.getLogger(__name__)
 start_time = datetime.utcnow()
@@ -143,8 +144,18 @@ def main(args):
             yaml.safe_dump(job_config, f, default_flow_style=False)
 
         run_args.extend(["--job-config", job_config_path])
-        job_proc = subprocess.Popen(run_args)
-        log.info('Job supervisor PID: %s', job_proc.pid)
+
+        try:
+            job_proc = subprocess.Popen(run_args)
+            log.info('Job supervisor PID: %s', job_proc.pid)
+        except Exception:
+            error_message = "Saw error while trying to spawn supervisor."
+            log.exception(error_message)
+            if 'targets' in job_config:
+                nuke(supervisor.create_fake_context(job_config), True)
+            report.try_push_job_info(job_config, dict(
+                status='fail',
+                failure_reason=error_message))
 
         # This try/except block is to keep the worker from dying when
         # beanstalkc throws a SocketError