App & UI API¶
Stable interfaces used by the CLI/TUI layer.
App-layer API¶
api ¶
Stable application-layer API surface.
Attributes¶
Classes¶
AnalyticsRequest
dataclass
¶
AnalyticsRequest(run, kind='aggregate', hosts=None, workloads=None)
AnalyticsService ¶
Execute analytics against existing artifacts.
AnsibleOutputFormatter ¶
AnsibleOutputFormatter()
Parses raw Ansible output stream and prints user-friendly status updates.
Source code in lb_app/services/run_output.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
Attributes¶
Functions¶
process ¶
process(text, end='', log_sink=None)
Source code in lb_app/services/run_output.py
67 68 69 70 71 72 73 74 75 | |
process_timing ¶
process_timing(text, end='', log_sink=None)
Emit task duration lines without altering raw output.
Source code in lb_app/services/run_output.py
77 78 79 80 81 82 83 84 85 86 | |
set_phase ¶
set_phase(phase)
Source code in lb_app/services/run_output.py
64 65 | |
ApplicationClient ¶
ApplicationClient()
Concrete application-layer client.
Source code in lb_app/client.py
38 39 40 41 42 43 44 45 | |
Functions¶
get_run_plan ¶
get_run_plan(config, tests, execution_mode='remote')
Source code in lb_app/client.py
58 59 60 61 62 63 64 65 66 67 68 69 70 | |
install_loki_grafana ¶
install_loki_grafana(*, mode, config_path, grafana_url, grafana_api_key, grafana_admin_user, grafana_admin_password, grafana_token_name, grafana_org_id, loki_endpoint, configure_assets=True)
Source code in lb_app/client.py
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 | |
list_runs ¶
list_runs(config)
Source code in lb_app/client.py
55 56 | |
load_config ¶
load_config(path=None)
Source code in lb_app/client.py
47 48 49 | |
remove_loki_grafana ¶
remove_loki_grafana(*, remove_data=False)
Source code in lb_app/client.py
374 375 | |
save_config ¶
save_config(config, path)
Source code in lb_app/client.py
51 52 53 | |
start_run ¶
start_run(request, hooks)
Source code in lb_app/client.py
226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | |
status_loki_grafana ¶
status_loki_grafana(*, grafana_url, grafana_api_key, grafana_org_id, loki_endpoint)
Source code in lb_app/client.py
377 378 379 380 381 382 383 384 385 386 387 388 389 390 | |
ConfigService ¶
ConfigService(config_home=None)
Resolve, load, and mutate BenchmarkConfig files.
Source code in lb_app/services/config_service.py
30 31 | |
Functions¶
add_remote_host ¶
add_remote_host(host, config, enable_remote=True, set_default=False)
Add or replace a remote host definition and persist the config.
Source code in lb_app/services/config_service.py
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 | |
add_workload ¶
add_workload(name, config, set_default)
Add a workload to the run config (ensuring plugin settings).
Source code in lb_app/services/config_service.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | |
apply_platform_defaults
staticmethod
¶
apply_platform_defaults(cfg, platform_config)
Apply platform defaults without mutating workload selection.
Source code in lb_app/services/config_service.py
87 88 89 90 91 92 | |
clear_saved_config_path ¶
clear_saved_config_path()
Remove the saved config path pointer, if present.
Source code in lb_app/services/config_service.py
269 270 271 | |
create_default_config ¶
create_default_config()
Create a fresh BenchmarkConfig with no workloads selected.
Source code in lb_app/services/config_service.py
78 79 80 81 82 83 84 85 | |
ensure_home ¶
ensure_home()
Create the config home directory.
Source code in lb_app/services/config_service.py
33 34 35 | |
load_for_read ¶
load_for_read(config_path)
Load a config for read-only scenarios.
Source code in lb_app/services/config_service.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
load_for_write ¶
load_for_write(config_path, allow_create=True)
Load a config for mutation and return (config, target_path, stale_pointer, created_new).
Source code in lb_app/services/config_service.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | |
load_platform_config ¶
load_platform_config()
Load platform config from ~/.config/lb/platform.json (empty if missing).
Source code in lb_app/services/config_service.py
94 95 96 97 98 99 | |
load_platform_for_write ¶
load_platform_for_write()
Load platform config (create default if missing) for mutation.
Source code in lb_app/services/config_service.py
101 102 103 104 | |
open_editor ¶
open_editor(config_path)
Open the resolved config file in the system editor.
Source code in lb_app/services/config_service.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | |
read_saved_config_path ¶
read_saved_config_path()
Return (resolved_path, stale_path) from the pointer file, if any.
Source code in lb_app/services/config_service.py
265 266 267 | |
remove_plugin ¶
remove_plugin(name, config)
Remove a plugin's workload and settings from a config file.
Returns (config, target_path, stale_pointer, removed_flag).
Source code in lb_app/services/config_service.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | |
remove_remote_host ¶
remove_remote_host(name, config)
Remove a remote host by name from the config.
Returns (config, target_path, stale_pointer, removed_flag).
Source code in lb_app/services/config_service.py
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | |
resolve_config_path ¶
resolve_config_path(config_path)
Return (resolved_config, stale_pointer_target). Respects explicit path, environment variable LB_CONFIG_PATH, stored pointer, or local benchmark_config.json.
Source code in lb_app/services/config_service.py
58 59 60 61 62 63 64 65 66 | |
set_plugin_enabled ¶
set_plugin_enabled(name, enabled)
Enable/disable a plugin in platform config.
Source code in lb_app/services/config_service.py
106 107 108 109 110 111 112 113 114 115 | |
set_plugin_selection ¶
set_plugin_selection(selection, registry)
Persist plugin selection to platform config.
Source code in lb_app/services/config_service.py
117 118 119 120 121 122 123 124 125 126 | |
write_saved_config_path ¶
write_saved_config_path(path)
Persist a pointer to the preferred config path.
Source code in lb_app/services/config_service.py
261 262 263 | |
DashboardHandle ¶
Bases: Protocol
Handle for a live dashboard visualization.
Functions¶
add_log ¶
add_log(line)
Add a log line to the dashboard.
Source code in lb_app/ui_interfaces.py
15 16 | |
live ¶
live()
Return a context manager that keeps the dashboard live.
Source code in lb_app/ui_interfaces.py
12 13 | |
mark_event ¶
mark_event(source)
Mark an event occurrence (e.g., visual flash).
Source code in lb_app/ui_interfaces.py
21 22 | |
refresh ¶
refresh()
Trigger a refresh of the dashboard.
Source code in lb_app/ui_interfaces.py
18 19 | |
DashboardLogMetadata
dataclass
¶
DashboardLogMetadata(title='Log Stream')
DashboardRow
dataclass
¶
DashboardRow(host, workload, intensity, status, progress, current_action, last_rep_time)
DashboardSnapshot
dataclass
¶
DashboardSnapshot(run_id, rows, row_count, plan_rows, intensity_map, status_summary, log_metadata)
Attributes¶
DashboardStatusSummary
dataclass
¶
DashboardStatusSummary(total, completed, running, failed, skipped, pending)
DashboardViewModel ¶
DashboardViewModel(plan, journal)
Build dashboard snapshots from mutable run state.
Source code in lb_app/viewmodels/dashboard.py
53 54 55 56 57 | |
Attributes¶
Functions¶
snapshot ¶
snapshot()
Source code in lb_app/viewmodels/dashboard.py
63 64 65 66 67 68 69 70 71 72 73 74 | |
DoctorCheckGroup
dataclass
¶
DoctorCheckGroup(title, items, failures)
DoctorCheckItem
dataclass
¶
DoctorCheckItem(label, ok, required)
DoctorReport
dataclass
¶
DoctorReport(groups, info_messages, total_failures)
DoctorService ¶
DoctorService(config_service=None)
Service to check local prerequisites and environment health.
Source code in lb_app/services/doctor_service.py
22 23 24 25 26 | |
Attributes¶
Functions¶
check_all ¶
check_all()
Run all checks.
Source code in lb_app/services/doctor_service.py
204 205 206 207 208 209 210 211 212 213 214 | |
check_controller ¶
check_controller()
Check controller-side requirements (Python deps, ansible-runner).
Source code in lb_app/services/doctor_service.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | |
check_local_tools ¶
check_local_tools()
Check local workload tools required by installed plugins.
Source code in lb_app/services/doctor_service.py
90 91 92 93 94 95 | |
check_multipass ¶
check_multipass()
Check if Multipass is installed (used by integration test).
Source code in lb_app/services/doctor_service.py
129 130 131 132 133 134 135 | |
check_remote_hosts ¶
check_remote_hosts(config=None, timeout_seconds=10)
Check SSH connectivity to configured remote hosts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
config
|
Optional[BenchmarkConfig]
|
Benchmark configuration with remote hosts. If None, loads from default config path. |
None
|
timeout_seconds
|
int
|
Timeout for each host connection check. |
10
|
Returns:
| Type | Description |
|---|---|
DoctorReport
|
DoctorReport with connectivity results for each host. |
Source code in lb_app/services/doctor_service.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | |
NoOpDashboardHandle ¶
Bases: DashboardHandle
No-op dashboard handle.
Functions¶
add_log ¶
add_log(line)
Source code in lb_app/ui_interfaces.py
100 101 102 | |
live ¶
live()
Source code in lb_app/ui_interfaces.py
97 98 | |
mark_event ¶
mark_event(source)
Source code in lb_app/ui_interfaces.py
107 108 109 | |
refresh ¶
refresh()
Source code in lb_app/ui_interfaces.py
104 105 | |
NoOpProgressHandle ¶
Bases: ProgressHandle
No-op progress handle.
NoOpUIAdapter ¶
Bases: UIAdapter
No-op UI adapter that discards all output.
Functions¶
create_dashboard ¶
create_dashboard(plan, journal, ui_log_file=None)
Create a run dashboard.
Source code in lb_app/ui_interfaces.py
157 158 159 160 161 162 163 164 165 | |
create_progress ¶
create_progress(description, total)
Create a progress task.
Source code in lb_app/ui_interfaces.py
152 153 154 155 | |
prompt_multipass_scenario ¶
prompt_multipass_scenario(options, default_level)
Prompt user for multipass scenario selection.
Source code in lb_app/ui_interfaces.py
167 168 169 170 171 172 | |
show_error ¶
show_error(message)
Render an error message.
Source code in lb_app/ui_interfaces.py
123 124 125 | |
show_info ¶
show_info(message)
Render an informational message.
Source code in lb_app/ui_interfaces.py
115 116 117 | |
show_panel ¶
show_panel(message, title=None, border_style=None)
Render a block/panel container.
Source code in lb_app/ui_interfaces.py
131 132 133 134 135 | |
show_rule ¶
show_rule(title)
Render a horizontal rule with a title.
Source code in lb_app/ui_interfaces.py
137 138 139 | |
show_success ¶
show_success(message)
Render a success message.
Source code in lb_app/ui_interfaces.py
127 128 129 | |
show_table ¶
show_table(title, columns, rows)
Render a simple table.
Source code in lb_app/ui_interfaces.py
141 142 143 144 145 | |
show_warning ¶
show_warning(message)
Render a warning message.
Source code in lb_app/ui_interfaces.py
119 120 121 | |
status ¶
status(message)
Context manager that shows a status/spinner while work is running.
Source code in lb_app/ui_interfaces.py
147 148 149 150 | |
ProgressHandle ¶
Bases: Protocol
Progress task handle for updating completion.
Functions¶
finish ¶
finish()
Mark the task as finished and flush any pending output.
Source code in lb_app/ui_interfaces.py
31 32 | |
update ¶
update(completed)
Update the task with the absolute completed amount.
Source code in lb_app/ui_interfaces.py
28 29 | |
ProvisionConfigSummary
dataclass
¶
ProvisionConfigSummary(loki_datasource_id, datasources_configured, dashboards_configured, warnings=tuple())
Summary of Grafana configuration.
Attributes¶
Functions¶
from_grafana
classmethod
¶
from_grafana(summary, warnings=())
Source code in lb_app/services/provision_service.py
41 42 43 44 45 46 47 48 49 50 51 52 | |
ProvisionService ¶
ProvisionService(config_service)
Provision Loki + Grafana and configure dashboards.
Source code in lb_app/services/provision_service.py
58 59 60 | |
Functions¶
install_loki_grafana ¶
install_loki_grafana(*, mode, config_path, grafana_url, grafana_api_key, grafana_admin_user, grafana_admin_password, grafana_token_name, grafana_org_id, loki_endpoint, configure_assets=True)
Source code in lb_app/services/provision_service.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | |
remove_loki_grafana ¶
remove_loki_grafana(*, remove_data=False)
Source code in lb_app/services/provision_service.py
221 222 | |
status_loki_grafana ¶
status_loki_grafana(*, grafana_url, grafana_api_key, grafana_org_id, loki_endpoint)
Source code in lb_app/services/provision_service.py
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | |
ProvisionStatus
dataclass
¶
ProvisionStatus(loki_url, grafana_url, loki_ready, grafana_ready)
RunContext
dataclass
¶
RunContext(config, target_tests, registry, config_path=None, debug=False, resume_from=None, resume_latest=False, stop_file=None, execution_mode='remote', node_count=None)
Inputs required to execute a run.
Attributes¶
RunRequest
dataclass
¶
RunRequest(config, tests, run_id=None, resume=None, debug=False, intensity=None, setup=True, stop_file=None, execution_mode='remote', repetitions=None, node_count=1, docker_engine='docker', ui_adapter=None, skip_connectivity_check=False, connectivity_timeout=10)
Inputs required to start a run from the UI.
Attributes¶
RunResult
dataclass
¶
RunResult(context, summary, journal_path=None, log_path=None, ui_log_path=None)
Outcome of a run.
RunService ¶
RunService(registry_factory)
Coordinate benchmark execution for CLI commands.
Source code in lb_app/services/run_service.py
42 43 44 45 46 47 48 49 50 51 52 53 54 | |
Functions¶
apply_overrides
staticmethod
¶
apply_overrides(cfg, intensity, debug)
Apply CLI-driven overrides to the configuration.
Source code in lb_app/services/run_service.py
78 79 80 81 82 83 | |
build_context ¶
build_context(cfg, tests, config_path=None, debug=False, resume=None, stop_file=None, execution_mode='remote', node_count=None)
Compute the run context and registry.
Source code in lb_app/services/run_service.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
create_session ¶
create_session(config_service, tests=None, config_path=None, run_id=None, resume=None, repetitions=None, debug=False, intensity=None, ui_adapter=None, setup=True, stop_file=None, execution_mode='remote', node_count=None, preloaded_config=None)
Orchestrate the creation of a RunContext from raw inputs.
This method consolidates configuration loading, overrides, and context building.
Source code in lb_app/services/run_service.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | |
execute ¶
execute(context, run_id, output_callback=None, ui_adapter=None)
Execute benchmarks using remote hosts provisioned upstream.
Source code in lb_app/services/run_service.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | |
get_run_plan ¶
get_run_plan(cfg, tests, execution_mode='remote', registry=None, platform_config=None)
Build a detailed plan for the workloads to be run.
Returns a list of dictionaries containing status, intensity, details, etc.
Source code in lb_app/services/run_service.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | |
TestService ¶
TestService(ui=None, config_service=None)
Service for test configuration and interactions.
Source code in lb_app/services/test_service.py
32 33 34 35 36 37 38 | |
Attributes¶
Functions¶
build_multipass_scenario ¶
build_multipass_scenario(intensity, selection)
Construct the scenario details for the test plan.
Source code in lb_app/services/test_service.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |
get_multipass_intensity ¶
get_multipass_intensity(force_env=None)
Return intensity parameters based on LB_MULTIPASS_FORCE env var or argument.
Source code in lb_app/services/test_service.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
select_multipass ¶
select_multipass(force_interactive=False, default_level='medium')
Select a Multipass scenario; fall back to defaults when non-interactive.
Source code in lb_app/services/test_service.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
UIAdapter ¶
Bases: Protocol
Minimal interface for presentation concerns.
Functions¶
create_dashboard ¶
create_dashboard(plan, journal, ui_log_file=None)
Create a run dashboard.
Source code in lb_app/ui_interfaces.py
69 70 71 72 73 74 75 | |
create_progress ¶
create_progress(description, total)
Create a progress task.
Source code in lb_app/ui_interfaces.py
66 67 | |
prompt_multipass_scenario ¶
prompt_multipass_scenario(options, default_level)
Prompt user for multipass scenario selection.
Source code in lb_app/ui_interfaces.py
77 78 79 80 | |
show_error ¶
show_error(message)
Render an error message.
Source code in lb_app/ui_interfaces.py
44 45 | |
show_info ¶
show_info(message)
Render an informational message.
Source code in lb_app/ui_interfaces.py
38 39 | |
show_panel ¶
show_panel(message, title=None, border_style=None)
Render a block/panel container.
Source code in lb_app/ui_interfaces.py
50 51 52 53 | |
show_rule ¶
show_rule(title)
Render a horizontal rule with a title.
Source code in lb_app/ui_interfaces.py
55 56 | |
show_success ¶
show_success(message)
Render a success message.
Source code in lb_app/ui_interfaces.py
47 48 | |
show_table ¶
show_table(title, columns, rows)
Render a simple table.
Source code in lb_app/ui_interfaces.py
58 59 60 61 | |
show_warning ¶
show_warning(message)
Render a warning message.
Source code in lb_app/ui_interfaces.py
41 42 | |
status ¶
status(message)
Context manager that shows a status/spinner while work is running.
Source code in lb_app/ui_interfaces.py
63 64 | |
UIHooks ¶
Bases: Protocol
Callbacks invoked by the application layer to update the UI.
Functions¶
on_event ¶
on_event(event)
Source code in lb_app/interfaces.py
20 | |
on_journal ¶
on_journal(journal)
Source code in lb_app/interfaces.py
21 | |
on_log ¶
on_log(line)
Source code in lb_app/interfaces.py
17 | |
on_status ¶
on_status(controller_state)
Source code in lb_app/interfaces.py
18 | |
on_warning ¶
on_warning(message, ttl=10.0)
Source code in lb_app/interfaces.py
19 | |
Functions¶
build_dashboard_viewmodel ¶
build_dashboard_viewmodel(plan, journal)
Source code in lb_app/viewmodels/dashboard.py
77 78 79 80 | |
event_status_line ¶
event_status_line(event_source, last_event_ts, *, now=None)
Return (status, detail) for event freshness.
Source code in lb_app/viewmodels/dashboard.py
83 84 85 86 87 88 89 90 91 92 | |
generate_run_id ¶
generate_run_id()
Generate a timestamped run id matching the controller's format.
Source code in lb_app/services/run_journal.py
398 399 400 | |
journal_rows ¶
journal_rows(journal)
Return headers and rows summarizing a journal.
Source code in lb_app/viewmodels/run_viewmodels.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | |
plan_rows ¶
plan_rows(plan)
Transform plan entries into table rows.
Source code in lb_app/viewmodels/run_viewmodels.py
61 62 63 64 65 66 67 68 69 70 71 72 73 | |
results_exist_for_run ¶
results_exist_for_run(run_root)
Return True when any *_results.json exists under the run root.
Source code in lb_app/services/run_journal.py
348 349 350 351 352 353 354 | |
summarize_progress ¶
summarize_progress(tasks, target_reps)
Source code in lb_app/viewmodels/run_viewmodels.py
18 19 20 21 22 23 24 25 26 27 28 29 30 | |
summarize_system_info ¶
summarize_system_info(path)
Return a one-line summary for a system_info.json file.
Source code in lb_app/services/run_system_info.py
62 63 64 65 66 67 68 69 70 71 72 73 | |
target_repetitions ¶
target_repetitions(journal)
Source code in lb_app/viewmodels/run_viewmodels.py
10 11 12 13 14 15 | |
UI composition helpers¶
UIContext
dataclass
¶
UIContext(headless=False, dev_mode=False, _ui=None, _ui_adapter=None, _config_service=None, _doctor_service=None, _test_service=None, _analytics_service=None, _app_client=None)
Container for UI services and state, initialized lazily.
Attributes¶
load_dev_mode ¶
load_dev_mode(cli_root)
Return True when dev mode is enabled via marker file or pyproject flag.
Source code in lb_ui/wiring/dependencies.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | |