Skip to content

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ramitkataria
Copy link
Contributor

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.

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.
@boring-cyborg boring-cyborg bot added area:dev-tools area:Executors-core LocalExecutor & SequentialExecutor area:Scheduler including HA (high availability) scheduler area:Triggerer backport-to-v3-0-test Mark PR with this label to backport to v3-0-test branch labels Aug 21, 2025
@ramitkataria
Copy link
Contributor Author

ramitkataria commented Aug 21, 2025

Relevant email thread

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 on_*_callbacks as well. I want to ensure that these are generic enough for additional subclasses that would implement them. So I'm looking for feedback/comments to align on a common definition for the new Workload type and the Callback model definition.

Copy link
Contributor Author

@ramitkataria ramitkataria left a 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):
Copy link
Contributor Author

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):
Copy link
Contributor Author

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):
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:dev-tools area:Executors-core LocalExecutor & SequentialExecutor area:Scheduler including HA (high availability) scheduler area:Triggerer backport-to-v3-0-test Mark PR with this label to backport to v3-0-test branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant