uranusjr commented on code in PR #46882:
URL: https://github.com/apache/airflow/pull/46882#discussion_r1962613100
##########
airflow/api_fastapi/core_api/datamodels/dag_run.py:
##########
@@ -99,6 +104,38 @@ def check_data_intervals(cls, values):
)
return values
+ def validate_context(self, dag: DAG) -> dict:
+ from airflow.timetables.base import DataInterval
+
+ coerced_logical_date = timezone.coerce_datetime(self.logical_date) if
self.logical_date else None
+ run_after = self.run_after
+ data_interval = None
+ if coerced_logical_date:
+ if self.data_interval_start and self.data_interval_end:
+ data_interval = DataInterval(
+ start=pendulum.instance(self.data_interval_start),
+ end=pendulum.instance(self.data_interval_end),
+ )
Review Comment:
I think we can just use `coerce_datetime` for this instead of importing
pendulum. (Doesn’t make much difference though)
##########
airflow/api_fastapi/core_api/datamodels/dag_run.py:
##########
@@ -99,6 +104,38 @@ def check_data_intervals(cls, values):
)
return values
+ def validate_context(self, dag: DAG) -> dict:
+ from airflow.timetables.base import DataInterval
+
+ coerced_logical_date = timezone.coerce_datetime(self.logical_date) if
self.logical_date else None
Review Comment:
```suggestion
coerced_logical_date = timezone.coerce_datetime(self.logical_date)
```
--
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]