mirror of
https://github.com/azaion/loader.git
synced 2026-04-22 11:16:32 +00:00
[AZ-185][AZ-186] Batch 2
Made-with: Cursor
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
# Update Manager
|
||||
|
||||
**Task**: AZ-185_update_manager
|
||||
**Name**: Update Manager
|
||||
**Description**: Implement the loader's background update loop that checks for new versions and applies AI model and Docker image updates
|
||||
**Complexity**: 5 points
|
||||
**Dependencies**: AZ-183, AZ-184
|
||||
**Component**: Loader
|
||||
**Tracker**: AZ-185
|
||||
**Epic**: AZ-181
|
||||
|
||||
## Problem
|
||||
|
||||
Jetsons need to automatically discover and install new AI models and Docker images without manual intervention. The update loop must handle version detection, server communication, and applying different update types.
|
||||
|
||||
## Outcome
|
||||
|
||||
- Loader automatically checks for updates every 5 minutes
|
||||
- New AI models downloaded, decrypted, and placed in model directory
|
||||
- New Docker images loaded and services restarted with minimal downtime
|
||||
- Loader can update itself (self-update, applied last)
|
||||
|
||||
## Scope
|
||||
|
||||
### Included
|
||||
- Version collector: scan model directory for .trt files (extract date from filename), query docker images for azaion/* tags, cache results
|
||||
- Background loop (configurable interval, default 5 min): collect versions, call POST /get-update, trigger downloads
|
||||
- Apply AI model: move decrypted .trt to model directory (detection API scans and picks newest)
|
||||
- Apply Docker image: docker load -i, docker compose up -d {service}
|
||||
- Self-update: loader updates itself last via docker compose up -d loader
|
||||
- Integration with AZ-184 Resumable Download Manager for all downloads
|
||||
|
||||
### Excluded
|
||||
- Server-side /get-update endpoint (AZ-183)
|
||||
- Download mechanics (AZ-184)
|
||||
- CI/CD publish pipeline (AZ-186)
|
||||
- Device provisioning (AZ-187)
|
||||
|
||||
## Acceptance Criteria
|
||||
|
||||
**AC-1: Version collector reads local state**
|
||||
Given AI model azaion-2026-03-10.trt in model directory and Docker image azaion/annotations:arm64_2026-03-01 loaded
|
||||
When version collector runs
|
||||
Then it reports [{resource_name: "detection_model", version: "2026-03-10"}, {resource_name: "annotations", version: "arm64_2026-03-01"}]
|
||||
|
||||
**AC-2: Background loop polls on schedule**
|
||||
Given the loader is running with update interval set to 5 minutes
|
||||
When 5 minutes elapse
|
||||
Then POST /get-update is called with current versions
|
||||
|
||||
**AC-3: AI model update applied**
|
||||
Given /get-update returns a new detection_model version
|
||||
When download and decryption complete
|
||||
Then new .trt file is in the model directory
|
||||
|
||||
**AC-4: Docker image update applied**
|
||||
Given /get-update returns a new annotations version
|
||||
When download and decryption complete
|
||||
Then docker load succeeds and docker compose up -d annotations restarts the service
|
||||
|
||||
**AC-5: Self-update applied last**
|
||||
Given /get-update returns updates for both annotations and loader
|
||||
When applying updates
|
||||
Then annotations is updated first, loader is updated last
|
||||
|
||||
**AC-6: Cached versions refresh after changes**
|
||||
Given version collector cached its results
|
||||
When a new model file appears in the directory or docker load completes
|
||||
Then cache is invalidated and next collection reflects new state
|
||||
|
||||
## Constraints
|
||||
|
||||
- Docker socket must be mounted in the loader container (already the case)
|
||||
- docker compose file path must be configurable (env var)
|
||||
- Model directory path must be configurable (env var)
|
||||
- Self-update must be robust: state file on disk ensures in-progress updates survive container restart
|
||||
Reference in New Issue
Block a user