syedahsn commented on code in PR #32563:
URL: https://github.com/apache/airflow/pull/32563#discussion_r1262918852


##########
airflow/providers/amazon/aws/operators/step_function.py:
##########
@@ -74,9 +88,25 @@ def execute(self, context: Context):
             raise AirflowException(f"Failed to start State Machine execution 
for: {self.state_machine_arn}")
 
         self.log.info("Started State Machine execution for %s: %s", 
self.state_machine_arn, execution_arn)
-
+        if self.deferrable:
+            self.defer(
+                trigger=StepFunctionsStartExecutionTrigger(
+                    execution_arn=execution_arn,
+                    waiter_delay=self.waiter_delay,
+                    waiter_max_attempts=self.waiter_max_attempts,
+                    aws_conn_id=self.aws_conn_id,
+                    region_name=self.region_name,
+                ),
+                method_name="execute_complete",
+                timeout=timedelta(seconds=self.waiter_max_attempts * 
self.waiter_delay),
+            )
         return execution_arn
 
+    def execute_complete(self, context: Context, event: dict[str, Any] | None 
= None) -> None:
+        if event and event["status"] == "success":

Review Comment:
   This came up in a 
[comment](https://github.com/apache/airflow/pull/32355#discussion_r1254069649) 
on an other PR. Basically, the ask was to have type hinting in the function 
definition. Because `None` was the default value from the beginning, and mypy 
enforcing its rules, we have to assume `event` can be `None` even though it 
should never happen. You can follow the discussion, but the solution I ended up 
going with was to handle the case where `event` is `None` by throwing an 
exception, then moving on.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to