Associate Ml::Candidate to Ci::Build
What does this MR do and why?
Often Ml::Candidates are created as part of a pipeline job. Linking this information allows us to enrich the candidate UI with a variety of useful information to users.
This value is when using the MLFlow client within a pipeline.
Database
Queries
UPDATE
"ml_candidates"
SET
"updated_at" = '2023-04-26 10:00:45.799311',
"ci_build_id" = 4
WHERE
"ml_candidates"."id" = 5;
Update on ml_candidates (cost=0.15..8.17 rows=1 width=160) (actual time=0.006..0.006 rows=0 loops=1)
-> Index Scan using ml_candidates_pkey on ml_candidates (cost=0.15..8.17 rows=1 width=160) (actual time=0.006..0.006 rows=0 loops=1)
Index Cond: (id = 5)
Planning Time: 10.611 ms
Execution Time: 0.035 ms
Migration
UP
main: == [advisory_lock_connection] object_id: 274460, pg_backend_pid: 54877
main: == 20230424122236 AddCiBuildIdToMlCandidate: migrating ========================
main: -- add_column(:ml_candidates, :ci_build_id, :bigint, {:null=>true})
main: -> 0.0050s
main: == 20230424122236 AddCiBuildIdToMlCandidate: migrated (0.0111s) ===============
main: == 20230424131551 AddIndexOnCiBuildIdToMlCandidates: migrating ================
main: -- transaction_open?()
main: -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main: -> 0.0867s
main: -- index_exists?(:ml_candidates, :ci_build_id, {:name=>"index_ml_candidates_on_ci_build_id", :algorithm=>:concurrently})
main: -> 0.0037s
main: -- execute("SET statement_timeout TO 0")
main: -> 0.0004s
main: -- add_index(:ml_candidates, :ci_build_id, {:name=>"index_ml_candidates_on_ci_build_id", :algorithm=>:concurrently})
main: -> 0.0036s
main: -- execute("RESET statement_timeout")
main: -> 0.0003s
main: == 20230424131551 AddIndexOnCiBuildIdToMlCandidates: migrated (0.1094s) =======
main: == [advisory_lock_connection] object_id: 274460, pg_backend_pid: 54877
ci: == [advisory_lock_connection] object_id: 274740, pg_backend_pid: 54880
ci: == 20230424122236 AddCiBuildIdToMlCandidate: migrating ========================
ci: -- add_column(:ml_candidates, :ci_build_id, :bigint, {:null=>true})
ci: -> 0.0045s
ci: == 20230424122236 AddCiBuildIdToMlCandidate: migrated (0.0149s) ===============
ci: == 20230424131551 AddIndexOnCiBuildIdToMlCandidates: migrating ================
ci: -- transaction_open?()
ci: -> 0.0000s
ci: -- view_exists?(:postgres_partitions)
ci: -> 0.0006s
ci: -- index_exists?(:ml_candidates, :ci_build_id, {:name=>"index_ml_candidates_on_ci_build_id", :algorithm=>:concurrently})
ci: -> 0.0116s
ci: -- execute("SET statement_timeout TO 0")
ci: -> 0.0003s
ci: -- add_index(:ml_candidates, :ci_build_id, {:name=>"index_ml_candidates_on_ci_build_id", :algorithm=>:concurrently})
ci: -> 0.0044s
ci: -- execute("RESET statement_timeout")
ci: -> 0.0003s
ci: == 20230424131551 AddIndexOnCiBuildIdToMlCandidates: migrated (0.0356s) =======
DOWN
ci: == 20230424131551 AddIndexOnCiBuildIdToMlCandidates: reverting ================
ci: -- transaction_open?()
ci: -> 0.0000s
ci: -- view_exists?(:postgres_partitions)
ci: -> 0.0007s
ci: -- indexes(:ml_candidates)
ci: -> 0.0029s
ci: -- remove_index(:ml_candidates, {:algorithm=>:concurrently, :name=>"index_ml_candidates_on_ci_build_id"})
ci: -> 0.0012s
ci: == 20230424131551 AddIndexOnCiBuildIdToMlCandidates: reverted (0.0184s) =======
ci: == 20230424122236 AddCiBuildIdToMlCandidate: reverting ======================
ci: -- remove_column(:ml_candidates, :ci_build_id, :bigint, {:null=>true})
ci: -> 0.0005s
ci: == 20230424122236 AddCiRelationsToMlCandidate: reverted (0.0137s) =============
main: == 20230424131551 AddIndexOnCiBuildIdToMlCandidates: reverting ================
main: -- transaction_open?()
main: -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main: -> 0.0007s
main: -- indexes(:ml_candidates)
main: -> 0.0030s
main: -- remove_index(:ml_candidates, {:algorithm=>:concurrently, :name=>"index_ml_candidates_on_ci_build_id"})
main: -> 0.0017s
main: == 20230424131551 AddIndexOnCiBuildIdToMlCandidates: reverted (0.0114s) =======
main: == 20230424122236 AddCiBuildIdToMlCandidate: reverting ======================
main: -- remove_column(:ml_candidates, :ci_build_id, :bigint, {:null=>true})
main: -> 0.0004s
main: == 20230424122236 AddCiRelationsToMlCandidate: reverted (0.0047s) =============
main: == [advisory_lock_connection] object_id: 274280, pg_backend_pid: 7853
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #406784 (closed)
Edited by Eduardo Bonet