Skip to content

Always create a new experiment for a model

What does this MR do and why?

To increase the bounds between Model experiments and model registry, and reduce conflicts when migrating model experiments into model registry later on (!144110 (merged)), we are forcing the creation of a new experiment when creating a new model, instead of reusing an existing one with the same in case it exists. The new experiment also clearly states it belongs to a model in its name.

Also updates services to use ServiceResponse, and deletes FindOrCreateModelService that wasn't being used anywhere.

This feature is behind a feature flag so it should not have a changelog.

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.

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 feature flag

    Feature.enable(:model_registry)
  2. create a Model, and check that the default experiment name is [model]model_name

    result = Ml::CreateModelService.new(Project.find(1), "model_name").execute
    result.payload.default_experiment.name
  3. Create an experiment with name [model]model_name_2, and then try to create a model with name model_name_2, it should error

    p = Project.find(1)
    Ml::CreateExperimentService.new(p, "[model]model_name_2").execute
    result = Ml::CreateModelService.new(p, "model_name_2").execute
    result.error? # should be true

Related to #432794

Edited by Darby Frey

Merge request reports