Skip to content

Commit

Permalink
Avoid creating the hook in the EmrServerlessCancelJobsTrigger init (#…
Browse files Browse the repository at this point in the history
…35992)

* Avoid creating the hook in the EmrServerlessCancelJobsTrigger init

* Make it b/c
  • Loading branch information
hussein-awala authored Nov 30, 2023
1 parent 9bcee9d commit eed6427
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions airflow/providers/amazon/aws/triggers/emr.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,7 @@ def __init__(
waiter_delay: int,
waiter_max_attempts: int,
) -> None:
self.hook_instance = EmrServerlessHook(aws_conn_id)
states = list(self.hook_instance.JOB_INTERMEDIATE_STATES.union({"CANCELLING"}))
states = list(EmrServerlessHook.JOB_INTERMEDIATE_STATES.union({"CANCELLING"}))
super().__init__(
serialized_fields={"application_id": application_id},
waiter_name="no_job_running",
Expand All @@ -461,4 +460,9 @@ def __init__(
)

def hook(self) -> AwsGenericHook:
return self.hook_instance
return EmrServerlessHook(self.aws_conn_id)

@property
def hook_instance(self) -> AwsGenericHook:
"""This property is added for backward compatibility."""
return self.hook()

0 comments on commit eed6427

Please sign in to comment.