ashb commented on code in PR #71314:
URL: https://github.com/apache/airflow/pull/71314#discussion_r3803619272
##########
providers/standard/src/airflow/providers/standard/sensors/time_delta.py:
##########
@@ -70,6 +72,12 @@ def __init__(
self.deferrable = deferrable
self.end_from_trigger = end_from_trigger
+ def _resolve_delta(self) -> timedelta:
+ value = self.delta
+ if isinstance(value, timedelta):
+ return value
+ return timedelta(minutes=int(value))
Review Comment:
Why did you choose minutes for this (rather than days, or seconds) -- and
why int, not float?
Either way, accepting this needs to be documented.
Also, although it's not commonly known, there is a way of expressing
intervals/periods/delta with Pendulum via ISO8061:
> ISO 8601 Durations are expressed using the following format, where (n) is
replaced by the value for each of the date and time elements that follow the
(n):
>
> P(n)Y(n)M(n)DT(n)H(n)M(n)S
>
> Where:
>
> P is the duration designator (referred to as "period"), and is always
placed at the beginning of the duration.
> Y is the year designator that follows the value for the number of
years.
> M is the month designator that follows the value for the number of
months.
> W is the week designator that follows the value for the number of
weeks.
> D is the day designator that follows the value for the number of days.
> T is the time designator that precedes the time components.
> H is the hour designator that follows the value for the number of
hours.
> M is the minute designator that follows the value for the number of
minutes.
> S is the second designator that follows the value for the number of
seconds.
>
> For example:
>
> P3Y6M4DT12H30M5S
>
> Represents a duration of three years, six months, four days, twelve hours,
thirty minutes, and five seconds.
```pycon
>>> import pendulum
>>> pendulum.parse("P3Y6M4DT12H30M5S")
Duration(years=3, months=6, days=4, hours=12, minutes=30, seconds=5)
```
--
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]