vandonr-amz commented on code in PR #31018:
URL: https://github.com/apache/airflow/pull/31018#discussion_r1221967512


##########
airflow/providers/amazon/aws/sensors/s3.py:
##########
@@ -131,6 +136,50 @@ def poke(self, context: Context):
         else:
             return all(self._check_key(key) for key in self.bucket_key)
 
+    def execute(self, context: Context) -> None:
+        """
+        Defers to Trigger class to poll for state of the job run until
+        it reaches a failure state or success state.
+        """
+        if not self.deferrable:
+            super().execute(context)
+        else:
+            if not self.poke(context=context):
+                self._defer()
+
+    def _defer(self) -> None:
+        """Check for a keys in s3 and defers using the triggerer."""
+        self.defer(
+            timeout=timedelta(seconds=self.timeout),
+            trigger=S3KeyTrigger(
+                bucket_name=cast(str, self.bucket_name),
+                bucket_key=self.bucket_key,
+                wildcard_match=self.wildcard_match,
+                aws_conn_id=self.aws_conn_id,
+                verify=self.verify,
+                poke_interval=self.poke_interval,
+                should_check_fn=self.should_check_fn,

Review Comment:
   ```suggestion
                   should_check_fn=True if self.check_fn else False,
   ```
   (and removing `self.should_check_fn`)



-- 
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