uranusjr commented on code in PR #48969:
URL: https://github.com/apache/airflow/pull/48969#discussion_r2034865852
##########
providers/standard/src/airflow/providers/standard/operators/trigger_dagrun.py:
##########
@@ -190,10 +190,12 @@ def __init__(
self.logical_date = logical_date
def execute(self, context: Context):
- if self.logical_date is None or isinstance(self.logical_date,
datetime.datetime):
+ if isinstance(self.logical_date, datetime.datetime):
parsed_logical_date = self.logical_date
- else:
+ elif isinstance(self.logical_date, str):
parsed_logical_date = timezone.parse(self.logical_date)
+ else:
+ parsed_logical_date = timezone.utcnow()
Review Comment:
This removes the possibility to explicitly supply None as the logical date.
We need an extra marker, something like
```
def __init__(self, ..., logical_date: str | datetime | None | ArgNotSet =
NOT_SET):
...
def execute(self, context):
if self.logical_date is None or isinstance(self.logical_date, datetime):
parsed_logical_date = self.logical_date
elif isinstance(self.logical_date, str):
parsed_logical_date = timezone.parse(self.logical_date)
else:
parsed_logical_date = utcnow()
```
--
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]