Skip to content

MLflow Service — Design Document

Overview

Thin wrapper around the official MLflow Docker image, providing experiment tracking and model registry for the TradAI platform. This service does not follow the standard 3-layer pattern — it is a container configuration, not a custom application.

Architecture

services/mlflow/
├── Dockerfile        # Extends official MLflow image
├── entrypoint.sh     # Custom entrypoint with health checks
├── pyproject.toml    # Minimal package definition
├── src/
│   └── tradai_mlflow/  # Namespace: tradai_mlflow (not tradai.mlflow)
└── README.md

Namespace Exception

Uses tradai_mlflow namespace (underscore) instead of tradai.mlflow (dot). This avoids conflicts with the official mlflow package.

Dependencies

  • Upstream: Official MLflow Docker image
  • Storage: PostgreSQL (metadata), S3 (artifacts in production), local volume (dev)
  • Consumers: Backend service, Strategy service (via MLFLOW_TRACKING_URI)

Configuration

Variable Description Default
MLFLOW_PORT Host port mapping 5001 (→ container 5000)
MLFLOW_BACKEND_STORE_URI PostgreSQL connection string Required
MLFLOW_DEFAULT_ARTIFACT_ROOT Artifact storage path /mlflow/artifacts (dev)

Key Design Decisions

  1. Wrapper, not custom service — Reuses MLflow's built-in server rather than building custom REST API. Reduces maintenance burden.
  2. S3 artifacts in production — Dev uses local Docker volume; production uses s3://tradai-mlflow-{ENV}/artifacts configured via Pulumi.
  3. Separate namespacetradai_mlflow avoids import collisions with the mlflow package itself.

API

MLflow exposes its standard REST API on port 5000 (container) / 5001 (host): - Tracking API: POST /api/2.0/mlflow/runs/create - Search: POST /api/2.0/mlflow/runs/search - UI: http://localhost:5001

See MLflow REST API docs for the full API reference.