uranusjr commented on a change in pull request #17100:
URL: https://github.com/apache/airflow/pull/17100#discussion_r685850326
##########
File path: airflow/models/dag.py
##########
@@ -2312,6 +2327,19 @@ def set_edge_info(self, upstream_task_id: str,
downstream_task_id: str, info: Ed
"""
self.edge_info.setdefault(upstream_task_id, {})[downstream_task_id] =
info
+ def validate_schedule_and_params(self):
Review comment:
It turns out a lot of code needs this pattern, so I added an interface
for it in #17414.
https://github.com/uranusjr/airflow/blob/3e6597b645e62bed299a7c3a7484ddda2f0a3fbc/airflow/timetables/base.py#L86-L98
`dag.timetable` will get two attributes:
* `can_run` is almost always True, only False for `schedule_interval=None`
* `periodic` is almost always True, only False for `schedule_interval=None`
and ``schedule_interval="@once"`
So this would become `if not self.timetable.can_run`.
The advantage of this over `isinstance` is custom timetables can override
this if it makes sense (I can’t think of a scenario when it does, but you never
know).
Feel free to suggest better names in #17414.
--
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]