From 6a7520d10fae18d43ee0d0f65b5d364ea5dcc0b6 Mon Sep 17 00:00:00 2001 From: Shane McDonald Date: Tue, 9 Feb 2021 11:12:28 -0500 Subject: [PATCH] Handle quota exceeded in Container Groups v2 --- awx/main/tasks.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/awx/main/tasks.py b/awx/main/tasks.py index 9fa0456fff..ab9484eba9 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -1451,6 +1451,9 @@ class BaseTask(object): receptor_job = AWXReceptorJob(self, params) res = receptor_job.run() + if not res: + return + status = res.status rc = res.rc @@ -3112,7 +3115,15 @@ class AWXReceptorJob: elif res.status == 'error': # TODO: There should be a more efficient way of getting this information receptor_work_list = receptor_ctl.simple_command("work list") - raise RuntimeError(receptor_work_list[self.unit_id]['Detail']) + detail = receptor_work_list[self.unit_id]['Detail'] + if 'exceeded quota' in detail: + logger.warn(detail) + log_name = self.task.instance.log_format + logger.warn(f"Could not launch pod for {log_name}. Exceeded quota.") + self.task.update_model(self.task.instance.pk, status='pending') + return + + raise RuntimeError(detail) return res