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

husseinawala 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 eed6427b66 Avoid creating the hook in the 
EmrServerlessCancelJobsTrigger init (#35992)
eed6427b66 is described below

commit eed6427b66e5af51d7e6ff4afb5f7115b2754cf3
Author: Hussein Awala <[email protected]>
AuthorDate: Fri Dec 1 01:36:37 2023 +0200

    Avoid creating the hook in the EmrServerlessCancelJobsTrigger init (#35992)
    
    * Avoid creating the hook in the EmrServerlessCancelJobsTrigger init
    
    * Make it b/c
---
 airflow/providers/amazon/aws/triggers/emr.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/airflow/providers/amazon/aws/triggers/emr.py 
b/airflow/providers/amazon/aws/triggers/emr.py
index 32f9049155..c09e356515 100644
--- a/airflow/providers/amazon/aws/triggers/emr.py
+++ b/airflow/providers/amazon/aws/triggers/emr.py
@@ -444,8 +444,7 @@ class EmrServerlessCancelJobsTrigger(AwsBaseWaiterTrigger):
         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",
@@ -461,4 +460,9 @@ class EmrServerlessCancelJobsTrigger(AwsBaseWaiterTrigger):
         )
 
     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()

Reply via email to