From 96ea2f6e866ef67d0aaf0668f12ba5e7fdba3fdc Mon Sep 17 00:00:00 2001 From: Michael Bunsen Date: Thu, 30 Apr 2026 17:23:20 -0700 Subject: [PATCH 1/2] chore(jobs): add deferred migration for job_type_key choices drift MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cosmetic choices-label change from 585cd55a (collection→capture set rename) that was excluded from #1259 to keep that diff focused. No DB schema change; keeps makemigrations --check green. Co-Authored-By: Claude --- .../migrations/0023_alter_job_job_type_key.py | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 ami/jobs/migrations/0023_alter_job_job_type_key.py diff --git a/ami/jobs/migrations/0023_alter_job_job_type_key.py b/ami/jobs/migrations/0023_alter_job_job_type_key.py new file mode 100644 index 000000000..0c68deccc --- /dev/null +++ b/ami/jobs/migrations/0023_alter_job_job_type_key.py @@ -0,0 +1,29 @@ +# Generated by Django 4.2.10 on 2026-04-30 18:45 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("jobs", "0022_alter_job_logs_help_text"), + ] + + operations = [ + migrations.AlterField( + model_name="job", + name="job_type_key", + field=models.CharField( + choices=[ + ("ml", "ML pipeline"), + ("populate_captures_collection", "Populate capture set"), + ("data_storage_sync", "Data storage sync"), + ("unknown", "Unknown"), + ("data_export", "Data Export"), + ("post_processing", "Post Processing"), + ], + default="unknown", + max_length=255, + verbose_name="Job Type", + ), + ), + ] From f1eb099007a765a2012c9fcb41efa47191de9a7a Mon Sep 17 00:00:00 2001 From: Michael Bunsen Date: Thu, 30 Apr 2026 17:23:25 -0700 Subject: [PATCH 2/2] fix(jobs): persist collect stage start so UI shows progress 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 --- ami/jobs/models.py | 1 + 1 file changed, 1 insertion(+) diff --git a/ami/jobs/models.py b/ami/jobs/models.py index 3669b65c4..30c969f06 100644 --- a/ami/jobs/models.py +++ b/ami/jobs/models.py @@ -497,6 +497,7 @@ def run(cls, job: "Job"): status=JobState.STARTED, progress=0, ) + job.save() images: list[SourceImage] = list( # @TODO return generator plus image count