Skip to content

Model Registry edit model graphql mutation

What does this MR do and why?

This merge request introduces a new mutation to edit machine learning models, allowing users to update the description of existing models. It also refactors the codebase to use a service object for updating models, making the code more modular and easier to maintain. Additionally, it updates the GraphQL documentation and adds several tests to ensure the new functionality works as expected.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

  1. Go to GDK
  2. Enable the Model registry feature if it's not yet enabled Feature.enable("model_registry")
  3. In the rails console create a model without a description
p = Project.find_by(name:"Flight")
Ml::CreateModelService.new(p, "model_1").execute 
Ml::Model.find_by(name: "model_1").id
  1. Verify the model exists and has no description (replace the ID): http://127.0.0.1:3000/flightjs/Flight/-/ml/models/8#/
  2. Alternatively use GraphQL to verify
query {
  mlModel(id: "gid://gitlab/Ml::Model/8") {
    id
    description
    descriptionHtml
  }
}
  1. Change the description with GraphQL (change the ID):
mutation editModel {
  mlModelEdit(
    input: { 
      projectPath: "flightjs/Flight", 
      modelId: 8,
      name: "model_1", 
      description:  "New description"
    }
  ) {
    model {
      id
      _links {
        showPath
      }
    }
    errors
  }
}
  1. Verify that the description is updated (replace the ID): http://127.0.0.1:3000/flightjs/Flight/-/ml/models/8#/

Numbered steps to set up and validate the change are strongly suggested.

Related to #475035 (closed)

Edited by Fred de Gier

Merge request reports

Loading