Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ami/jobs/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,15 @@ def run(cls, job: "Job"):
job.finished_at = datetime.datetime.now()
job.save()
return
# When all stages are already complete (e.g. 0 images to process),
# finalize the job now since no async results will arrive to trigger completion.
# Derive status from stages rather than assuming SUCCESS — a stage could be
# in FAILURE if some images were skipped during collection.
if job.progress.is_complete():
has_failure = any(s.status == JobState.FAILURE for s in job.progress.stages)
Comment thread
mihow marked this conversation as resolved.
Outdated
Comment thread
mihow marked this conversation as resolved.
Outdated
Comment thread
mihow marked this conversation as resolved.
Outdated
Comment thread
mihow marked this conversation as resolved.
Outdated
job.update_status(JobState.FAILURE if has_failure else JobState.SUCCESS)
job.finished_at = datetime.datetime.now()
job.save()
else:
cls.process_images(job, images)

Expand Down
Loading