Skip to content

Commit 43b97cc

Browse files
Ensure ToRunning does not update the checkpoint unnecessarily (#28)
1 parent c4195a4 commit 43b97cc

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

services/supervisor.go

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -359,12 +359,17 @@ func (c *Supervisor) superviseAction(analysisResult *RunStatusAnalysisResult) (t
359359

360360
return analysisResult.ObjectUID, nil
361361
case ToRunning:
362-
checkpointClone.LifecycleStage = models.LifecycleStageRunning
363-
// transition from buffered to running
364-
err := c.cqlStore.UpsertCheckpoint(checkpointClone)
365-
if err != nil { // coverage-ignore
366-
c.logger.V(0).Error(err, "failed to update algorithm submission status", "requestId", analysisResult.RequestId, "algorithm", analysisResult.Algorithm)
367-
return analysisResult.ObjectUID, err
362+
// only update the checkpoint if the scheduler failed to do so
363+
if checkpoint.LifecycleStage != models.LifecycleStageRunning {
364+
checkpointClone.LifecycleStage = models.LifecycleStageRunning
365+
// transition from buffered to running
366+
err := c.cqlStore.UpsertCheckpoint(checkpointClone)
367+
if err != nil { // coverage-ignore
368+
c.logger.V(0).Error(err, "failed to update algorithm submission status", "requestId", analysisResult.RequestId, "algorithm", analysisResult.Algorithm)
369+
return analysisResult.ObjectUID, err
370+
}
371+
372+
return analysisResult.ObjectUID, nil
368373
}
369374

370375
return analysisResult.ObjectUID, nil

0 commit comments

Comments
 (0)