Skip to content

Commit

Permalink
chore(backend): Rename UpdateLastRun -> SetLastRunTimestamp
Browse files Browse the repository at this point in the history
follup up to bf77909. Rename UpdateLastRun -> SetLastRunTimestamp

also tweak a related log message

Signed-off-by: Greg Sheremeta <[email protected]>
  • Loading branch information
gregsheremeta committed Jun 27, 2024
1 parent dadfb38 commit dd1c5cc
Show file tree
Hide file tree
Showing 2 changed files with 6 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 @@ -552,9 +552,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 @@ -1264,7 +1264,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

0 comments on commit dd1c5cc

Please sign in to comment.