Skip to content

feat: one frame folder per preset and the smoke-one-camera baseline - #73

Open
Acruve15 wants to merge 6 commits into
pyronear:feat/fake-reolink-camerafrom
Acruve15:alexis/e2e-per-preset
Open

Acruve15 wants to merge 6 commits into
pyronear:feat/fake-reolink-camerafrom
Acruve15:alexis/e2e-per-preset

Conversation

@Acruve15

Copy link
Copy Markdown

Problem

#52 asks for a baseline: smoke on one camera, one alert. Today every preset of a fake camera plays the same frames -> smoke-then-clear gives 5 alerts and 7 sequences for one fire (#72). Hard to assert "one alert" on that.

What this adds

  • A preset can have its own frames: <scenario>/<camera>/<preset>/NNN.jpg, folder name = key of poses. No folder -> the camera-level <camera>/*.jpg, so the 3 existing scenarios are unchanged.
  • finished waits for every preset declared in poses (before: the visited ones). GET /scenario adds a presets block: visits, frame and frames per preset.
  • make_scenario.py --preset 3 writes <camera>/3/ from the sequence seen on that pose.
  • New scenario smoke-one-camera: preset 3 of croix-augas-01 plays 18 frames of prod alert 49767 then a clear frame, the 6 other poses hold a clear frame.
  • SCENARIOS_URL can be overridden for make fetch-scenario.

Flow

Example

$ make e2e SCENARIO=smoke-one-camera
================== 5 passed, 2 warnings in 611.23s (0:10:11) ===================

What reached the API after that run:

alerts 1
{'id': 1, 'lat': None, 'lon': None, 'started_at': '2026-11-12T11:23:54.079972'}
  seq {'id': 1, 'camera_id': 3, 'pose_id': 10, 'detections_count': 14, 'is_validated': True}

pose_id 10 = preset 3. The block the tests read:

"expected": {
  "alerts": 1,
  "sequences": [{"camera": "croix-augas-01", "preset": "3", "min_detections": 7}],
  "location": null,
  "timeout_s": 900
}

Checks

Check Result
Offline suite: pytest tests --ignore=tests/e2e -m "not integration" 35 passed, 6 deselected
make e2e SCENARIO=smoke-one-camera, run 1 5 passed, 670 s wall, 1 alert, 1 sequence, 14 detections
Same, run 2 on a fresh stack 5 passed, 673 s wall, same counts
Stack up without pyro_camera_api and the engine fails at 301 s: "pyro_camera_api never polled the fake cameras (no preset visited after 300 s)"
pyro_camera_api stopped after its first patrol fails at 601 s: 0 alerts, visits per preset in the message
make fetch-scenario from the release on my fork 21 frames, same md5 as the ones I built
black 23.3.0 and ruff 0.0.290, run by hand clean

Single runs on an arm64 Mac, app images under amd64 emulation.

Before merging

Open points

  • The layout is the one I suggested on feat: fake Reolink camera driven by scenarios #65. If you prefer another one, only the first 2 new commits change.
  • min_detections = 7, half of the 14 measured. Both runs ran with 3, I raised it after.
  • 4 of the 18 alert frames are identical to the previous one, and the engine skips those -> 14 distinct frames.

Closes #52.

A test can now prove which scenario a fake camera is playing before it asserts on it. The four tests that need a live camera on 127.0.0.1:8443 get the integration marker.
…o.json

scenario.json gains an expected block (alerts, sequences, location, timeout_s), validated offline by tests/test_scenarios.py. tests/e2e waits for the first alert, then for every fake camera to finish, and compares what the API returns with that block. Tests that need Postgres or S3 get the integration marker so the offline suite passes with no stack.
Fresh stack, in-repo images built, engine and front profiles up, then the e2e tests. The exit code is kept and the compose logs, ps and junit go to e2e-artifacts/. The three images with no arm64 manifest are pinned to linux/amd64 so the stack starts on Apple Silicon.
Writes the frames into <camera>/<preset>/ and takes the sequence seen on the pose whose patrol_id is that preset. Without --preset nothing changes.
A preset plays <scenario>/<camera>/<preset>/*.jpg when the folder exists and falls back to the camera-level frames, so the existing scenarios are unchanged. finished now waits for every preset declared in poses, and GET /scenario reports visits, frame and frames per preset. The e2e never-polled abort keys on those visits.
Preset 3 of croix-augas-01 plays 18 frames of prod alert 49767 then a clear frame, the six other poses hold one clear frame. Expected: one alert, one sequence on that pose. SCENARIOS_URL can now be overridden, so the images can be fetched from another release.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant