Support pausing jobs #104313

Manually merged
Sybren A. Stüvel merged 28 commits from David-Zhang-10/flamenco:paused-job-status into main 2024-07-01 17:53:44 +02:00
Showing only changes of commit 95f3472e6d - Show all commits

View File

@ -168,7 +168,9 @@ func (sm *StateMachine) jobStatusIfAThenB(
// isJobPausingComplete returns true when the job status is pause-requested and there are no more active tasks.
func (sm *StateMachine) isJobPausingComplete(ctx context.Context, logger zerolog.Logger, job *persistence.Job) (bool, error) {
if job.Status == api.JobStatusPauseRequested {
if job.Status != api.JobStatusPauseRequested {
return false, nil
}
numActive, _, err := sm.persist.CountTasksOfJobInStatus(ctx, job, api.TaskStatusActive)
if err != nil {
return false, err
@ -178,7 +180,6 @@ func (sm *StateMachine) isJobPausingComplete(ctx context.Context, logger zerolog
logger.Info().Msg("No more active tasks, job is paused")
return true, nil
}
}
return false, nil
}