Manager: at startup check for stuck pause-requested jobs

When the Manager starts up, it now also checks whether `pause-requested`
jobs can actually go to `paused`.
This commit is contained in:
Sybren A. Stüvel 2025-02-28 12:26:55 +01:00
parent ff29d2ef26
commit d10bb0a9d7
3 changed files with 11 additions and 3 deletions

View File

@ -10,7 +10,7 @@ bugs in actually-released versions.
- The conversion from a known path prefix to a variable is now done in a case-insensitive way. This means that if the variable `{storage}` has value `S:\Flamenco`, a path `s:\flamenco\project\file.blend` will be recognised and stored as `{storage}\project\file.blend`.
This happens uniformly, regardless of the platform. So also on Linux, which has a case-sensitive filesystem, this matching is done in a case-insensitive way. It is very unlikely that a Flamenco configuration has two separate variables, for paths that only differ in their case.
- Fix issue where jobs could get stuck in `pause-requested` state.
- Fix issue where jobs could get stuck in `pause-requested` state. Such jobs are now also detected at startup of the Manager, and sent to `paused` when possible.
## 3.6 - released 2024-12-01

View File

@ -662,7 +662,11 @@ func (sm *StateMachine) CheckStuck(ctx context.Context) {
sm.mutex.Lock()
defer sm.mutex.Unlock()
stuckJobs, err := sm.persist.FetchJobsInStatus(ctx, api.JobStatusCancelRequested, api.JobStatusRequeueing)
stuckJobs, err := sm.persist.FetchJobsInStatus(ctx,
api.JobStatusCancelRequested,
api.JobStatusRequeueing,
api.JobStatusPauseRequested,
)
if err != nil {
log.Error().Err(err).Msg("unable to fetch stuck jobs")
return

View File

@ -447,7 +447,11 @@ func TestCheckStuck(t *testing.T) {
// task3 := taskOfSameJob(task2, api.TaskStatusSoftFailed)
job.Status = api.JobStatusRequeueing
mocks.persist.EXPECT().FetchJobsInStatus(ctx, api.JobStatusCancelRequested, api.JobStatusRequeueing).
mocks.persist.EXPECT().FetchJobsInStatus(ctx,
api.JobStatusCancelRequested,
api.JobStatusRequeueing,
api.JobStatusPauseRequested,
).
Return([]*persistence.Job{job}, nil)
mocks.persist.EXPECT().CountTasksOfJobInStatus(ctx, job, api.TaskStatusCompleted).Return(1, 3, nil)