Mlflow endpoint `mlflow/model_versions/get`
What does this MR do and why?
Implemented the Mlflow ModelVersions GET endpoint in accordance to https://mlflow.org/docs/2.6.0/rest-api.html#get-modelversion
Underlying issue: #427454
Mlflow endpoint mlflow/model_version/get
-
GetModelVersionService
service to get a model version by project, model name and version - Entity for core Mlflow types
ModelVersion
andModelVersionTag
- Entity for
get
response - Endpoint
Example
GET http://local-gitlab.com:3000/api/v4/projects/7/ml/mlflow/api/2.0/mlflow/model_versions/get?name=my-model&version=0.0.1
Accept: application/json
Authorization: Bearer glpat-xxx
{
"model_version": {
"name": "my-model",
"version": "0.0.1",
"creation_timestamp": 1698082326,
"last_updated_timestamp": 1698082327,
"user_id": null,
"current_stage": "development",
"description": "",
"source": "api/v4/projects/(id)/packages/ml_models/my-model/model_version/",
"run_id": "",
"status": "READY",
"status_message": "",
"metadata": [],
"run_link": "",
"aliases": []
}
}
Database
Query for Ml::ModelVersion.by_project_id_name_and_version
SELECT
"ml_model_versions".*
FROM
"ml_model_versions"
INNER JOIN "ml_models" ON "ml_model_versions"."model_id" = "ml_models"."id"
WHERE
"ml_model_versions"."project_id" = 7
AND "ml_model_versions"."version" = '0.0.1'
AND "ml_models"."name" = 'my-model'
LIMIT 1
Local explain analyze output:
Nested Loop (cost=0.30..5.18 rows=1 width=80) (actual time=0.020..0.022 rows=1 loops=1)
-> Index Scan using index_ml_model_versions_on_project_id_and_model_id_and_version on ml_model_versions (cost=0.15..2.20 rows=1 width=80) (actual time=0.013..0.014 rows=1 loops=1)
Index Cond: ((project_id = 7) AND (version = '0.0.1'::text))
-> Index Scan using ml_models_pkey on ml_models (cost=0.15..2.17 rows=1 width=8) (actual time=0.005..0.005 rows=1 loops=1)
Index Cond: (id = ml_model_versions.model_id)
Filter: (name = 'my-model'::text)
Planning Time: 0.103 ms
Execution Time: 0.035 ms
How to set up and validate locally
Verify the tests that hit the API endpoint and get desired result compliant with Mlflow schema
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 Sri Rang