Simplify boilerplate for learning: stub inference and Postgres write
Removed ort/ndarray/image (ONNX Runtime inference) and sqlx (Postgres audit write). inference::detect() and the Postgres half of reporter::report() are now stubs with a comment for what real code goes there. Redis Streams XREADGROUP loop and the Redis pub/sub alert stay real. Verified with a clean cargo check --all-targets (0 warnings).
This commit is contained in:
@@ -2,9 +2,18 @@
|
||||
|
||||
Computer-vision failure detection worker for the Continuum print farm
|
||||
platform. Consumes camera frame batches pushed onto the Redis Stream
|
||||
`stream:camera_frames` (by `continuum-backend`'s `src/queue/`), runs them
|
||||
through an ONNX Runtime model, and fast-paths high-confidence failure alerts
|
||||
back to Redis and Postgres.
|
||||
`stream:camera_frames` (by `continuum-backend`'s `src/queue/`) and reports
|
||||
failures.
|
||||
|
||||
## This is a learning-stage boilerplate
|
||||
|
||||
Real ONNX Runtime inference (the `ort` crate) and the Postgres audit write
|
||||
(`sqlx`) are **not** implemented yet — `src/inference/mod.rs` always
|
||||
"detects" one fixed example failure, and `src/reporter/mod.rs` only prints
|
||||
where the Postgres write would go. The Redis Streams consumer-group loop in
|
||||
`main.rs` and the Redis pub/sub alert in `reporter/` are real. This lets the
|
||||
whole pipeline (read a frame, "detect", report, ack) run and be understood
|
||||
before adding a real model or a SQL database on top.
|
||||
|
||||
## Pipeline
|
||||
|
||||
@@ -13,24 +22,24 @@ continuum-proxy --(frames)--> continuum-backend --(XADD)--> stream:camera_frames
|
||||
|
|
||||
XREADGROUP (this worker)
|
||||
v
|
||||
src/inference (ort session)
|
||||
inference::detect (stub for now)
|
||||
v
|
||||
src/reporter (Redis pub/sub + Postgres INSERT)
|
||||
```
|
||||
|
||||
## Structure
|
||||
|
||||
```
|
||||
src/
|
||||
main.rs Consumer-group loop: XREADGROUP -> decode -> infer -> report -> XACK
|
||||
inference/ Thread-safe ONNX Runtime session wrapper + pre/post-processing
|
||||
reporter/ Alert fan-out: Redis pub/sub for realtime UI, Postgres for audit trail
|
||||
reporter::report (Redis pub/sub — real)
|
||||
```
|
||||
|
||||
## Getting started
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
# place an ONNX failure-detection model at ./models/failure-detector.onnx
|
||||
cargo run
|
||||
```
|
||||
|
||||
## Structure
|
||||
|
||||
```
|
||||
src/
|
||||
main.rs Consumer-group loop: XREADGROUP -> detect -> report -> XACK
|
||||
config.rs Loads settings from environment variables
|
||||
inference/ Detection stub — real ONNX Runtime inference goes here later
|
||||
reporter/ Redis pub/sub alert (real) + a note for the Postgres write (later)
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user