From ad0361e3101f5eb4de558b5f9b233fa17f45c1ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vandon?= Date: Fri, 22 Sep 2023 15:09:00 -0700 Subject: [PATCH 1/2] do not fail operator if we cannot find logs --- airflow/providers/amazon/aws/operators/batch.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/airflow/providers/amazon/aws/operators/batch.py b/airflow/providers/amazon/aws/operators/batch.py index 23d245ae7be79..83f450a281633 100644 --- a/airflow/providers/amazon/aws/operators/batch.py +++ b/airflow/providers/amazon/aws/operators/batch.py @@ -359,7 +359,12 @@ def monitor_job(self, context: Context): else: self.hook.wait_for_job(self.job_id) - awslogs = self.hook.get_job_all_awslogs_info(self.job_id) + awslogs = [] + try: + awslogs = self.hook.get_job_all_awslogs_info(self.job_id) + except AirflowException as ae: + self.log.warning("cannot determine where to find aws logs for this batch job: %s", ae) + if awslogs: self.log.info("AWS Batch job (%s) CloudWatch Events details found. Links to logs:", self.job_id) link_builder = CloudWatchEventsLink() From e07cc34bbf3c7ee71f787142d0882f3c48a4fbd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vandon?= Date: Fri, 22 Sep 2023 15:25:24 -0700 Subject: [PATCH 2/2] capitalization in log message Co-authored-by: Niko Oliveira --- airflow/providers/amazon/aws/operators/batch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airflow/providers/amazon/aws/operators/batch.py b/airflow/providers/amazon/aws/operators/batch.py index 83f450a281633..7cf2cbfeacd17 100644 --- a/airflow/providers/amazon/aws/operators/batch.py +++ b/airflow/providers/amazon/aws/operators/batch.py @@ -363,7 +363,7 @@ def monitor_job(self, context: Context): try: awslogs = self.hook.get_job_all_awslogs_info(self.job_id) except AirflowException as ae: - self.log.warning("cannot determine where to find aws logs for this batch job: %s", ae) + self.log.warning("Cannot determine where to find the AWS logs for this Batch job: %s", ae) if awslogs: self.log.info("AWS Batch job (%s) CloudWatch Events details found. Links to logs:", self.job_id)