-
Notifications
You must be signed in to change notification settings - Fork 14.5k
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
Allow custom timetable as a DAG argument #17414
Conversation
c6b7684
to
c5b4e99
Compare
f693525
to
791ddec
Compare
The PR most likely needs to run full matrix of tests because it modifies parts of the core of Airflow. However, committers might decide to merge it quickly and take the risk. If they don't merge it quickly - please rebase it to the latest main at your convenience, or amend the last commit of the PR, and push it with --force-with-lease. |
fd59fa0
to
f4129d9
Compare
54d5877
to
c1f6815
Compare
c1f6815
to
e1c553c
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.
A few minor non-blocking changes.
Since I'm out I'm approving this now, but please either make the changes suggested or leave comments saying why they aren't needed (then merge without needing further approval from me)
c754edc
to
74739cd
Compare
Static check failing due to unrelated issue. |
bc7ea67
to
d3b56fe
Compare
This delegates most of the serialization work to the type, so the behavior | ||
can be completely controlled by a custom subclass. | ||
""" | ||
return {"type": as_importable_string(type(var)), "value": var.serialize()} |
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.
Possibly __type
to match with other "special" keys? Not sure
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 assuming we’re not yet set on the serialisation method because of the class registration stuff (and I’m not sure the current method will always work if the timetable class is declared in a DAG file), so let’s not think too hard on this for now?
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.
👍🏻 We can tackle that next then.
All existing aceess to schedule_interval (the normalized property is not used anywhere) are all changed to use the DAG's timetable member. A couple of timetable-describing flags, can_run and periodic, are added to replace some usages that need to know about what the timetable is capable of doing. Serialization methods are added to timetable classes so the timetable can be saved to the meta database during DAG serialization.
d3b56fe
to
138defd
Compare
Registration issue opened as #17931. |
To allow a custom
timetable
argument to work on a DAG, the existingschedule_interval
attribute and thenormalized_schedule_interval
property are removed. All existing aceess toschedule_interval
(the normalizedproperty is not used anywhere) are all changed to use the DAG's
timetable
member. A couple of timetable-describing flags,can_run
andperiodic
, are added to replace some usages that need to know about what the timetableis capable of doing.
Serialization methods are added to timetable classes so the timetable can be saved to the meta database during DAG serialization.
Since the
schedule_interval
attribute has been removed, the field onDagModel
of the same name is also changed. Since we still need that information to display the timetable on the web UI,timetable.summary
is used to “backfill”schedule_interval
if a custom timetable is used.schedule_interval
becomes purely cosmetic and only used to UI display.