Skip to content

Adds description to ModelVersionType

What does this MR do and why?

ModelVersionType is missing a description field, which is needed for !149708 (merged)

Steps to reproduce

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.

  1. In rails console enable the experiment fully

    Feature.enable(:model_registry)
  2. 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", description:  "My model version"}).execute
  3. 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
          description
        }
      }
    }

    It should output something like:

    {
      "data": {
        "mlModel": {
          "id": "gid://gitlab/Ml::Model/1",
          "version": {
            "id": "gid://gitlab/Ml::ModelVersion/1",
            "description": "My model version"
          }
        }
      }
    }

Merge request reports