DFlow API is an MLOps orchestration engine built to automate the Machine Learning model lifecycle. It provides a unified interface to upload datasets, define declarative training configurations, and delegate heavy computational workloads to a Kubernetes cluster. The system natively integrates with MLflow to ensure complete traceability, metrics tracking, and version control.
- S3-Compatible Storage: Secure dataset ingestion and management via MinIO.
- Kubernetes Orchestration: Automated provisioning of isolated, ephemeral Jobs for individual training experiments using the official Ludwig image.
- Declarative Auto-ML: Integrates with Ludwig AI to enable model training through JSON configuration schemas, abstracting boilerplate deep learning code.
- Unified Experiment Management: New endpoints to list, track, and delete experiments from both local state and MLflow history.
- Detailed Run Tracking: Retrieve metrics, parameters, and tags for individual training runs directly from MLflow.
- Asynchronous Execution: Non-blocking API design that offloads resource-intensive tasks to the cluster backend.
- CORS Support: Enabled for seamless integration with frontend applications.
- API Framework: FastAPI (Python)
- Data Storage: MinIO
- Container Orchestration: Kubernetes (K8s)
- Machine Learning Engine: Ludwig AI
- Tracking & Registry: MLflow
To run this project, the following dependencies must be configured in your environment:
- Python 3.10+
- Access to a Kubernetes cluster (with a valid
~/.kube/configfile). - An operational MinIO server with access credentials.
- An operational MLflow Tracking server.
git clone https://github.com/your-username/dflow.git
cd dflowpython -m venv venv.\venv\Scripts\activatesource venv/bin/activatepip install -r requirements.txtCreate a .env file in the project root:
MINIO_URL=minio.your-domain.com
MINIO_ACCESS_KEY=your_access_key
MINIO_SECRET_KEY=your_secret_key
BUCKET_NAME=your_bucket_name
KUBERNETES_CONFIG_PATH=~/.kube/config
KUBERNETES_NAMESPACE=api-dlflow
MLFLOW_TRACKING_URI=http://your-mlflow-ip:63163python -m uvicorn src.main:app --reload --port 8000The API follows a modular path structure. Interactive documentation is available at http://localhost:8000/docs.
- Method:
GET - Path:
/api/mlops/experiments - Description: Returns a merged list of experiments from the local tracking database (active jobs) and MLflow history.
- Method:
POST - Path:
/api/mlops/experiment - Description: Initializes a new training job.
- Multipart Fields:
Field Description csv_fileDataset file to be processed (e.g. data.csv)model_typeInternal reference algorithm (e.g. Ludwig_Test)config_jsonStringified JSON object containing Ludwig configuration parameters dependencies(Optional) JSON list or comma-separated string of dependencies experiment_nameLogical grouping name in MLflow (Default: dflow-default-experiment)model_nameFinal model artifact name in the MLflow Model Registry (Default: ludwig_model)
curl -X POST "http://localhost:8000/api/mlops/experiment" \
-F "csv_file=@data.csv" \
-F "model_type=Ludwig_Test" \
-F "experiment_name=Predictive_Maintenance" \
-F "model_name=Engine_Predictor" \
-F 'config_json={
"input_features": [{"name": "rpm", "type": "numerical"}],
"output_features": [{"name": "imminent_failure", "type": "category"}],
"trainer": {"epochs": 10}
}'- Method:
DELETE - Path:
/api/mlops/experiment/{experiment_name} - Description: Removes the experiment from both the local database and the MLflow Tracking Server.
- Method:
GET - Path:
/api/mlops/runs/{experiment_name} - Description: Retrieves all training runs associated with the experiment name from MLflow, including metrics and parameters.
1. API receives dataset + training configuration.
2. CSV file is uploaded to MinIO.
3. Kubernetes provisions a Ludwig training Job.
4. Pod downloads dataset and executes training.
5. MLflow logs metrics and registers the trained model.
- Ingestion: API receives the dataset and training JSON. The CSV is uploaded to MinIO under
<experiment_id>/filename.csv. - Orchestration: A Kubernetes Job is created using the
ludwigai/ludwig:latestimage. - Training: The Pod executes a generated Python script that:
- Downloads the dataset from MinIO.
- Initializes the
LudwigModel. - Starts the training pipeline.
- Traceability: Upon completion, training statistics and the model artifact are automatically logged to MLflow via integrated callbacks.
.
├── src/
│ ├── main.py # API Entry point and route definitions
│ ├── k8s_utils.py # Kubernetes Job orchestration logic
│ ├── minio_utils.py # Storage interaction utilities
│ └── database.py # Local state tracking (In-memory)
├── data/ # Sample datasets
├── docs/ # Documentation and runbooks
├── requirements.txt
├── .env
└── README.md
- Add authentication and role-based access.
- Support distributed training workloads.
- Add GPU scheduling support in Kubernetes.
- Integrate hyperparameter optimization.
- Add experiment monitoring dashboard.
This project is licensed under the MIT License.