-
Notifications
You must be signed in to change notification settings - Fork 3
Add two new filters #167
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: v0.x.x
Are you sure you want to change the base?
Add two new filters #167
Conversation
Marenz
commented
May 16, 2025
- Reset release notes
- Add two new filters to the dispatch list command
Signed-off-by: Mathias L. Baumann <[email protected]>
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.
Pull Request Overview
This PR resets the release notes and enhances the dispatch list
CLI command by adding two new filters.
- Added
--running
and--type
options to filter dispatches by status and type. - Updated filtering logic to count and report filtered-out dispatches.
- Reset and stubbed out sections in
RELEASE_NOTES.md
.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
File | Description |
---|---|
src/frequenz/client/dispatch/main.py | Introduced --running and --type options, applied filtering in the loop, and updated summary output. |
RELEASE_NOTES.md | Cleared existing notes, added placeholders for Summary and Upgrading, and documented new filters. |
Comments suppressed due to low confidence (1)
src/frequenz/client/dispatch/main.py:241
- No tests cover the new
--running
and--type
filters. Add unit or integration tests to verify that dispatches are correctly included or excluded based on these flags.
async for page in ctx.obj["client"].list(**filters):
@@ -218,28 +218,42 @@ async def cli(ctx: click.Context, url: str, key: str, raw: bool) -> None: | |||
@click.option("--active", type=bool) | |||
@click.option("--dry-run", type=bool) | |||
@click.option("--page-size", type=int) | |||
@click.option("--running", type=bool) | |||
@click.option("--type", "-T", type=str) |
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.
Using the option name --type
shadows Python’s built-in type
and may confuse users; consider renaming the flag (e.g. --dispatch-type
) and setting dest='dispatch_type'
.
@click.option("--type", "-T", type=str) | |
@click.option("--dispatch-type", "-T", type=str, dest="dispatch_type") |
Copilot uses AI. Check for mistakes.
@click.option("--running", type=bool) | ||
@click.option("--type", "-T", type=str) |
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.
Add a help=
string for the new options (--running
and --type
) so users know exactly how to use them in the CLI.
@click.option("--running", type=bool) | |
@click.option("--type", "-T", type=str) | |
@click.option( | |
"--running", | |
type=bool, | |
help="Filter dispatches based on whether they are currently running.", | |
) | |
@click.option( | |
"--type", | |
"-T", | |
type=str, | |
help="Filter dispatches by their type (e.g., 'load', 'generation').", | |
) |
Copilot uses AI. Check for mistakes.
<!-- Here goes a general summary of what this release is about --> | ||
|
||
## Upgrading | ||
|
||
* You now must always provide the URL to the dispatch client. | ||
<!-- Here goes notes on how to upgrade from previous versions, including deprecations and what they should be replaced with --> |
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.
Placeholder comments remain in the Summary and Upgrading sections; fill these with actual release highlights and migration notes before publishing.
Copilot uses AI. Check for mistakes.
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.
LGTM, not sure if you have any tests for the CLI to add some tests for the additions...
Signed-off-by: Mathias L. Baumann <[email protected]>