Giter Club home page Giter Club logo

kafka-connect-mlflow's Introduction

Kafka Connect MLflow source

Dedicated Kafka Connector to track changes in MLflow Model Registry

Table of contents

General info

Kafka Connector to track model stage changes for configured MLflow Model Registry instance. The purpose is to fetch ModelRegistry.ModelVersion which recently change status to Production and generate Model Export Request as event on Kafka topic.

Event schema and sample payload of the event
{
  "schema": {
    "type": "struct",
    "fields": [
      {
        "type": "string",
        "optional": false,
        "field": "Name"
      },
      {
        "type": "string",
        "optional": false,
        "field": "Version"
      },
      {
        "type": "int64",
        "optional": false,
        "field": "CreationTimestamp"
      },
      {
        "type": "int64",
        "optional": false,
        "field": "lastUpdatedTimestamp"
      },
      {
        "type": "string",
        "optional": true,
        "field": "userId"
      },
      {
        "type": "string",
        "optional": false,
        "field": "currentStage"
      },
      {
        "type": "string",
        "optional": false,
        "field": "description"
      },
      {
        "type": "string",
        "optional": false,
        "field": "source"
      },
      {
        "type": "string",
        "optional": false,
        "field": "runId"
      },
      {
        "type": "string",
        "optional": false,
        "field": "status"
      },
      {
        "type": "string",
        "optional": true,
        "field": "statusMessage"
      },
      {
        "type": "array",
        "items": {
          "type": "struct",
          "fields": [
            {
              "type": "string",
              "optional": false,
              "field": "Key"
            },
            {
              "type": "string",
              "optional": false,
              "field": "Value"
            }
          ],
          "optional": false,
          "name": "ModelExportRequest"
        },
        "optional": true,
        "field": "tags"
      },
      {
        "type": "string",
        "optional": false,
        "field": "runLink"
      }
    ],
    "optional": false,
    "name": "ModelExportRequest"
  },
  "payload": {
    "Name": "aaa",
    "Version": "1",
    "CreationTimestamp": 1609331596360,
    "lastUpdatedTimestamp": 1609331610766,
    "userId": "",
    "currentStage": "Production",
    "description": "",
    "source": "file:///tmp/test/1/6ebcc72f3ad24c65b1821ff5283caa0d/artifacts/model",
    "runId": "6ebcc72f3ad24c65b1821ff5283caa0d",
    "status": "READY",
    "statusMessage": "",
    "tags": [],
    "runLink": ""
  }
}

Local setup

Connector is distributed as a jar file. In order to build the assembly use mvn clean install -f ./kafka-connect-mlflow. Assembly will be available in directory ./kafka-connect-mlflow/target/kafka-connect-mlflow-${project_version}-assembly.jar.

Kafka Connect requires Apache Kafka and Apache Zookeeper servers. There is docker-compose.yaml available to run all required components as containers. Generated jar is mounted as the volume in kafka-connect container taken directly from ./target directory.

Additionally, docker-compose/yaml contains kafka-connect-ui service to setup kafka-connect-mlflow instance through browser. It is exposed on port 8000 by default.

Connector should now be available through Kafka Connect UI: New Connector

Creating new instance of connector: New Instance

Event can be trigger by registering model version from MLflow Tracking UI: MLflow tracking UI

And changing the stage of the model version to Production: MLflow model registry

Release

Maven support releases with maven-release-plugin. Release can be generated using two-step procedure:

  • Prepare release (use flag -DdryRun=true if you want to verify it before creating release)

    mvn release:prepare -DignoreSnapshots=true -DskipTests=true -f ./kafka-connect-mlflow/

    two commits will be added on top of your commit and pushed to your branch:

    • prepare release kafka-connect-mlflow-${version} with proper tag
    • prepare for next development iteration
  • Tag pushed in the previous step triggers gitlab ci/cd deploy stage which publish your assembly to artifactory

  • Clean release files after all

    mvn release:clean -f ./kafka-connect-mlflow/

kafka-connect-mlflow's People

Contributors

dwarszawski 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.