This is an automated email from the ASF dual-hosted git repository.

potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new dc9c083a4b fix: patches #24215. Won't raise KeyError when 
'create_job_kwargs' contains the 'Command' key. (#24308)
dc9c083a4b is described below

commit dc9c083a4b696ec5ed4e7059de2fb98222e1ab62
Author: Guilherme Martins Crocetti 
<[email protected]>
AuthorDate: Wed Jun 8 07:04:14 2022 -0300

    fix: patches #24215. Won't raise KeyError when 'create_job_kwargs' contains 
the 'Command' key. (#24308)
---
 airflow/providers/amazon/aws/hooks/glue.py    | 2 +-
 tests/providers/amazon/aws/hooks/test_glue.py | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/airflow/providers/amazon/aws/hooks/glue.py 
b/airflow/providers/amazon/aws/hooks/glue.py
index be85f2fec4..2fc342675d 100644
--- a/airflow/providers/amazon/aws/hooks/glue.py
+++ b/airflow/providers/amazon/aws/hooks/glue.py
@@ -185,7 +185,7 @@ class GlueJobHook(AwsBaseHook):
                     "Name": "glueetl",
                     "ScriptLocation": self.script_location,
                 }
-                command = self.create_job_kwargs.get("Command", 
default_command)
+                command = self.create_job_kwargs.pop("Command", 
default_command)
 
                 if "WorkerType" in self.create_job_kwargs and 
"NumberOfWorkers" in self.create_job_kwargs:
                     create_job_response = glue_client.create_job(
diff --git a/tests/providers/amazon/aws/hooks/test_glue.py 
b/tests/providers/amazon/aws/hooks/test_glue.py
index 4e3afd0453..e8f55c5b81 100644
--- a/tests/providers/amazon/aws/hooks/test_glue.py
+++ b/tests/providers/amazon/aws/hooks/test_glue.py
@@ -102,6 +102,7 @@ class TestGlueJobHook(unittest.TestCase):
             script_location="s3://bucket",
             s3_bucket="bucket",
             region_name=self.some_aws_region,
+            create_job_kwargs={"Command": {}},
         )
 
         result = hook.get_or_create_glue_job()

Reply via email to