[MLflow Compatibility]: allow users to pass version as a tag
While we encourage use of SemVer for models versioning, we currently don't allow users to set those version values, since they are autoincremented due to a limitation on MLflow client. We can allow users to pass the version through the tags, simillar to how we allow users to pass a ci_build_id to a candidate: https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/services/ml/experiment_tracking/handle_candidate_gitlab_metadata_service.rb#L5
We can do better, however, by considering those tags as parameters: at the start of processing the endpoint, we go through every tag and extract those that start with gitlab., and add these to the params, which are then passed to the services. So, for example:
# api_helpers.rb
def extract_tag_to_param
return unless params[:tags]
prefix = 'gitlab.'
new_params = tags.filter { |t| t[:key].starts_with(prefix) }
.map { |t| [t[:key].remove_prefix(prefix), t[:value]] }
.to_h
params.merge(new_params)
end
Edited by Eduardo Bonet