-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Implement timetables in SDK #58669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement timetables in SDK #58669
Conversation
16d1d9d to
b7610a9
Compare
4f5a04e to
f35fa74
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm a little worried we might need some back-compat on the imports, but I'm not really sure if that is true or not. BaseTime table probably needs one for anyone who might have created a custom timetable.
For instance a custom timetable did this:
from airflow.timetables.base import DagRunInfo, DataInterval, TimeRestriction, Timetable
|
The current (before this PR) way to use custom timetables is to import the base class in core, and that still exists (it’s still the base class for all timetable classes in core), so I don’t think anything would break. You can swith to the new base class in SDK, but things will also continue to work if you don’t change anything. |
The built-in ones are just stubs; we only need the logic after deserialization.
Most notably adding ensure_core_timetable
This matches the core attribute and caused less headaches.
b0536e7 to
5eab691
Compare
kaxil
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#protm
For built-in timetables, the SDK only contain minimal stubs that implement the arguments (mostly attrs-generated), and
validate()(called when a DAG instance is created). Serialization logic is moved toairflow.serialization.encoders. When the dag processor sees those SDK stubs, it converts the import path to Core timetable classes, which implement most of the actual logic once deserialized.User-custom timetables should still inherit
airflow.timetables.Timetablebecause they must be defined in plugins and loaded into protected processes.A part of #52141.