From 82ad5d5e11612833eb03e5f12d8970da6d18d3f2 Mon Sep 17 00:00:00 2001 From: Jarek Potiuk Date: Fri, 29 Apr 2022 13:24:42 +0200 Subject: [PATCH 1/2] Allow back script_location in Glue to be None Fix error introduced in #20935 where script location in Glue Job could be None. --- airflow/providers/amazon/aws/operators/glue.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/airflow/providers/amazon/aws/operators/glue.py b/airflow/providers/amazon/aws/operators/glue.py index 05eafe72692f7..0602e1d5acd23 100644 --- a/airflow/providers/amazon/aws/operators/glue.py +++ b/airflow/providers/amazon/aws/operators/glue.py @@ -104,7 +104,9 @@ def execute(self, context: 'Context'): :return: the id of the current glue job. """ - if not self.script_location.startswith(self.s3_protocol): + if self.script_location is None: + s3_script_location = None + elif self.script_location.startswith(self.s3_protocol): s3_hook = S3Hook(aws_conn_id=self.aws_conn_id) script_name = os.path.basename(self.script_location) s3_hook.load_file( From 52c8180d0136538ba0be04c2a42cbfc7ca90abd1 Mon Sep 17 00:00:00 2001 From: Jarek Potiuk Date: Fri, 29 Apr 2022 13:50:22 +0200 Subject: [PATCH 2/2] Update airflow/providers/amazon/aws/operators/glue.py MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Jørgen --- airflow/providers/amazon/aws/operators/glue.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/airflow/providers/amazon/aws/operators/glue.py b/airflow/providers/amazon/aws/operators/glue.py index 0602e1d5acd23..cb76e784300e0 100644 --- a/airflow/providers/amazon/aws/operators/glue.py +++ b/airflow/providers/amazon/aws/operators/glue.py @@ -106,7 +106,7 @@ def execute(self, context: 'Context'): """ if self.script_location is None: s3_script_location = None - elif self.script_location.startswith(self.s3_protocol): + elif not self.script_location.startswith(self.s3_protocol): s3_hook = S3Hook(aws_conn_id=self.aws_conn_id) script_name = os.path.basename(self.script_location) s3_hook.load_file(