Skip to content
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

Merged
merged 3 commits into from
Nov 29, 2023

Conversation

NicholasBlaskey
Copy link
Contributor

@NicholasBlaskey NicholasBlaskey commented Nov 16, 2023

Description

First step of migration towards runs.

Only changes are trials table renamed to runs, run_id to restart_id, external_trial_id to external_run_id, and a view.

Test Plan

Commentary (optional)

Checklist

  • Changes have been manually QA'd
  • User-facing API changes need the "User-facing API Change" label.
  • Release notes should be added as a separate file under docs/release-notes/.
    See Release Note for details.
  • Licenses should be included for new code which was copied and/or modified from any external code.

Ticket

@cla-bot cla-bot bot added the cla-signed label Nov 16, 2023
Copy link

netlify bot commented Nov 16, 2023

Deploy Preview for determined-ui canceled.

Name Link
🔨 Latest commit 886ec10
🔍 Latest deploy log https://app.netlify.com/sites/determined-ui/deploys/6567555505c9ef0008cceadc

@NicholasBlaskey NicholasBlaskey changed the title First run migration chore: run migration moving trials to view and rename Nov 27, 2023
Copy link
Contributor

@stoksc stoksc left a 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

}

// ToRun converts a trial to a run.
func (t *Trial) ToRun() *Run {
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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).

Copy link
Contributor Author

@NicholasBlaskey NicholasBlaskey Nov 29, 2023

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().
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some TODOs

@NicholasBlaskey NicholasBlaskey changed the title chore: run migration moving trials to view and rename chore: run migration moving trials to view and rename [DET-9989] Nov 29, 2023
@NicholasBlaskey NicholasBlaskey enabled auto-merge (squash) November 29, 2023 15:27
@NicholasBlaskey NicholasBlaskey merged commit 66b7225 into main Nov 29, 2023
67 of 81 checks passed
@NicholasBlaskey NicholasBlaskey deleted the first_run_migration branch November 29, 2023 15:32
@dannysauer dannysauer added this to the 0.26.7 milestone Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants