RehanAhmad25 commented on code in PR #69925:
URL: https://github.com/apache/airflow/pull/69925#discussion_r3772283627


##########
providers/standard/src/airflow/providers/standard/sensors/time.py:
##########
@@ -62,34 +62,38 @@ def __init__(
         trigger_kwargs: dict[str, Any] | None = None,
         **kwargs,
     ) -> None:
+        if start_from_trigger:
+            warnings.warn(
+                "start_from_trigger is deprecated for TimeSensor and is now 
ignored. The target "
+                "moment is computed fresh from the current wall-clock time on 
every Dag parse, so "
+                "baking it into the serialized trigger arguments made the 
serialized Dag hash change "
+                "on every parse. Use deferrable=True instead, which computes 
the target moment at "
+                "task execution time and does not have this problem.",
+                AirflowProviderDeprecationWarning,
+                stacklevel=2,
+            )
         super().__init__(**kwargs)
 
-        # Create a "date-aware" timestamp that will be used as the 
"target_datetime". This is a requirement
-        # of the DateTimeTrigger
+        self.target_time = target_time
+        self.deferrable = deferrable
+        self.start_from_trigger = False

Review Comment:
   Good point, updated it: `start_from_trigger` is now a property with a setter 
instead of a plain attribute. Reading it still always returns `False`, but 
setting it (whether at construction or afterward, e.g. `op.start_from_trigger = 
True`) now emits the same deprecation warning each time rather than only 
warning once and then silently ignoring further attempts. Tests updated to 
cover both the constructor path and direct assignment after construction.



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