Skip to content

Commit

Permalink
fix: patches #24215. Won't raise KeyError when 'create_job_kwargs' co…
Browse files Browse the repository at this point in the history
…ntains the 'Command' key. (#24308)
  • Loading branch information
gmcrocetti authored Jun 8, 2022
1 parent a1a9a8f commit dc9c083
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion airflow/providers/amazon/aws/hooks/glue.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def get_or_create_glue_job(self) -> str:
"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(
Expand Down
1 change: 1 addition & 0 deletions tests/providers/amazon/aws/hooks/test_glue.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ def test_get_or_create_glue_job_create_new_job(self, mock_get_iam_execution_role
script_location="s3://bucket",
s3_bucket="bucket",
region_name=self.some_aws_region,
create_job_kwargs={"Command": {}},
)

result = hook.get_or_create_glue_job()
Expand Down

0 comments on commit dc9c083

Please sign in to comment.