Business logic to create an Ml::ModelVersion
What does this MR do and why?
Business logic to create an Ml::ModelVersion. This will be called from https://gitlab.com/gitlab-org/gitlab/-/blob/master/app/services/packages/ml_model/create_package_file_service.rb#L14-14, but this MR is already too large.
The next work can be found in the following MRs:
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
Database
Ml::Experiment
- find_or_create
SELECT
"ml_experiments".*
FROM
"ml_experiments"
WHERE
"ml_experiments"."project_id" = 1
AND "ml_experiments"."name" = 'abc'
https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/20398/commands/66611
Ml::Model
- find_or_create
SELECT
"ml_models".*
FROM
"ml_models"
WHERE
"ml_models"."project_id" = 1
AND "ml_models"."name" = 'abcd'
LIMIT 1
https://postgres.ai/console/gitlab/gitlab-production-tunnel-pg12/sessions/20398/commands/66612
Ml::ModelVersion
- find_or_create
SELECT
"ml_model_versions".*
FROM
"ml_model_versions"
WHERE
"ml_model_versions"."project_id" = 1
AND "ml_model_versions"."model_id" = 2
AND "ml_model_versions"."version" = '12345'
table is not available on production to run queries, local output of EXPLAIN ANALYZE:
Index Scan using index_ml_model_versions_on_project_id_and_name_and_version on ml_model_versions (cost=0.15..2.19 rows=1 width=112) (actual time=0.007..0.008 rows=0 loops=1)
Index Cond: ((project_id = 1) AND (version = '12345'::text))
Filter: (model_id = 2)
-
I have evaluated the MR acceptance checklist for this MR.
Related to #410130 (closed)
Edited by Dylan Griffith