Please note: The code in these repos is sourced from the DataRobot user community and is not owned or maintained by DataRobot, Inc. You may need to make edits or updates for this code to function properly in your environment.
This is example code not meant for production.
This repo contains example code for learning and understanding MLOps
in DataRobot. In this example we use docker-compose.yml to illustrate a
reference architecture. The goal of this project is to make it easy to
understand how to use and instrument MLOps using both DataRobot natively hosted
models and prediction services as well as those not hosted in DataRobot.
Dependencies
- Auto MPG model deployed. See Quickstart Guide
- Docker
- Docker-compose
- mlops-agent
- Download from DataRobot>User Menu> Developer Tools
- Move
tar.gzfile to the root of this project
Copy and configure example.env and example.mlops.conf.yaml e.g.:
cp example.env .env- Populate with relevant values e.g.:
- DATAROBOT_API_TOKEN instructions
- DATAROBOT_ENDPOINT instructions
- KEEP_ALIVE=600
- ENV_MLOPS_AGENT_VERSION=6.1.5
- ENV_MLOPS_AGENT_BUILD=325
- ENV_AUTO_MLOPS_DEPLOYMENT_ID & ENV_AUTO_MLOPS_MODEL_ID instructions
- ENV_EXTERNAL_MLOPS_DEPLOYMENT_ID & ENV_EXTERNAL_MLOPS_MODEL_ID set after creating a deployment (see below)
cd .docker/mlops-agent/etccp example.mlops.conf.yaml mlops.conf.yaml- Populate
apiTokeninmlops.conf.yamlinstructions
Create a deployment reference to your external prediction service:
docker-compose run --rm --entrypoint="/bin/bash register_deployment.sh" mock-external-prediction-serviceThis will produce something like:
WARNING: The ENV_MLOPS_DEPLOYMENT_ID variable is not set. Defaulting to a blank string.
WARNING: The ENV_MLOPS_MODEL_ID variable is not set. Defaulting to a blank string.
Uploading training data - /root/data/auto-mpg.csv. This may take some time...
Training dataset uploaded. Catalog ID <catalog id>.
======== DEPLOYMENT CONFIGURATION SUMMARY ========
export MLOPS_DEPLOYMENT_ID=<deployment id>; export MLOPS_MODEL_ID=<model id>Set values in .env from those printed out in the previous step:
- ENV_EXTERNAL_MLOPS_DEPLOYMENT_ID & ENV_EXTERNAL_MLOPS_MODEL_ID
Run examples and check both the original Auto MPG and the external service MLOps tabs in DataRobot to confirm both are monitoring:
docker-compose upStop with: ctl-d
If you'd like to report an issue or bug, suggest improvements, or contribute code to this project, please refer to CONTRIBUTING.md.
This project has adopted the Contributor Covenant for its Code of Conduct. See CODE_OF_CONDUCT.md to read it in full.
Licensed under the Apache License 2.0. See LICENSE to read it in full.