Code Monkey home page Code Monkey logo

mlflow_docker's Introduction

MLFlow Docker Deployment with Databricks Integration

Containerized Deployment of MLFlow Models with Databricks Integration

Architecture

mlflow_architecture

Methods

The following code utilizes gunicorn, docker, docker-compose, and mlflow to deploy models. Models are retrieved from Databricks' MLFlow registry and loaded in a dockerized gunicorn wsgi app. See Accessing MLFlow Outside of Databricks for more details.

Used Python Libraries

  • MLFlow
  • gunicorn
  • flask

Open Ports

  • 5000

Requirements

  • Docker Deployment Support
  • Databricks Account
  • Connection to Databricks MLFlow Registry

Instructions

Setting up a Databricks Service Account

To retrieve models from Databricks, it is highly suggested to use a service account in Databricks. See Databricks User Admin Guide for details on how to manager users.

Retrieving Databricks credentials

To retrieve Databricks tokens and credentials. See Databricks-CLI Guide for more details on how to setup the databricks cli.

Configuration

Please modify the values in config/web_srv.env to provide the needed credentials

Variable Description Extra Details
FLASK_APP Location of flask app code, do not modify!
MLFLOW_TRACKING_URI MLFlow Tracking server URI, keep as databricks
DATABRICKS_HOST URL for Databricks deployment, obtained from databricks configure listed as host in ~/.databrickscfg
DATABRICKS_TOKEN Token used for authorization/authentication against Databricks, obtained from databricks configure listed as password in ~/.databrickscfg
LOGGED_MODEL MLFlow model URI to retrieve

Run the Code

Clone this repo and run the following docker-compose command to bring up the gunicorn server.

docker-compose up

Prepare the Data

Convert a pandas dataframe to json with the split format

Prediction Endpoint

Post a POST request to localhost:5000/predict with a json payload to predict.

Test if gunicorn is working

In a separate terminal, run the following command to test if the gunicorn server is up. ** Note there is some startup time to connect to the MLFlow registry, so it is suggested to wait a few minutes before attempting curl the rest endpoint.

curl localhost:5000

Expected result is.

{"hello":"world"}

mlflow_docker's People

Contributors

brickmeister avatar

Stargazers

 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.