Skip to content

Commit

Permalink
Fix test_log_batch_nonexistent_run
Browse files Browse the repository at this point in the history
jgiannuzzi/mlflow-go#30

Signed-off-by: nojaf <florian.verdonck@outlook.com>
  • Loading branch information
nojaf authored and jgiannuzzi committed Oct 1, 2024
1 parent 9560e85 commit acee863
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/tracking/store/sql/runs.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ type PageToken struct {
}

func checkRunIsActive(transaction *gorm.DB, runID string) *contract.Error {
var lifecycleStage models.LifecycleStage
var run models.Run

err := transaction.
Model(&models.Run{}).
Where("run_uuid = ?", runID).
Select("lifecycle_stage").
Scan(&lifecycleStage).
First(&run).
Error
if err != nil {
if errors.Is(err, gorm.ErrRecordNotFound) {
Expand All @@ -54,14 +54,14 @@ func checkRunIsActive(transaction *gorm.DB, runID string) *contract.Error {
)
}

if lifecycleStage != models.LifecycleStageActive {
if run.LifecycleStage != models.LifecycleStageActive {
return contract.NewError(
protos.ErrorCode_INVALID_PARAMETER_VALUE,
fmt.Sprintf(
"The run %s must be in the 'active' state.\n"+
"Current state is %v.",
runID,
lifecycleStage,
run.LifecycleStage,
),
)
}
Expand Down

0 comments on commit acee863

Please sign in to comment.