platform/app/webui: ship the power-watch scenario baked into the image

platform.LocalScenariosDir (/usr/share/bee/scenarios, populated from
iso/overlay/usr/share/bee/scenarios/ by build.sh's overlay rsync) is now
checked before removable media for both `bee run <name>` and the "6.
Scenario" page — a scenario shipped with the image works with no USB
stick required. ReadScenario/ListAvailableScenarios merge local + USB;
the removable-media-only functions from the previous commit are kept
as-is (still used directly where that's actually what's wanted) rather
than renamed out from under existing callers/tests.

iso/overlay/usr/share/bee/scenarios/nvbandwidth-all-gpu-power-watch.json
is a copy of scenarios/nvbandwidth-all-gpu-power-watch.json — the two
aren't auto-synced (documented in scenarios/README.md), so shipping a
scenario baked-in means checking it into both places.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Mikhail Chusavitin
2026-07-28 19:10:35 +03:00
co-authored by Claude Sonnet 5
parent bcf02e0515
commit 5a780e96b4
11 changed files with 276 additions and 27 deletions
+22 -7
View File
@@ -12,14 +12,19 @@ code. See `audit/internal/platform/scenario.go` (`ParseScenarioJSON`,
bee run <path-to-file.json>
```
or, for a scenario file dropped under `scenarios/` on a mounted removable
drive (e.g. the same USB stick already plugged in for blackbox — useful on
an air-gapped host with no other way to get a file onto it):
or, for a bare name (no `/`, no `.json`):
```
bee run <name> # looks for scenarios/<name>.json on any mounted removable media
bee run <name>
```
which resolves `scenarios/<name>.json` by checking, in order: (1) the
scenarios shipped with the image itself — always available, no media
needed — then (2) any mounted removable drive (e.g. the same USB stick
already plugged in for blackbox), for scenarios authored on another
machine and dropped there without a network path onto the host. Same
resolution powers the "6. Scenario" page in the web UI.
`bee scenario run <arg>` is the same command under a longer name.
## Files checked in here
@@ -32,10 +37,20 @@ bee run <name> # looks for scenarios/<name>.json on any mounted removab
**`gpu_indices` is host-specific** — update it to match the GPU indices
`nvidia-smi -L` actually reports on the box under test before running.
This directory is the source of truth; `iso/builder/build.sh`'s "preparing
staged overlay" step rsyncs the whole overlay tree — including a checked-in
copy under `iso/overlay/usr/share/bee/scenarios/` — into the built image, so
anything meant to ship baked-in needs to exist in **both** places (this repo
doesn't auto-copy one into the other). `platform.LocalScenariosDir`
(`/usr/share/bee/scenarios` on the built host) is what `bee run <name>`/the
web UI actually reads at runtime.
## Adding more
Not every scenario needs to be checked in here. For a one-off test on a
Not every scenario needs to ship in the image. For a one-off test on a
specific host (especially air-gapped), it's simpler to write the JSON file
directly onto the blackbox USB stick under `scenarios/<name>.json` and run
`bee run <name>` — no code change, no rebuild. Check a scenario in here only
when it's worth keeping around as a reusable/named test across hosts.
`bee run <name>` — no code change, no rebuild. Check a scenario into
`iso/overlay/usr/share/bee/scenarios/` only when it's worth keeping around
as a reusable/named test that should be available on every host without a
USB stick.