phanikumv commented on code in PR #30579:
URL: https://github.com/apache/airflow/pull/30579#discussion_r1170134926
##########
airflow/providers/google/cloud/sensors/gcs.py:
##########
@@ -242,6 +245,42 @@ def poke(self, context: Context) -> bool:
)
return hook.is_updated_after(self.bucket, self.object,
self.ts_func(context))
+ 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)
+ else:
+ self.defer(
+ timeout=timedelta(seconds=self.timeout),
+ trigger=GCSCheckBlobUpdateTimeTrigger(
+ bucket=self.bucket,
+ object_name=self.object,
+ ts=self.ts_func(context),
+ poke_interval=self.poke_interval,
+ google_cloud_conn_id=self.google_cloud_conn_id,
+ hook_params={
+ "delegate_to": self.delegate_to,
+ "impersonation_chain": self.impersonation_chain,
+ },
+ ),
+ method_name="execute_complete",
+ )
+
+ def execute_complete(self, context: dict[str, Any], event: dict[str, str]
| None = None) -> str:
+ """
+ Callback for when the trigger fires - returns immediately.
+ Relies on trigger to throw an exception, otherwise it assumes
execution was
+ successful.
+ """
+ if event:
+ if event["status"] == "success":
+ self.log.info(
+ "Sensor checks update time for object %s in bucket : %s",
self.object, self.bucket
Review Comment:
corrected it
--
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]