Skip to content

Added MLFLow API to update registered models

Darby Frey requested to merge update-registered-models-api into master

What does this MR do and why?

Continuing on the work to build the MLFlow Registered Models API, this MR adds the update endpoint.

The Update RegisteredModel API accepts a name and description. It returns a RegisteredModel object, or an error message if the validation fails.

Example response payload:

{
  "name": "my-model-name",
  "creation_timestamp": "2023-10-17T18:26:55.556Z",
  "last_updated_timestamp": "2023-10-17T18:26:55.556Z",
  "description": "My Model Description",
  "user_id": "1",
  "tags": [
    {
      "key": "key1",
      "value": "value1"
    },
    {
      "key": "key2",
      "value": "value2"
    }
  ]
}

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

  1. In the Rails console, ensure the feature flag is enabled

    Feature.enable(:ml_experiment_tracking)
  2. Use the following cURL command to create a model in a local GDK project

    curl -X "POST" "http://GDKHOST/api/v4/projects/PROJECT_ID/ml/mlflow/api/2.0/mlflow/registered-models/create" \
        -H 'Authorization: Bearer PERSONAL_ACCESS_TOKEN' \
        -H 'Content-Type: application/json; charset=utf-8' \
        -d $'{
      "name": "my-model-name",
      "tags": [
        {
          "key": "key1",
          "value": "value1"
        },
        {
          "key": "key2",
          "value": "value2"
        }
      ],
      "description": "My Model Description"
    }'    
  3. Use the following cURL command to update the model in a local GDK project

    curl -X "POST" "http://GDKHOST/api/v4/projects/PROJECT_ID/ml/mlflow/api/2.0/mlflow/registered-models/update" \
        -H 'Authorization: Bearer PERSONAL_ACCESS_TOKEN' \
        -H 'Content-Type: application/json; charset=utf-8' \
        -d $'{
      "name": "my-model-name",
      "description": "My Updated Model Description"
    }'   
    
    

Database Review

Update Query

UPDATE
  "ml_models"
SET
  "updated_at" = '2023-11-01 17:32:39.477927',
  "description" = 'updated'
WHERE
  "ml_models"."id" = 45

https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/23578/commands/75806

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