e-galan commented on code in PR #37693:
URL: https://github.com/apache/airflow/pull/37693#discussion_r1559452315


##########
airflow/providers/google/cloud/sensors/dataflow.py:
##########
@@ -115,10 +124,50 @@ def poke(self, context: Context) -> bool:
 
         return False
 
+    def execute(self, context: Context) -> None:
+        """Airflow runs this method on the worker and defers using the 
trigger."""
+        if not self.deferrable:
+            super().execute(context)
+        elif not self.poke(context=context):
+            self.defer(
+                timeout=self.execution_timeout,
+                trigger=DataflowJobStatusTrigger(
+                    job_id=self.job_id,
+                    expected_statuses=self.expected_statuses,
+                    project_id=self.project_id,
+                    location=self.location,
+                    gcp_conn_id=self.gcp_conn_id,
+                    poll_sleep=self.poll_interval,
+                    impersonation_chain=self.impersonation_chain,
+                ),
+                method_name="execute_complete",
+            )
+
+    def execute_complete(self, context: Context, event: dict[str, str | list]) 
-> bool:
+        """
+        Execute this method when the task resumes its execution on the worker 
after deferral.
+
+        Returns True if the trigger returns an event with the success status, 
otherwise raises
+        an exception.
+        """
+        if event["status"] == "success":
+            self.log.info(event["message"])
+            return True
+        if self.soft_fail:

Review Comment:
   Comment added.



-- 
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: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to