Skip to content

Service to delete model versions

Sri Rang requested to merge mlflow-api-model-versions-endpoint-delete into master

What does this MR do and why?

Depends on !134908 (merged)

Screenshots or screen recordings

None, purely backend

How to set up and validate locally

  1. Enable the feature flag

    Feature.enable(:model_registry)
  2. Create a model version with some package using the API (fill in $GLAB_TOKEN and $PROJECT_ID):

    curl  --header "Authorization:$GLAB_TOKEN" --upload-file blah.txt "http://localhost:3000/api/v4/projects/$PROJECT_ID/packages/ml_models/blah2/1.1.0/blah.txt"
  3. Delete the model version using the service on console:

    u = User.find_by(id: 1) # or the user that created the model version
    p = Project.find_by(id: 1) # or the $PROJECT_ID used above
    ::Ml::ModelVersions::DeleteService.new(p, 'blah2', '1.1.0', u).execute

Database

Query

DELETE FROM "ml_model_versions"
WHERE "ml_model_versions"."id" = 1

Local explain analyze

Delete on ml_model_versions  (cost=0.15..2.17 rows=0 width=0) (actual time=0.013..0.013 rows=0 loops=1)
  ->  Index Scan using ml_model_versions_pkey on ml_model_versions  (cost=0.15..2.17 rows=1 width=6) (actual time=0.011..0.012 rows=0 loops=1)
        Index Cond: (id = 1)
Planning Time: 0.098 ms
Execution Time: 0.034 ms

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 Eduardo Bonet

Merge request reports

Loading