Support pausing jobs #104313
@ -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.
|
// 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) {
|
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)
|
numActive, _, err := sm.persist.CountTasksOfJobInStatus(ctx, job, api.TaskStatusActive)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
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")
|
logger.Info().Msg("No more active tasks, job is paused")
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user