hussein-awala commented on code in PR #33403:
URL: https://github.com/apache/airflow/pull/33403#discussion_r1295612738
##########
airflow/triggers/temporal.py:
##########
@@ -34,18 +35,30 @@ class DateTimeTrigger(BaseTrigger):
The provided datetime MUST be in UTC.
"""
- def __init__(self, moment: datetime.datetime):
+ def __init__(self, moment: datetime.datetime, *, soft_fail: bool = False)
-> None:
super().__init__()
+ skipping_message_postfix = "Skipping due to soft_fail is set to True."
if not isinstance(moment, datetime.datetime):
- raise TypeError(f"Expected datetime.datetime type for moment. Got
{type(moment)}")
+ message = f"Expected datetime.datetime type for moment. Got
{type(moment)}"
+ if soft_fail:
+ raise AirflowSkipException(f"{message}.
{skipping_message_postfix}")
+ raise TypeError(message)
# Make sure it's in UTC
elif moment.tzinfo is None:
- raise ValueError("You cannot pass naive datetimes")
+ message = "You cannot pass naive datetimes"
+ if soft_fail:
+ raise AirflowSkipException(f"{message}.
{skipping_message_postfix}")
Review Comment:
How could raising an `AirflowSkipException` in the trigger pass the task
state to skipped? The trigger exception is not propagated to task resuming if I
am not mistaken. WDYT?
--
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]