e-galan commented on code in PR #37693:
URL: https://github.com/apache/airflow/pull/37693#discussion_r1553641057
##########
airflow/providers/google/cloud/sensors/dataflow.py:
##########
@@ -357,4 +500,45 @@ def poke(self, context: Context) -> bool:
location=self.location,
)
- return self.callback(result)
+ return result if self.callback is None else self.callback(result)
+
+ def execute(self, context: Context) -> Any:
+ """Airflow runs this method on the worker and defers using the
trigger."""
+ if not self.deferrable:
+ super().execute(context)
+ else:
+ self.defer(
+ trigger=DataflowJobAutoScalingEventTrigger(
+ job_id=self.job_id,
+ 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,
+ fail_on_terminal_state=self.fail_on_terminal_state,
+ ),
+ method_name="execute_complete",
+ )
+
+ def execute_complete(self, context: Context, event: dict[str, str | list])
-> Any:
Review Comment:
I think it should be `Any` because of the `callback` parameter. We do not
know in advance what kinda function will be passed there and what it will
return.
--
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]