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

vincbeck 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 097e3e618e Fix AWS `EmrStepSensor` ignoring the specified 
`aws_conn_id` in deferred mode  (#33952)
097e3e618e is described below

commit 097e3e618ec3ee09221cb64bb8f64e8b275b6399
Author: Pavel Yermalovich <[email protected]>
AuthorDate: Thu Aug 31 18:20:06 2023 +0200

    Fix AWS `EmrStepSensor` ignoring the specified `aws_conn_id` in deferred 
mode  (#33952)
---
 airflow/providers/amazon/aws/triggers/emr.py    | 4 ++--
 tests/providers/amazon/aws/triggers/test_emr.py | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/airflow/providers/amazon/aws/triggers/emr.py 
b/airflow/providers/amazon/aws/triggers/emr.py
index a69fde2a6e..a928255fe0 100644
--- a/airflow/providers/amazon/aws/triggers/emr.py
+++ b/airflow/providers/amazon/aws/triggers/emr.py
@@ -242,7 +242,7 @@ class EmrContainerTrigger(AwsBaseWaiterTrigger):
         )
 
     def hook(self) -> AwsGenericHook:
-        return EmrContainerHook(self.aws_conn_id)
+        return EmrContainerHook(aws_conn_id=self.aws_conn_id)
 
 
 class EmrStepSensorTrigger(AwsBaseWaiterTrigger):
@@ -282,7 +282,7 @@ class EmrStepSensorTrigger(AwsBaseWaiterTrigger):
         )
 
     def hook(self) -> AwsGenericHook:
-        return EmrHook(self.aws_conn_id)
+        return EmrHook(aws_conn_id=self.aws_conn_id)
 
 
 class EmrServerlessCreateApplicationTrigger(AwsBaseWaiterTrigger):
diff --git a/tests/providers/amazon/aws/triggers/test_emr.py 
b/tests/providers/amazon/aws/triggers/test_emr.py
index 7066e817e4..f83ad8ccd0 100644
--- a/tests/providers/amazon/aws/triggers/test_emr.py
+++ b/tests/providers/amazon/aws/triggers/test_emr.py
@@ -31,7 +31,6 @@ TEST_MAX_ATTEMPTS = 10
 TEST_AWS_CONN_ID = "test-aws-id"
 VIRTUAL_CLUSTER_ID = "vzwemreks"
 JOB_ID = "job-1234"
-AWS_CONN_ID = "aws_emr_conn"
 POLL_INTERVAL = 60
 TARGET_STATE = ["TERMINATED"]
 STEP_ID = "s-1234"
@@ -56,13 +55,13 @@ class TestEmrTriggers:
             EmrContainerTrigger(
                 virtual_cluster_id=VIRTUAL_CLUSTER_ID,
                 job_id=JOB_ID,
-                aws_conn_id=AWS_CONN_ID,
+                aws_conn_id=TEST_AWS_CONN_ID,
                 poll_interval=POLL_INTERVAL,
             ),
             EmrStepSensorTrigger(
                 job_flow_id=TEST_JOB_FLOW_ID,
                 step_id=STEP_ID,
-                aws_conn_id=AWS_CONN_ID,
+                aws_conn_id=TEST_AWS_CONN_ID,
                 waiter_delay=POLL_INTERVAL,
             ),
         ],
@@ -78,3 +77,4 @@ class TestEmrTriggers:
 
         assert class_path == class_path2
         assert args == args2
+        assert instance.hook().aws_conn_id == TEST_AWS_CONN_ID

Reply via email to