Skip to content

datarobot-community/mlops-guide

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.

MLOps Guide

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

Usage

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/etc
  • cp example.mlops.conf.yaml mlops.conf.yaml
  • Populate apiToken in mlops.conf.yaml instructions

Create a deployment reference to your external prediction service:

docker-compose run --rm --entrypoint="/bin/bash register_deployment.sh" mock-external-prediction-service

This 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 up

Stop with: ctl-d

Development and Contributing

If you'd like to report an issue or bug, suggest improvements, or contribute code to this project, please refer to CONTRIBUTING.md.

Code of Conduct

This project has adopted the Contributor Covenant for its Code of Conduct. See CODE_OF_CONDUCT.md to read it in full.

License

Licensed under the Apache License 2.0. See LICENSE to read it in full.

About

Code examples that accompany the DataRobot MLOps guide

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •