Skip to content

Add no-op _process_workloads to EdgeExecutor to improve readability#64236

Merged
jscheffl merged 2 commits intoapache:mainfrom
wjddn279:implement-process-workloads-to-explain
Mar 30, 2026
Merged

Add no-op _process_workloads to EdgeExecutor to improve readability#64236
jscheffl merged 2 commits intoapache:mainfrom
wjddn279:implement-process-workloads-to-explain

Conversation

@wjddn279
Copy link
Copy Markdown
Contributor

Why?

Unlike other Executors, EdgeExecutor does not process workloads in trigger_tasks, so _process_workloads was not overridden. However, this can cause confusion for people (myself included) who are accustomed to other executors when they first encounter it.

I've implemented an explicit no-op implementation with a docstring explaining why the method is intentionally unused, to prevent confusion for future contributors and avoid a potential NotImplementedError if the base class flow ever changes.


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@boring-cyborg boring-cyborg bot added area:providers provider:edge Edge Executor / Worker (AIP-69) / edge3 labels Mar 26, 2026
Copy link
Copy Markdown
Contributor

@Nataneljpwd Nataneljpwd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great addition!
It enhanced the readability and ease of understanding of the executor!

Copy link
Copy Markdown
Contributor

@jscheffl jscheffl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am wondering a bit though why this internal method is expected to be implemented,.

Can you please adjust also the documentation in https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/executor/index.html#important-baseexecutor-methods - because it is not mentioned there and I am wondering why the base executor raises an exception here. I do not see why (all) executors need to implement it. I would consider it beed to be changes in Base class rather if it is optional.

@wjddn279
Copy link
Copy Markdown
Contributor Author

wjddn279 commented Mar 29, 2026

@jscheffl
Looking at the implementation and comments of BaseExecutor's _process_workloads.

def _process_workloads(self, workloads: Sequence[workloads.All]) -> None:
"""
Process the given workloads.
This method must be implemented by subclasses to define how they handle
the execution of workloads (e.g., queuing them to workers, submitting to
external systems, etc.).
:param workloads: List of workloads to process
"""
raise NotImplementedError(f"{type(self).__name__} must implement _process_workloads()")

It's defined as something subclasses must implement. The reason it's enforced is that all objects inheriting from BaseExecutor are assumed to follow the pattern of queuing tasks into an internal queue via queue_workload and processing them in _process_workloads.

EdgeExecutor is the only case (so far) that doesn't follow this pattern. However, as long as it inherits from BaseExecutor, I believe it should still implement _process_workloads and explicitly state that it's an exception case, even if it's not actually used.

To be precise, I think BaseExecutor should ideally be split — something like BaseExecutorWithQueue and BaseExecutorWithoutQueue. But since EdgeExecutor is the only such case, that feels like overkill for now. (Though it should be revisited if more cases come up.)

@jscheffl
Copy link
Copy Markdown
Contributor

It's defined as something subclasses must implement.

And therefore I wrote earlier: Can you please adjust also the documentation in https://airflow.apache.org/docs/apache-airflow/stable/core-concepts/executor/index.html#important-baseexecutor-methods - because it is not mentioned there

@wjddn279
Copy link
Copy Markdown
Contributor Author

added!

@jscheffl jscheffl added backport-to-v3-1-test backport-to-v3-2-test Mark PR with this label to backport to v3-2-test branch labels Mar 30, 2026
Copy link
Copy Markdown
Contributor

@jscheffl jscheffl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding the docs!

@jscheffl jscheffl merged commit 476dabe into apache:main Mar 30, 2026
92 of 93 checks passed
@github-actions github-actions bot added this to the Airflow 3.1.9 milestone Mar 30, 2026
@github-actions
Copy link
Copy Markdown

Hi maintainer, this PR was merged without a milestone set.
We've automatically set the milestone to Airflow 3.1.9 based on: backport label targeting v3-1-test
If this milestone is not correct, please update it to the appropriate milestone.

This comment was generated by Milestone Tag Assistant.

github-actions bot pushed a commit that referenced this pull request Mar 30, 2026
…eadability (#64236)

* Add no-op _process_workloads to EdgeExecutor to improve EdgeExecutor readability

* add docs
(cherry picked from commit 476dabe)

Co-authored-by: Jeongwoo Do <48639483+wjddn279@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

Backport successfully created: v3-2-test

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
v3-2-test PR Link

github-actions bot pushed a commit that referenced this pull request Mar 30, 2026
…eadability (#64236)

* Add no-op _process_workloads to EdgeExecutor to improve EdgeExecutor readability

* add docs
(cherry picked from commit 476dabe)

Co-authored-by: Jeongwoo Do <48639483+wjddn279@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown

Backport successfully created: v3-1-test

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
v3-1-test PR Link

jscheffl pushed a commit that referenced this pull request Mar 30, 2026
…eadability (#64236) (#64508)

* Add no-op _process_workloads to EdgeExecutor to improve EdgeExecutor readability

* add docs
(cherry picked from commit 476dabe)

Co-authored-by: Jeongwoo Do <48639483+wjddn279@users.noreply.github.com>
jscheffl pushed a commit that referenced this pull request Mar 30, 2026
…eadability (#64236) (#64507)

* Add no-op _process_workloads to EdgeExecutor to improve EdgeExecutor readability

* add docs
(cherry picked from commit 476dabe)

Co-authored-by: Jeongwoo Do <48639483+wjddn279@users.noreply.github.com>
Subham-KRLX pushed a commit to Subham-KRLX/airflow that referenced this pull request Apr 3, 2026
…pache#64236)

* Add no-op _process_workloads to EdgeExecutor to improve EdgeExecutor readability

* add docs
Suraj-kumar00 pushed a commit to Suraj-kumar00/airflow that referenced this pull request Apr 7, 2026
…pache#64236)

* Add no-op _process_workloads to EdgeExecutor to improve EdgeExecutor readability

* add docs
vatsrahul1001 pushed a commit that referenced this pull request Apr 8, 2026
…eadability (#64236) (#64507)

* Add no-op _process_workloads to EdgeExecutor to improve EdgeExecutor readability

* add docs
(cherry picked from commit 476dabe)

Co-authored-by: Jeongwoo Do <48639483+wjddn279@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers backport-to-v3-2-test Mark PR with this label to backport to v3-2-test branch provider:edge Edge Executor / Worker (AIP-69) / edge3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants