Skip to content

Commit 6733640

Browse files
authored
Merge pull request #31 from miciav/feature/runner-controller-ui
Feature/runner controller UI
2 parents 6d57ecc + f91d2f1 commit 6733640

File tree

297 files changed

+9803
-3454
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

297 files changed

+9803
-3454
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ htmlcov/
4747
/reports/
4848
/data_exports/
4949
/tests/results
50-
/lb_runner/plugins/_user/
50+
/lb_plugins/plugins/_user/
5151
/temp_keys/
5252

5353
# Ansible runtime artifacts

AGENTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
- Runner code is under `lb_runner/`; controller under `lb_controller/`; app-layer API under `lb_app/`; UI under `lb_ui/`.
66
- Reporting and post-processing live under `lb_analytics/`; shared utilities in `lb_common/`; provisioning helpers in `lb_provisioner/`.
77
- Use the stable APIs from `lb_runner.api`, `lb_controller.api`, and `lb_app.api` instead of importing deep modules.
8-
- Collectors sit in `lb_runner/metric_collectors/` (PSUtil, CLI, perf, eBPF) and workload plugins in `lb_runner/plugins/` (stress-ng, dd, fio, hpl), each with base abstractions plus concrete implementations.
8+
- Collectors sit in `lb_runner/metric_collectors/` (PSUtil, CLI, perf, eBPF) and workload plugins in `lb_plugins/plugins/` (stress-ng, dd, fio, hpl), each with base abstractions plus concrete implementations.
99
- Tests are under `tests/`; sample usage is in `example.py`. Output artifacts are written to `benchmark_results/`, `reports/`, and `data_exports/` (these may be absent until generated).
1010

1111
## Build, Test, and Development Commands

GEMINI.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,5 @@ uv run pytest -m tui
7474
## File Structure Highlights
7575
* `pyproject.toml`: Dependency and build configuration.
7676
* `lb_runner/benchmark_config.py`: Configuration dataclasses.
77-
* `lb_runner/plugins/`: Workload plugin implementations.
77+
* `lb_plugins/plugins/`: Workload plugin implementations.
7878
* `lb_controller/ansible/`: Ansible playbooks and roles.

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<a href="https://github.com/miciav/linux-benchmark-lib/blob/main/LICENSE">
2626
<img src="https://img.shields.io/github/license/miciav/linux-benchmark-lib" alt="License" />
2727
</a>
28-
<img src="https://img.shields.io/badge/python-3.11%2B-blue" alt="Python versions" />
28+
<img src="https://img.shields.io/badge/python-3.13%2B-blue" alt="Python versions" />
2929
</p>
3030

3131
## Highlights
@@ -109,20 +109,22 @@ bash scripts/switch_mode.sh dev
109109

110110
```
111111
linux-benchmark-lib/
112-
|-- lb_runner/ # Runner (plugins, collectors, local execution helpers)
112+
|-- lb_runner/ # Runner (collectors, local execution helpers)
113113
|-- lb_controller/ # Orchestration and journaling
114114
|-- lb_app/ # Stable API for CLI/UI integrations
115115
|-- lb_ui/ # CLI/TUI implementation
116116
|-- lb_analytics/ # Reporting and analytics
117+
|-- lb_plugins/ # Workload plugins and registry
117118
|-- lb_provisioner/ # Docker/Multipass helpers
119+
|-- lb_common/ # Shared API helpers
118120
|-- tests/ # Unit and integration tests
119121
|-- scripts/ # Helper scripts
120122
`-- pyproject.toml
121123
```
122124

123125
## Logging policy
124126

125-
- Configure logging via `lb_common.configure_logging()` in your entrypoint.
127+
- Configure logging via `lb_common.api.configure_logging()` in your entrypoint.
126128
- `lb_ui` configures logging automatically; `lb_runner` and `lb_controller` do not.
127129
- Keep stdout clean for `LB_EVENT` streaming when integrating custom UIs.
128130

docs/ctrl_c_design.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Thread and Component Model
44

5-
- **UI/main thread** drives the dashboard and installs a `SigintDoublePressHandler` through `lb_app.services.run_service.RunService`. It never exits on the first Ctrl+C while the controller thread is active; instead it posts notifications to a queue that the main loop drains.
5+
- **UI/main thread** drives the dashboard and installs a `SigintDoublePressHandler` through `lb_app.api.RunService`. It never exits on the first Ctrl+C while the controller thread is active; instead it posts notifications to a queue that the main loop drains.
66
- **Controller worker thread** (`ControllerRunner`) owns orchestration and transitions a shared `ControllerStateMachine`.
77
- **AnsibleRunnerExecutor** executes playbooks in subprocesses and exposes `interrupt()` + `is_running` for safe cancellation.
88
- **lb_runner** emits progress/stop events; the controller consumes them for stop confirmation.

docs/ctrl_c_stop_flow.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
- Ansible subprocesses now run in their own session (`start_new_session=True`). A Ctrl+C in the UI no longer auto-terminates Ansible; the controller remains in charge.
1111
- `AnsibleRunnerExecutor.interrupt()` is idempotent and clears active process metadata; `is_running` reports in-flight state for diagnostics.
12-
- `lb_app.services.run_service.RunService` installs a double Ctrl+C handler:
12+
- `lb_app.api.RunService` installs a double Ctrl+C handler:
1313
- 1st Ctrl+C: logs a warning (\"Press Ctrl+C again to stop the execution\"), no stop is issued.
1414
- 2nd Ctrl+C: arms a stop via the controller's `StopToken`/state machine; the UI stays alive.
1515
- Further Ctrl+C while stopping are ignored; termination remains controller-driven.

docs/interrupts.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This document describes the double-Ctrl+C interruption handling for remote bench
1313
The interrupt handling logic is separated into three layers:
1414

1515
1. **State Machine (`DoubleCtrlCStateMachine`)**
16-
- Pure logic component in `lb_controller/interrupts.py`.
16+
- Pure logic component in `lb_controller/engine/interrupts.py`.
1717
- Tracks states: `RUNNING` -> `STOP_ARMED` -> `STOPPING` -> `FINISHED`.
1818
- Decides action: `WARN_ARM`, `REQUEST_STOP`, or `DELEGATE` (allow default/force kill).
1919

@@ -23,10 +23,10 @@ The interrupt handling logic is separated into three layers:
2323
- Executes callbacks based on decision (`on_first_sigint`, `on_confirmed_sigint`).
2424

2525
3. **Orchestration (`RunService`, `BenchmarkController`)**
26-
- `lb_app.services.run_service.RunService` installs the handler and provides UI callbacks.
27-
- `StopToken` in `lb_runner.stop_token` signals intent to stop across threads/processes.
28-
- `BenchmarkController` and `ControllerRunner` observe the token and coordinate teardown.
29-
- `AnsibleRunnerExecutor` interrupts active playbooks when a stop is requested.
26+
- `lb_app.api.RunService` installs the handler and provides UI callbacks.
27+
- `StopToken` in `lb_runner.api` signals intent to stop across threads/processes.
28+
- `lb_controller.api.BenchmarkController` and `lb_controller.api.ControllerRunner` observe the token and coordinate teardown.
29+
- `lb_controller.api.AnsibleRunnerExecutor` interrupts active playbooks when a stop is requested.
3030

3131
## Behavior
3232

@@ -46,7 +46,7 @@ The interrupt handling logic is separated into three layers:
4646

4747
## Files
4848

49-
- `lb_controller/interrupts.py`: state machine and handler.
49+
- `lb_controller/engine/interrupts.py`: state machine and handler.
5050
- `lb_app/services/run_service.py`: wiring to UI and controller.
51-
- `lb_controller/controller.py`: phase-aware stop logic.
52-
- `lb_controller/ansible_executor.py`: playbook interruption.
51+
- `lb_controller/engine/controller.py`: phase-aware stop logic.
52+
- `lb_controller/adapters/ansible_runner.py`: playbook interruption.

docs/plugins.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Linux Benchmark Library exposes workloads as plugins. Built-in plugins are loade
88
- `hpl`
99
- `stream`
1010

11-
Third-party plugins are installed into `lb_runner/plugins/_user` (override with `LB_USER_PLUGIN_DIR`).
11+
Third-party plugins are installed into `lb_plugins/plugins/_user` (override with `LB_USER_PLUGIN_DIR`).
1212

1313
### CLI workflow
1414

docs/quickstart.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ summary = controller.run(["stress_ng"], run_id="demo-run")
4242
print(summary.per_host_output)
4343
```
4444

45-
For runner-only integrations, use `lb_runner.api` and `lb_runner.local_runner.LocalRunner`.
45+
For runner-only integrations, use `lb_runner.api` and `lb_runner.api.LocalRunner`.

docs/reference/analytics.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22

33
Services for running post-processing on stored benchmark runs.
44

5-
::: lb_analytics.analytics_service.AnalyticsService
6-
::: lb_analytics.analytics_service.AnalyticsRequest
5+
::: lb_analytics.engine.service.AnalyticsService
6+
::: lb_analytics.engine.service.AnalyticsRequest
77

0 commit comments

Comments
 (0)