-
Notifications
You must be signed in to change notification settings - Fork 15.5k
Introduce generic Callbacks #54796
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
base: main
Are you sure you want to change the base?
Introduce generic Callbacks #54796
Conversation
Introduce a generic Callback model that can be used for Deadline callbacks for now and hopefully the on_*_callbacks for Dags and Tasks in the future.
I've been working on making Deadline callbacks work on the executor in addition to the Triggerer. That means introducing a new Workload type for the executor. I didn't want to tie it specifically to Deadlines and realized it would be a good idea to introduce generic Callbacks that the new workload can reference. This is an initial PR for adding a new Callback table and refactoring existing Deadline callbacks that run on the Triggerer to use these instead: Ideally, once AIP-92 is in progress, these callbacks can be used or all the |
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've pointed out the areas of this PR I want to focus on and get everyone working on AIP-92 to agree on. Everything else is just refactoring to make existing functionality work. I'll work on unit tests once we agree on how these should work
@@ -84,6 +83,14 @@ def key(self) -> TaskInstanceKey: | |||
) | |||
|
|||
|
|||
class Callback(BaseModel): |
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.
Similar to TaskInstance defined above this in this file
@@ -132,6 +139,51 @@ def make( | |||
) | |||
|
|||
|
|||
class ExecuteCallback(BaseWorkload): |
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.
Similar to ExecuteTask defined above. There's a lot of duplicate code here that we can refactor but for now, I'm just looking to align on the definition
EXECUTOR = "executor" | ||
|
||
|
||
class Callback(Base): |
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.
This is the focus of this PR and what I'm looking to align on for all Callbacks
Introduce a generic Callback model that can be used for Deadline callbacks for now and hopefully the on_*_callbacks for Dags and Tasks in the future.
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rst
or{issue_number}.significant.rst
, in airflow-core/newsfragments.