Skip to content

Conversation

@dheerajturaga
Copy link
Member

EdgeExecutor is missing EdgeWorkerHosts html pages in Airflow 3. This PR attempts to bridge the gap by providing those utilities via CLI options. These options are intended to run on the server side ( or have access to the server and db). They aim to control the remote edge workers.

This PR enables the following functionality:

  1. List all registered edge workers
  2. Put an edge worker on maintenance mode
  3. Update maintenance mode comments for a worker who is in maintenance mode
  4. Remove edge worker from maintenance mode
  5. Remove edge worker from the pool

@dheerajturaga dheerajturaga requested a review from jscheffl as a code owner April 28, 2025 19:52
@boring-cyborg boring-cyborg bot added area:providers provider:edge Edge Executor / Worker (AIP-69) / edge3 labels Apr 28, 2025
Copy link
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 the contribution!
Looks like a good idea as extension until the UI for Airflow 3 is fully restored as feature.

Some comments during review. Already late here, after (potential) changes added I'd need a proper review.

One thing that I think about is that the UI has a state model today by rendering only the buttons possible. But the EdgeWorker model itself does not define valid state transitions. So if the user uses the "wrong" CLI command now it could potentially set the worker(s) into an inconsistent state. E.g. remove the worker while still a job is running. I think a check for the current vs. desired state should be added... and maybe best is doing it on the EdgeWorker model class and not (redundant to UI) in the CLI.

Copy link
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.

Did a second pass review. Looks all well. Please don't be afraid about the comments, I assume the missing details are not complex. I like this very much!

Copy link
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.

Passing over the code just two thoughts - maybe not blocking. But if you have time to maybe have a thought?

As unfortunately I still was not able to add a system deployment test with edge I'd like to test manually - but it is late here today, promise to make it tomorrow. Then I hope I can approve and merge.

Copy link
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 hope this is the last round of rework I will request. I think it is almost good, with just two things:

  • The DB existence check - as in the other comment. Preventing large stack traces of error when calling on the wrong machine
  • Maybe pushing all DB related to logic to EdgeWorker class would be great - because the CLI code is already 800+LoC and reducing just to CLI would be good. Second is optional, if you do not lick I'll make this in a follow-up PR.

All testing looks good by the way!

Copy link
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 the contribution, the patience from review comments and fixing and the effort invested! Really like this!

@jscheffl jscheffl merged commit 453f795 into apache:main May 2, 2025
64 checks passed
@dheerajturaga dheerajturaga deleted the new-edge-cli-cmds branch May 2, 2025 20:46
mvfc pushed a commit to mvfc/airflow that referenced this pull request May 6, 2025
…e#49915)

* Extend Edge Worker CLI commands operate on remote edge workers

* Fix static-checks - ruff linting/spell checks

* TYPE_CHECK Session and doc string massaging

* Fix more ruff spell-check and linting

* Consolidate _valid_hosts to _fetch_from_db. Make the query smarter

* Jens Suggestions on 04/29

* Move db related logic to edge_worker model
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:providers provider:edge Edge Executor / Worker (AIP-69) / edge3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants