Adds graphql resolver to fetch a model version
What does this MR do and why?
Adds graphql resolver to fetch a model version
Required as part of moving show_ml_model_version.vue to graphql, adds a property to ModelType to allow for fetching a specific model version
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
-
In rails console enable the experiment fully
Feature.enable(:model_registry)
-
Create a model and model_version:
p = Project.find_by(id: 1) model = Ml::CreateModelService.new(p, "gitlab_amazing_model").execute model_version = Ml::FindOrCreateModelVersionService.new(p, { model_name: "gitlab_amazing_model", version: "1.0.0" }).execute
-
Open
http://localhost:3000/-/graphql-explorer
and run the following query (change model id for the model created):query { mlModel(id: "gid://gitlab/Ml::Model/1") { id version(modelVersionId: "gid://gitlab/Ml::ModelVersion/1") { id version } } }
It should output something like:
{ "data": { "mlModel": { "id": "gid://gitlab/Ml::Model/1", "version": { "id": "gid://gitlab/Ml::ModelVersion/1", "version": "1.0.0" } } } }
Edited by Darby Frey