Conversation
update_stage() mutates job.progress in memory but never hits the DB until the post-collect job.save() at line 533. collect_images() can take minutes for large collections, so the UI sees no stage activity and looks frozen. Save right after marking the stage STARTED so polling clients see it. Co-Authored-By: Claude <noreply@anthropic.com>
✅ Deploy Preview for antenna-preview canceled.
|
✅ Deploy Preview for antenna-ssec canceled.
|
📝 WalkthroughWalkthroughThis PR adds a Django migration to define allowed choices and constraints for the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
This PR improves job progress visibility during long-running ML “collect” operations and adds a deferred migration to keep job_type_key choices in sync after the “collection” → “capture set” rename.
Changes:
- Persist
collectstageSTARTEDprogress immediately so polling clients see active progress duringcollect_images(). - Add migration
0023_alter_job_job_type_keyto update thejob_type_keychoice label (“Populate captures collection” → “Populate capture set”) and keepmakemigrations --checkclean.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| ami/jobs/models.py | Saves the job immediately after marking the collect stage as STARTED, preventing UI polling from appearing frozen during long collection runs. |
| ami/jobs/migrations/0023_alter_job_job_type_key.py | Alters job_type_key field choices to reflect updated human-readable label for the populate job type. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
When jobs start, they often transition to STARTED, but show now progress and the stages stay gray / unstarted. This is usually because the "collect" stage is running, but the status was not updated when the collect stage started.
Two small, independent fixes bundled in one PR:
fix(jobs)—_run_pipeline_jobupdates thecollectstage toSTARTEDin memory but doesn'tsave()until aftercollect_images()returns. For large collections that call can run for minutes, so polling clients (UI) see a frozen job. Addjob.save()right after marking the stage STARTED.chore(jobs)— commit the deferred0023_alter_job_job_type_keymigration. This is the cosmetic choices-label drift from585cd55a(collection → capture set rename) that was explicitly excluded from Refactor job logging to use separate table #1259 to keep that diff focused. No schema change; just keepsmakemigrations --checkgreen.Before:

After:

Test plan
python manage.py makemigrations --checkpassescollectstage as in-progress whilecollect_images()is still running (instead of appearing frozen until collection finishes)🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Chores