shahar1 commented on code in PR #70310:
URL: https://github.com/apache/airflow/pull/70310#discussion_r3645519025


##########
providers/standard/src/airflow/providers/standard/sensors/date_time.py:
##########
@@ -125,8 +128,14 @@ def __init__(
 
         self.start_from_trigger = start_from_trigger
         if self.start_from_trigger:
+            try:
+                moment = timezone.parse(self.target_time)
+            except ValueError as e:
+                raise ValueError(
+                    f"start_from_trigger=True requires a static target_time, 
not a template: {self.target_time!r}"
+                ) from e
             self.start_trigger_args.trigger_kwargs = dict(
-                moment=timezone.parse(self.target_time),
+                moment=moment,

Review Comment:
   How does it solve the crashing? It seems to improve the error message rather 
than fix the issue.



##########
providers/standard/src/airflow/providers/standard/sensors/date_time.py:
##########
@@ -98,6 +98,9 @@ class DateTimeSensorAsync(DateTimeSensor):
 
     :param target_time: datetime after which the job succeeds. (templated)
     :param start_from_trigger: Start the task directly from the triggerer 
without going into the worker.
+        This requires a static ``target_time`` (a datetime or ISO-8601 
string). A templated
+        ``target_time`` is not supported here because the trigger is created 
at Dag-parse time,

Review Comment:
   The trigger is not created at Dag-parse time, but either in the worker or 
the triggerer



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