-
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.
Add Job model to separate active from results
- Loading branch information
1 parent
f937009
commit a50afb9
Showing
6 changed files
with
269 additions
and
100 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
63 changes: 63 additions & 0 deletions
63
bolt-jobs/bolt/jobs/migrations/0012_job_jobresult_job_uuid_alter_jobresult_status.py
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,63 @@ | ||
# Generated by Bolt 5.0.dev20240114170303 on 2024-01-17 18:45 | ||
|
||
import uuid | ||
|
||
from bolt.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("boltqueue", "0011_jobrequest_retries_jobrequest_retry_attempt_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="Job", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
( | ||
"uuid", | ||
models.UUIDField(default=uuid.uuid4, editable=False, unique=True), | ||
), | ||
("created_at", models.DateTimeField(auto_now_add=True)), | ||
( | ||
"started_at", | ||
models.DateTimeField(blank=True, db_index=True, null=True), | ||
), | ||
("job_request_uuid", models.UUIDField(db_index=True)), | ||
("job_class", models.CharField(db_index=True, max_length=255)), | ||
("parameters", models.JSONField(blank=True, null=True)), | ||
("priority", models.IntegerField(db_index=True, default=0)), | ||
("source", models.TextField(blank=True)), | ||
("retries", models.IntegerField(default=0)), | ||
("retry_attempt", models.IntegerField(default=0)), | ||
], | ||
), | ||
migrations.AddField( | ||
model_name="jobresult", | ||
name="job_uuid", | ||
field=models.UUIDField(db_index=True, default=uuid.uuid4), | ||
preserve_default=False, | ||
), | ||
migrations.AlterField( | ||
model_name="jobresult", | ||
name="status", | ||
field=models.CharField( | ||
choices=[ | ||
("SUCCESSFUL", "Successful"), | ||
("ERRORED", "Errored"), | ||
("LOST", "Lost"), | ||
], | ||
db_index=True, | ||
max_length=20, | ||
), | ||
), | ||
] |
35 changes: 35 additions & 0 deletions
35
bolt-jobs/bolt/jobs/migrations/0013_alter_job_options_alter_jobresult_options_and_more.py
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,35 @@ | ||
# Generated by Bolt 5.0.dev20240114170303 on 2024-01-17 19:24 | ||
|
||
from bolt.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("boltqueue", "0012_job_jobresult_job_uuid_alter_jobresult_status"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelOptions( | ||
name="job", | ||
options={"ordering": ["-created_at"]}, | ||
), | ||
migrations.AlterModelOptions( | ||
name="jobresult", | ||
options={"ordering": ["-created_at"]}, | ||
), | ||
migrations.AlterField( | ||
model_name="job", | ||
name="created_at", | ||
field=models.DateTimeField(auto_now_add=True, db_index=True), | ||
), | ||
migrations.AlterField( | ||
model_name="jobrequest", | ||
name="created_at", | ||
field=models.DateTimeField(auto_now_add=True, db_index=True), | ||
), | ||
migrations.AlterField( | ||
model_name="jobresult", | ||
name="created_at", | ||
field=models.DateTimeField(auto_now_add=True, db_index=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
Oops, something went wrong.