Skip to content

Added gitlab_tags helper to MLflow API

Darby Frey requested to merge mlflow-extract-custom-gitlab-tags into master

What does this MR do and why?

Related to [MLflow Compatibility]: allow users to pass ver... (#434408 - closed), this MR adds:

  • The gitlab_tags API helper method to extract gitlab. tags to a special input hash
  • The custom_version API helper method to return the version string when supplied as a gitlab tag (gitlab.version)
  • The ability to persist the gitlab.version tag value as the version for a model version

How to set up and validate locally

  1. In the Rails console, ensure the feature flags are enabled

    Feature.enable(:ml_experiment_tracking)
    Feature.enable(:model_registry)
  2. In the Rails console, create an ML model in the project

    Ml::CreateModelService.new(Project.find(PROJECT_ID), 'my-model-name').execute
  3. Enable the Model Registry feature toggle in the project by going to Settings > General > Visibility, project features, permissions and flipping the toggle for Model Registry

  4. Use the following cURL command to create a new model version with a custom version string in a local GDK project

    curl -X "POST" "http://GDKHOST/api/v4/projects/PROJECT_ID/ml/mlflow/api/2.0/mlflow/model-versions/create" \
        -H 'Authorization: Bearer PERSONAL_ACCESS_TOKEN' \
        -H 'Content-Type: application/json; charset=utf-8' \
        -d $'{
      "name": "my-model-name",
      "tags": [
        {
          "key": "gitlab-version",
          "value": "4.5.6"
        }
      ],
      "description": "My Model Description"
    }'    
  5. Use the get API to look up the newly created model version.

    curl -X "GET" "http://GDKHOST/api/v4/projects/PROJECT_ID/ml/mlflow/api/2.0/mlflow/model-versions/get?name=my-model-name&version=4.5.6" \
        -H 'Authorization: Bearer PERSONAL_ACCESS_TOKEN'    

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Darby Frey

Merge request reports

Loading