-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add Collection.active_job foreign key to simplify logic.
admin: Order jobs by descending ID on collection form. Prevent manual creation of jobs.
- Loading branch information
1 parent
dcf29d5
commit a96af3d
Showing
13 changed files
with
276 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# Generated by Django 4.2.15 on 2024-11-04 22:47 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("data_registry", "0049_alter_collection_license_custom_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="collection", | ||
name="active_job", | ||
field=models.ForeignKey( | ||
blank=True, | ||
null=True, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="+", | ||
to="data_registry.job", | ||
verbose_name="active job", | ||
help_text="A job is a set of tasks to collect and process data from a publication. A job can be selected once it is completed. If a new job completes, it becomes the active job.", | ||
), | ||
), | ||
migrations.RunSQL( | ||
""" | ||
UPDATE data_registry_collection c | ||
SET active_job_id = j.id | ||
FROM data_registry_job j | ||
WHERE | ||
j.collection_id = c.id | ||
AND active = TRUE | ||
""" | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Generated by Django 4.2.15 on 2024-11-04 23:13 | ||
|
||
from django.db import migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("data_registry", "0050_collection_active_job"), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name="task", | ||
name="context", | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from data_registry.models import Task | ||
|
||
|
||
class TestTask: | ||
def run(self): | ||
pass | ||
|
||
def get_status(self): | ||
return Task.Status.COMPLETED | ||
|
||
def wipe(self): | ||
pass |
Oops, something went wrong.