-
Notifications
You must be signed in to change notification settings - Fork 11
Enable async and distributed processing for the ML backend #910
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 79 commits
8aad275
61b45a4
4a03c7e
09d7dfb
996674e
ce973fc
bf7178d
41efa42
78babeb
8d28d01
bb22514
1dbc5f0
fe1a9f4
7747f3a
1978cbe
82ac82d
7d733f9
07d61d9
d129029
76ce2d8
035b952
1230386
45dbacf
7361fb2
3f722c8
075a7ec
85c676d
cbd7ae0
7d15ffb
c2881b4
14396ba
6613366
2cf0c0a
1dbf3b1
c82c076
fb874c4
f2ef5ff
b6ce90f
8fe8b1d
d0f4f26
fc8470d
3d3b820
5c7af56
e7e579e
cb74eac
ffea1aa
6cb852b
d0380b9
2594049
57e6691
f785dda
0a22d53
d139734
a83dd20
0707433
0103b7e
3a3b881
7c86612
c016d47
fa510ed
6da55a9
652f47f
f3b588a
5654ed0
875d3cb
be351f8
e550531
2fa57ef
5c21be6
a1e8fa3
57fba22
f8e374a
cd593bc
bde423a
a1238dc
03390e2
460f27c
6f87ca4
bd86042
b552d1e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| # Generated by Django 4.2.10 on 2025-08-10 22:17 | ||
|
|
||
| import ami.ml.schemas | ||
| from django.db import migrations, models | ||
| import django.db.models.deletion | ||
| import django_pydantic_field.fields | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| dependencies = [ | ||
| ("main", "0060_alter_sourceimagecollection_method"), | ||
| ("jobs", "0018_alter_job_job_type_key"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.CreateModel( | ||
| name="MLTaskRecord", | ||
| fields=[ | ||
| ("id", models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name="ID")), | ||
| ("created_at", models.DateTimeField(auto_now_add=True)), | ||
| ("updated_at", models.DateTimeField(auto_now=True)), | ||
| ("task_id", models.CharField(max_length=255)), | ||
| ( | ||
| "task_name", | ||
| models.CharField( | ||
| choices=[ | ||
| ("process_pipeline_request", "process_pipeline_request"), | ||
| ("save_results", "save_results"), | ||
| ], | ||
| default="process_pipeline_request", | ||
| max_length=255, | ||
| ), | ||
| ), | ||
| ( | ||
| "status", | ||
| models.CharField( | ||
| choices=[("STARTED", "STARTED"), ("SUCCESS", "SUCCESS"), ("FAIL", "FAIL")], | ||
| default="STARTED", | ||
| max_length=255, | ||
| ), | ||
| ), | ||
| ("raw_results", models.JSONField(blank=True, default=dict, null=True)), | ||
| ("raw_traceback", models.TextField(blank=True, null=True)), | ||
| ( | ||
| "pipeline_request", | ||
| django_pydantic_field.fields.PydanticSchemaField( | ||
| blank=True, config=None, null=True, schema=ami.ml.schemas.PipelineRequest | ||
| ), | ||
| ), | ||
| ( | ||
| "pipeline_response", | ||
| django_pydantic_field.fields.PydanticSchemaField( | ||
| blank=True, config=None, null=True, schema=ami.ml.schemas.PipelineResultsResponse | ||
| ), | ||
| ), | ||
| ("num_captures", models.IntegerField(default=0, help_text="Same as number of source_images")), | ||
| ("num_detections", models.IntegerField(default=0)), | ||
| ("num_classifications", models.IntegerField(default=0)), | ||
| ("subtask_id", models.CharField(blank=True, max_length=255, null=True)), | ||
| ( | ||
| "job", | ||
| models.ForeignKey( | ||
| on_delete=django.db.models.deletion.CASCADE, related_name="ml_task_records", to="jobs.job" | ||
| ), | ||
| ), | ||
| ("source_images", models.ManyToManyField(related_name="ml_task_records", to="main.sourceimage")), | ||
| ], | ||
| options={ | ||
| "abstract": False, | ||
| }, | ||
| ), | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # Generated by Django 4.2.10 on 2025-09-04 10:42 | ||
|
|
||
| import ami.jobs.models | ||
| from django.db import migrations | ||
| import django_pydantic_field.fields | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| dependencies = [ | ||
| ("jobs", "0019_mltaskrecord"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AlterField( | ||
| model_name="job", | ||
| name="logs", | ||
| field=django_pydantic_field.fields.PydanticSchemaField( | ||
| config=None, default=ami.jobs.models.JobLogs, schema=ami.jobs.models.JobLogs | ||
| ), | ||
| ), | ||
| migrations.AlterField( | ||
| model_name="job", | ||
| name="progress", | ||
| field=django_pydantic_field.fields.PydanticSchemaField( | ||
| config=None, default=ami.jobs.models.default_job_progress, schema=ami.jobs.models.JobProgress | ||
| ), | ||
| ), | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| # Generated by Django 4.2.10 on 2025-10-16 19:31 | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| dependencies = [ | ||
| ("jobs", "0020_alter_job_logs_alter_job_progress"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.RemoveField( | ||
| model_name="mltaskrecord", | ||
| name="subtask_id", | ||
| ), | ||
| migrations.AlterField( | ||
| model_name="mltaskrecord", | ||
| name="status", | ||
| field=models.CharField( | ||
| choices=[("PENDING", "PENDING"), ("STARTED", "STARTED"), ("SUCCESS", "SUCCESS"), ("FAIL", "FAIL")], | ||
| default="STARTED", | ||
| max_length=255, | ||
| ), | ||
| ), | ||
| migrations.AlterField( | ||
| model_name="mltaskrecord", | ||
| name="task_id", | ||
| field=models.CharField(blank=True, max_length=255, null=True), | ||
| ), | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Generated by Django 4.2.10 on 2025-10-17 01:27 | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| dependencies = [ | ||
| ("jobs", "0021_remove_mltaskrecord_subtask_id_and_more"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AddField( | ||
| model_name="job", | ||
| name="last_checked", | ||
| field=models.DateTimeField(blank=True, null=True), | ||
| ), | ||
| ] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # Generated by Django 4.2.10 on 2025-11-04 11:44 | ||
|
|
||
| import datetime | ||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
| dependencies = [ | ||
| ("jobs", "0022_job_last_checked"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AlterField( | ||
| model_name="job", | ||
| name="last_checked", | ||
| field=models.DateTimeField(blank=True, default=datetime.datetime.now, null=True), | ||
| ), | ||
| migrations.AlterField( | ||
| model_name="mltaskrecord", | ||
| name="status", | ||
| field=models.CharField( | ||
| choices=[ | ||
| ("PENDING", "PENDING"), | ||
| ("STARTED", "STARTED"), | ||
| ("SUCCESS", "SUCCESS"), | ||
| ("FAIL", "FAIL"), | ||
| ("REVOKED", "REVOKED"), | ||
| ], | ||
| default="STARTED", | ||
| max_length=255, | ||
| ), | ||
| ), | ||
|
Comment on lines
+13
to
+32
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use a timezone-aware default for
Suggested fix: -import datetime
-from django.db import migrations, models
+import datetime
+from django.db import migrations, models
+from django.utils import timezone
@@
- field=models.DateTimeField(blank=True, default=datetime.datetime.now, null=True),
+ field=models.DateTimeField(blank=True, default=timezone.now, null=True),
🤖 Prompt for AI Agents |
||
| ] | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Critical: DATABASE_URL credentials and database name don't match the individual environment variables.
The
DATABASE_URLcontains different credentials and database name than the individualPOSTGRES_*variables:xekSryPnqczJXkOnTAeDmDyIapSRrGEEbutPOSTGRES_USER(line 4) is4JXkOnTAeDmDyIapSRrGEEPOSTGRES_PASSWORD(line 5)amibutPOSTGRES_DB(line 3) isami-ciThis will cause CI connection failures when code uses
DATABASE_URLinstead of individual variables.Apply this diff to fix the mismatches and use the recommended
postgresql://scheme:📝 Committable suggestion
🤖 Prompt for AI Agents