Service to delete model versions
What does this MR do and why?
Depends on !134908 (merged)
- Introduces a service to delete model version by project, name and version
- End goal, implement https://mlflow.org/docs/2.6.0/rest-api.html#delete-modelversion
Screenshots or screen recordings
None, purely backend
How to set up and validate locally
-
Enable the feature flag
Feature.enable(:model_registry)
-
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"
-
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.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Eduardo Bonet