-
Notifications
You must be signed in to change notification settings - Fork 356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: run migration moving trials to view and rename [DET-9989] #8440
Conversation
✅ Deploy Preview for determined-ui canceled.
|
373076d
to
3f9c384
Compare
1e3d8f6
to
2b76370
Compare
master/static/migrations/20231127110554_trial-to-run-view.tx.up.sql
Outdated
Show resolved
Hide resolved
934c33a
to
be4bfb9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, just some minor commentary
master/static/migrations/20231127110554_trial-to-run-view.tx.up.sql
Outdated
Show resolved
Hide resolved
} | ||
|
||
// ToRun converts a trial to a run. | ||
func (t *Trial) ToRun() *Run { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
write a test to make sure this is exhaustive? or turn the linter on for this struct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added a test
@@ -168,7 +172,7 @@ func (db *PgDB) UpdateTrialRunnerState(id int, state string) error { | |||
// UpdateTrialRunnerMetadata updates a trial's metadata about its runner. | |||
func (db *PgDB) UpdateTrialRunnerMetadata(id int, md *trialv1.TrialRunnerMetadata) error { | |||
if _, err := db.sql.Exec(` | |||
UPDATE trials | |||
UPDATE runs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could use a better strategy for updates than this, lol (500 different functions for each field).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// UpdateTrial updates an existing trial. Fields that are nil or zero are not
// updated. end_time is set if the trial moves to a terminal state.
func (db *PgDB) UpdateTrial(id int, newState model.State) error {
I agree, created https://hpe-aiatscale.atlassian.net/browse/DET-9993
update trial comment makes me think that it used to take multiple fields
_, err := tx.NewUpdate().Model(&obj).WherePK(). | ||
Set("run_id = run_id + 1"). | ||
run := model.Run{ID: trialID} | ||
_, err := tx.NewUpdate().Model(&run).WherePK(). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it'd be nice to put all these calls into a "runs" package eventually, instead of scattered over the entire codebase. can we start TODO'ing it if you agree?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some TODOs
Description
First step of migration towards runs.
Only changes are
trials
table renamed toruns
,run_id
torestart_id
,external_trial_id
toexternal_run_id
, and a view.Test Plan
Commentary (optional)
Checklist
docs/release-notes/
.See Release Note for details.
Ticket