feat(framework) Add selectors to stop command - #7974
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 514abaedbe
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
Adds latest and all selectors to flwr stop while preserving numeric run IDs.
Changes:
- Resolves unfinished runs in newest-first order.
- Supports consolidated JSON output for
all. - Adds selector validation and resolution tests.
The all path should tolerate runs finishing concurrently, and command-level execution/output coverage is still needed.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Summary |
|---|---|
framework/py/flwr/cli/stop.py |
Implements selector resolution and multi-run stopping. |
framework/py/flwr/cli/stop_test.py |
Tests selector validation, filtering, and ordering. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8269b36e15
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8ed71b558b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Issue
Description
Stopping a recent run currently requires listing runs, copying an ID, and passing that numeric ID to
flwr stop. Stopping every active run requires repeating the process.Related issues/PRs
Fixes #7945.
Proposal
Explanation
Allow the
flwr stopargument to be either a numeric run ID or one of two selectors:lateststops the newest unfinished run.allstops all unfinished runs, newest first.Unfinished includes pending, starting, and running runs, which ensures a pending run can also be stopped. Existing numeric-ID behavior remains unchanged. The JSON response for
allcontains a singlerun-idslist instead of emitting multiple JSON documents.Arguments are validated before configuration migration or connection setup. Batch execution attempts every selected run before reporting partial failures. A run selected by either
latestorallthat finishes concurrently is treated as already satisfying the stop request, including when the stop RPC returns an unsuccessful response instead of an API error. Unrelated failures remain visible after the rest of anallbatch is attempted.Add focused tests for numeric IDs, active-run filtering and ordering, real CLI validation before setup, negative IDs, the no-active-runs case, both concurrent-completion response forms, batch failure continuation, RPC order, and JSON output.
Checklist
#contributions)Any other comments?
Local verification:
python -m pytest py/flwr/cli/stop_test.py py/flwr/cli/cli_test.py -k stoppython -m ruff check py/flwr/cli/stop.py py/flwr/cli/stop_test.py --no-respect-gitignorepython -m mypy py/flwr/cli/stop.py py/flwr/cli/stop_test.pypython -m pylint py/flwr/cli/stop.py py/flwr/cli/stop_test.pyuv run --no-sync --python=3.11.14 ./dev/test.sh false