Skip to content

Improves ml_model package endpoints

Eduardo Bonet requested to merge model_registry/update_endpoints into master

What does this MR do and why?

Updates ml model endpoints to use bearer token

  • Endpoints now look for a bearer token, to keep compatibility with MLflow client
  • Upload is taking write_model_registry policy into account.
  • File upload does not create a package, model or model version, these need to be created beforehand

This feature has not yet been released, none of these changes are breaking.

How to set up and validate locally

  1. Enable the feature flag
Feature.enable(:model_registry)
  1. Create a model and a model version:
p = Project.find_by(id: 20) # or whatever project you want to use for testing
model = Ml::FindOrCreateModelService.new(p, "model_1").execute

model_version = Ml::FindOrCreateModelVersionService.new(p, { model_name: "model_1", version: "1.0.0" }).execute 
  1. On a project with developer access, use the API to create a package and upload a file:
curl  --header "Authorization:Bearer $GLAB_TOKEN" --upload-file ./README.md "http://localhost:3000/api/v4/projects/20/packages/ml_models/model_1/1.0.0/README.md"

MR acceptance checklist

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

Merge request reports

Loading