svc-ml — ML Inference Routing Service
FastAPI service routing ML inference requests — auto-labelling, horizon detection, file reorganization — to SageMaker endpoints, with Redis caching and PostgreSQL persistence for results (30-day retention).
flowchart LR
CLIENT[consuming services] -->|POST /api/v1/infer| ML[svc-ml
FastAPI · Fargate]
ML --> CACHE[(Redis
24h TTL)]
ML --> DB[(PostgreSQL
ml_results · 30d)]
ML --> SM[SageMaker
Batch + Real-Time]
SM -->|inference result| ML
style ML fill:#EDEDFF,stroke:#3B54F7
style SM fill:#F3EDFF,stroke:#8A54E8
Task types: auto_label · auto_horizons · file_reorg
API:
POST /api/v1/infer— submit job → returnsrun_id+ statusGET /api/v1/infer/{run_id}/{task_type}— poll cached/stored resultGET /api/v1/models— list task types + endpoints + versionsGET /health— unauthenticatedCaching: cache-aside pattern — Redis checked before SageMaker; 24h TTL; results also persisted to PostgreSQL for 30 days.
Auth: API key (
X-API-Keyheader).Stack: Python 3.13+, FastAPI, boto3/aiobotocore (SageMaker), psycopg3 + asyncpg pool, Redis 5+, orjson.
Built on: the ecs-service pattern.