Skip to content

Commit

Permalink
UPSTREAM: <carry>: chore(backend): Rename UpdateLastRun -> SetLastRun…
Browse files Browse the repository at this point in the history
…Timestamp

follup up to bf77909. Rename UpdateLastRun -> SetLastRunTimestamp

also tweak a related log message

Signed-off-by: Greg Sheremeta <[email protected]>
  • Loading branch information
gregsheremeta authored and Elay Aharoni (EXT-Nokia) committed Sep 3, 2024
1 parent 9686eaf commit 8e7a0a4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
6 changes: 3 additions & 3 deletions backend/src/apiserver/resource/resource_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -566,9 +566,9 @@ func (r *ResourceManager) CreateRun(ctx context.Context, run *model.Run) (*model
}

// Upon run creation, update owning experiment
err = r.experimentStore.UpdateLastRun(newRun)
err = r.experimentStore.SetLastRunTimestamp(newRun)
if err != nil {
return nil, util.Wrap(err, fmt.Sprintf("Failed to update last_run_created_at in experiment %s for run %s", newRun.ExperimentId, newRun.UUID))
return nil, util.Wrap(err, fmt.Sprintf("Failed to set last run timestamp on experiment %s for run %s", newRun.ExperimentId, newRun.UUID))
}

return newRun, nil
Expand Down Expand Up @@ -1253,7 +1253,7 @@ func (r *ResourceManager) ReportWorkflowResource(ctx context.Context, execSpec u
runId = run.UUID
}
// Upon run creation, update owning experiment
if updateError = r.experimentStore.UpdateLastRun(run); updateError != nil {
if updateError = r.experimentStore.SetLastRunTimestamp(run); updateError != nil {
return nil, util.Wrapf(updateError, "Failed to report a workflow for existing run %s during updating the owning experiment.", runId)
}
}
Expand Down
6 changes: 3 additions & 3 deletions backend/src/apiserver/storage/experiment_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type ExperimentStoreInterface interface {
ArchiveExperiment(expId string) error
UnarchiveExperiment(expId string) error
DeleteExperiment(uuid string) error
UpdateLastRun(run *model.Run) error
SetLastRunTimestamp(run *model.Run) error
}

type ExperimentStore struct {
Expand Down Expand Up @@ -419,9 +419,9 @@ func (s *ExperimentStore) UnarchiveExperiment(expId string) error {
return nil
}

func (s *ExperimentStore) UpdateLastRun(run *model.Run) error {
func (s *ExperimentStore) SetLastRunTimestamp(run *model.Run) error {
expId := run.ExperimentId
// UpdateLastRun results in the experiment getting last_run_created_at updated
// SetLastRunTimestamp results in the experiment getting last_run_created_at updated
query, args, err := sq.
Update("experiments").
SetMap(sq.Eq{
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/pages/__snapshots__/ExperimentList.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ exports[`ExperimentList renders a list of one experiment 1`] = `
"customRenderer": [Function],
"flex": 1,
"label": "Last 5 runs",
"sortKey": "last_run_created_at",
},
]
}
Expand Down Expand Up @@ -70,6 +71,7 @@ exports[`ExperimentList renders a list of one experiment with error 1`] = `
"customRenderer": [Function],
"flex": 1,
"label": "Last 5 runs",
"sortKey": "last_run_created_at",
},
]
}
Expand Down Expand Up @@ -106,6 +108,7 @@ exports[`ExperimentList renders a list of one experiment with no description 1`]
"customRenderer": [Function],
"flex": 1,
"label": "Last 5 runs",
"sortKey": "last_run_created_at",
},
]
}
Expand Down Expand Up @@ -142,6 +145,7 @@ exports[`ExperimentList renders an empty list with empty state message 1`] = `
"customRenderer": [Function],
"flex": 1,
"label": "Last 5 runs",
"sortKey": "last_run_created_at",
},
]
}
Expand Down

0 comments on commit 8e7a0a4

Please sign in to comment.