From d1fecc11c95a9482838ab1a158ec2d062d7512d3 Mon Sep 17 00:00:00 2001 From: Jim Ladd Date: Fri, 15 Oct 2021 16:45:21 -0700 Subject: [PATCH] when releasing receptor work, do so in try/except --- awx/main/tasks.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/awx/main/tasks.py b/awx/main/tasks.py index 90b5672241..e5a30098a6 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -3071,7 +3071,13 @@ class AWXReceptorJob: finally: # Make sure to always release the work unit if we established it if self.unit_id is not None and settings.RECEPTOR_RELEASE_WORK: - receptor_ctl.simple_command(f"work release {self.unit_id}") + try: + receptor_ctl.simple_command(f"work release {self.unit_id}") + except RuntimeError: + logger.exception(f"Unable to release work item {self.unit_id}") + # If an error occured without the job itself failing, it could be a broken instance + if self.work_type == 'ansible-runner' and ((res is None) or (getattr(res, 'rc', None) is None)): + execution_node_health_check.delay(self.task.instance.execution_node) @property def sign_work(self):