feat: pressure non streaming mode#806
Open
yanksyoon wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a non-streaming (polling) mode for fetching planner “pressure”, allowing deployments with unreliable streaming connectivity to still scale runner creation based on planner demand.
Changes:
- Introduces new charm config
planner-pressure-mode(streamdefault,requestpolling) and validates it in charm state. - Plumbs
planner_pressure_modeinto the generated managerApplicationConfigurationand intoPressureReconcilerConfig. - Implements
PlannerClient.get_pressure()and updatesPressureReconcilercreate loop to support request-mode polling; updates unit tests and changelog accordingly.
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/test_factories.py | Asserts planner_pressure_mode is included in generated application config. |
| tests/unit/test_charm_state.py | Adds validation test for invalid mode; asserts valid mode is stored in CharmConfig. |
| tests/unit/factories.py | Sets default planner-pressure-mode in mock charm config. |
| tests/unit/conftest.py | Updates charm state fixture to include planner_pressure_mode. |
| src/factories.py | Plumbs state.charm_config.planner_pressure_mode into ApplicationConfiguration. |
| src/charm_state.py | Adds planner-pressure-mode config name, type, default, and validation/parsing. |
| github-runner-manager/tests/unit/manager/test_pressure_reconciler.py | Updates fake planner for request-mode support and adds request-mode create loop test. |
| github-runner-manager/src/github_runner_manager/planner_client.py | Adds get_pressure() one-shot pressure fetch method. |
| github-runner-manager/src/github_runner_manager/manager/pressure_reconciler.py | Adds planner_pressure_mode to config and implements request-mode polling path in create loop. |
| github-runner-manager/src/github_runner_manager/configuration/base.py | Extends ApplicationConfiguration with planner_pressure_mode. |
| docs/changelog.md | Documents the new config option and reconciler behavior change. |
| charmcraft.yaml | Adds planner-pressure-mode charm config option with default and description. |
Comment on lines
+89
to
+92
| data = response.json() | ||
| if not isinstance(data, dict) or name not in data: | ||
| raise PlannerApiError(f"Unexpected pressure response payload: {data}") | ||
|
|
Comment on lines
+66
to
+80
| def get_pressure(self, name: str) -> PressureInfo: | ||
| """Get pressure for the given flavor with a single request. | ||
|
|
||
| Args: | ||
| name: Flavor name. | ||
|
|
||
| Returns: | ||
| Parsed pressure info. | ||
|
|
||
| Raises: | ||
| PlannerConnectionError: On transient connection failures or timeouts. | ||
| PlannerApiError: On HTTP errors or invalid payloads. | ||
| """ | ||
| base = str(self._config.base_url).rstrip("/") + "/" | ||
| url = urljoin(base, f"api/v1/flavors/{name}/pressure") |
Comment on lines
159
to
+162
| return | ||
| self._handle_create_runners(update.pressure) | ||
| self._stop.wait(5) | ||
| else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
Introduce non streaming mode for pressure
Why we need it
Flaky network infrastructure will always fail on pressure stream
Checklist
docs/changelog.mdwith user-relevant changesterraform fmtpasses andtflintreports no errorsgithub-runner-manager/pyproject.toml.