WIP: Allow jobs to be submitted in paused status #104318

Closed
David Zhang wants to merge 32 commits from David-Zhang-10/flamenco:submit-as-paused into main

When changing the target branch, be careful to rebase the branch in your fork to match. See documentation.
3 changed files with 10 additions and 2 deletions
Showing only changes of commit e6bc9cd061 - Show all commits

View File

@ -18,5 +18,6 @@ curl -X 'POST' \
"message": "Blender is {blender}"
},
"type": "echo-sleep-test",
"submitter_platform": "manager"
"submitter_platform": "manager",
"initial_status": "paused"

Change this to queued so that the semantics of the script don't change.

For these kind of "I need a slightly different script" cases, I ususally just make a copy, then add its filename to .git/info/exclude so I don't accidentally commit it.

Change this to `queued` so that the semantics of the script don't change. For these kind of "I need a slightly different script" cases, I ususally just make a copy, then add its filename to `.git/info/exclude` so I don't accidentally commit it.
}'

View File

@ -92,7 +92,9 @@ func (f *Flamenco) SubmitJob(e echo.Context) error {
logger = logger.With().Str("job_id", authoredJob.JobID).Logger()
// TODO: check whether this job should be queued immediately or start paused.

This TODO can now be removed.

This TODO can now be removed.
authoredJob.Status = api.JobStatusQueued
if authoredJob.Status == api.JobStatusUnderConstruction {
authoredJob.Status = api.JobStatusQueued
}
if err := f.persist.StoreAuthoredJob(ctx, *authoredJob); err != nil {
logger.Error().Err(err).Msg("error persisting job in database")

View File

@ -131,6 +131,10 @@ func (s *Service) Compile(ctx context.Context, sj api.SubmittedJob) (*AuthoredJo
aj.WorkerTagUUID = *sj.WorkerTag
}
if sj.InitialStatus != nil {
aj.Status = *sj.InitialStatus

What's the reason to handle this here, rather than in func (f *Flamenco) SubmitJob(e echo.Context) error? I think it's better to keep the status as under-construction while the job is still under construction, and then let it go to its initial status afterwards (like the current under-constructionqueued transition).

What's the reason to handle this here, rather than in `func (f *Flamenco) SubmitJob(e echo.Context) error`? I think it's better to keep the status as `under-construction` while the job is still under construction, and then let it go to its initial status afterwards (like the current `under-construction` → `queued` transition).
}
compiler, err := vm.getCompileJob()
if err != nil {
return nil, err
@ -144,6 +148,7 @@ func (s *Service) Compile(ctx context.Context, sj api.SubmittedJob) (*AuthoredJo
Str("name", aj.Name).
Str("jobtype", aj.JobType).
Str("job", aj.JobID).
Str("status", string(aj.Status)).
Msg("job compiled")
return &aj, nil