plain.jobs 0.33.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of plain.jobs might be problematic. Click here for more details.
- plain/jobs/CHANGELOG.md +186 -0
- plain/jobs/README.md +253 -0
- plain/jobs/__init__.py +4 -0
- plain/jobs/admin.py +238 -0
- plain/jobs/chores.py +17 -0
- plain/jobs/cli.py +153 -0
- plain/jobs/config.py +19 -0
- plain/jobs/default_settings.py +6 -0
- plain/jobs/jobs.py +226 -0
- plain/jobs/middleware.py +20 -0
- plain/jobs/migrations/0001_initial.py +246 -0
- plain/jobs/migrations/0002_job_span_id_job_trace_id_jobrequest_span_id_and_more.py +61 -0
- plain/jobs/migrations/0003_rename_job_jobprocess_and_more.py +80 -0
- plain/jobs/migrations/0004_rename_tables_to_plainjobs.py +33 -0
- plain/jobs/migrations/0005_rename_constraints_and_indexes.py +174 -0
- plain/jobs/migrations/0006_alter_jobprocess_table_alter_jobrequest_table_and_more.py +24 -0
- plain/jobs/migrations/__init__.py +0 -0
- plain/jobs/models.py +438 -0
- plain/jobs/parameters.py +193 -0
- plain/jobs/registry.py +60 -0
- plain/jobs/scheduling.py +251 -0
- plain/jobs/templates/admin/plainqueue/jobresult_detail.html +8 -0
- plain/jobs/workers.py +322 -0
- plain_jobs-0.33.0.dist-info/METADATA +264 -0
- plain_jobs-0.33.0.dist-info/RECORD +27 -0
- plain_jobs-0.33.0.dist-info/WHEEL +4 -0
- plain_jobs-0.33.0.dist-info/licenses/LICENSE +28 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Generated by Plain 0.52.2 on 2025-07-17 19:33
|
|
2
|
+
|
|
3
|
+
from plain import models
|
|
4
|
+
from plain.models import migrations
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Migration(migrations.Migration):
|
|
8
|
+
dependencies = [
|
|
9
|
+
("plainjobs", "0001_initial"),
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
operations = [
|
|
13
|
+
migrations.AddField(
|
|
14
|
+
model_name="job",
|
|
15
|
+
name="span_id",
|
|
16
|
+
field=models.CharField(allow_null=True, max_length=18, required=False),
|
|
17
|
+
),
|
|
18
|
+
migrations.AddField(
|
|
19
|
+
model_name="job",
|
|
20
|
+
name="trace_id",
|
|
21
|
+
field=models.CharField(allow_null=True, max_length=34, required=False),
|
|
22
|
+
),
|
|
23
|
+
migrations.AddField(
|
|
24
|
+
model_name="jobrequest",
|
|
25
|
+
name="span_id",
|
|
26
|
+
field=models.CharField(allow_null=True, max_length=18, required=False),
|
|
27
|
+
),
|
|
28
|
+
migrations.AddField(
|
|
29
|
+
model_name="jobrequest",
|
|
30
|
+
name="trace_id",
|
|
31
|
+
field=models.CharField(allow_null=True, max_length=34, required=False),
|
|
32
|
+
),
|
|
33
|
+
migrations.AddField(
|
|
34
|
+
model_name="jobresult",
|
|
35
|
+
name="span_id",
|
|
36
|
+
field=models.CharField(allow_null=True, max_length=18, required=False),
|
|
37
|
+
),
|
|
38
|
+
migrations.AddField(
|
|
39
|
+
model_name="jobresult",
|
|
40
|
+
name="trace_id",
|
|
41
|
+
field=models.CharField(allow_null=True, max_length=34, required=False),
|
|
42
|
+
),
|
|
43
|
+
migrations.AddIndex(
|
|
44
|
+
model_name="job",
|
|
45
|
+
index=models.Index(
|
|
46
|
+
fields=["trace_id"], name="plainworker_trace_i_d2b645_idx"
|
|
47
|
+
),
|
|
48
|
+
),
|
|
49
|
+
migrations.AddIndex(
|
|
50
|
+
model_name="jobrequest",
|
|
51
|
+
index=models.Index(
|
|
52
|
+
fields=["trace_id"], name="plainworker_trace_i_e9dfc5_idx"
|
|
53
|
+
),
|
|
54
|
+
),
|
|
55
|
+
migrations.AddIndex(
|
|
56
|
+
model_name="jobresult",
|
|
57
|
+
index=models.Index(
|
|
58
|
+
fields=["trace_id"], name="plainworker_trace_i_00c75f_idx"
|
|
59
|
+
),
|
|
60
|
+
),
|
|
61
|
+
]
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Generated by Plain 0.63.0 on 2025-09-15 21:29
|
|
2
|
+
|
|
3
|
+
from plain import models
|
|
4
|
+
from plain.models import migrations
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Migration(migrations.Migration):
|
|
8
|
+
dependencies = [
|
|
9
|
+
("plainjobs", "0002_job_span_id_job_trace_id_jobrequest_span_id_and_more"),
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
operations = [
|
|
13
|
+
migrations.RenameModel(
|
|
14
|
+
old_name="Job",
|
|
15
|
+
new_name="JobProcess",
|
|
16
|
+
),
|
|
17
|
+
migrations.RemoveIndex(
|
|
18
|
+
model_name="jobresult",
|
|
19
|
+
name="plainworker_job_uui_8307d1_idx",
|
|
20
|
+
),
|
|
21
|
+
migrations.RenameField(
|
|
22
|
+
model_name="jobresult",
|
|
23
|
+
old_name="job_uuid",
|
|
24
|
+
new_name="job_process_uuid",
|
|
25
|
+
),
|
|
26
|
+
migrations.RenameIndex(
|
|
27
|
+
model_name="jobprocess",
|
|
28
|
+
new_name="plainworker_created_0d3928_idx",
|
|
29
|
+
old_name="plainworker_created_a02317_idx",
|
|
30
|
+
),
|
|
31
|
+
migrations.RenameIndex(
|
|
32
|
+
model_name="jobprocess",
|
|
33
|
+
new_name="plainworker_queue_2550ba_idx",
|
|
34
|
+
old_name="plainworker_queue_077806_idx",
|
|
35
|
+
),
|
|
36
|
+
migrations.RenameIndex(
|
|
37
|
+
model_name="jobprocess",
|
|
38
|
+
new_name="plainworker_unique__9dc0bb_idx",
|
|
39
|
+
old_name="plainworker_unique__04d87b_idx",
|
|
40
|
+
),
|
|
41
|
+
migrations.RenameIndex(
|
|
42
|
+
model_name="jobprocess",
|
|
43
|
+
new_name="plainworker_started_b80ec5_idx",
|
|
44
|
+
old_name="plainworker_started_143df5_idx",
|
|
45
|
+
),
|
|
46
|
+
migrations.RenameIndex(
|
|
47
|
+
model_name="jobprocess",
|
|
48
|
+
new_name="plainworker_job_cla_fe2b70_idx",
|
|
49
|
+
old_name="plainworker_job_cla_884b46_idx",
|
|
50
|
+
),
|
|
51
|
+
migrations.RenameIndex(
|
|
52
|
+
model_name="jobprocess",
|
|
53
|
+
new_name="plainworker_job_req_357898_idx",
|
|
54
|
+
old_name="plainworker_job_req_db2681_idx",
|
|
55
|
+
),
|
|
56
|
+
migrations.RenameIndex(
|
|
57
|
+
model_name="jobprocess",
|
|
58
|
+
new_name="plainworker_trace_i_da2cfa_idx",
|
|
59
|
+
old_name="plainworker_trace_i_d2b645_idx",
|
|
60
|
+
),
|
|
61
|
+
migrations.AddIndex(
|
|
62
|
+
model_name="jobresult",
|
|
63
|
+
index=models.Index(
|
|
64
|
+
fields=["job_process_uuid"], name="plainworker_job_pro_ceabfb_idx"
|
|
65
|
+
),
|
|
66
|
+
),
|
|
67
|
+
# To fix subsequent migrations...
|
|
68
|
+
migrations.AlterModelTable(
|
|
69
|
+
name="JobRequest",
|
|
70
|
+
table="plainworker_jobrequest",
|
|
71
|
+
),
|
|
72
|
+
migrations.AlterModelTable(
|
|
73
|
+
name="JobProcess",
|
|
74
|
+
table="plainworker_jobprocess",
|
|
75
|
+
),
|
|
76
|
+
migrations.AlterModelTable(
|
|
77
|
+
name="JobResult",
|
|
78
|
+
table="plainworker_jobresult",
|
|
79
|
+
),
|
|
80
|
+
]
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Manual transition from plain-worker (plainworker) to plain-jobs (plainjobs)
|
|
2
|
+
#
|
|
3
|
+
# If upgrading from plain.worker, run this SQL command BEFORE running migrations:
|
|
4
|
+
#
|
|
5
|
+
# plain models db-shell -- -c "INSERT INTO plainmigrations (app, name, applied) SELECT 'plainjobs', name, applied FROM plainmigrations WHERE app = 'plainworker' ON CONFLICT DO NOTHING;"
|
|
6
|
+
#
|
|
7
|
+
# Then run: plain migrate
|
|
8
|
+
# Then run: plain migrate --prune (to clean up old plainworker records)
|
|
9
|
+
#
|
|
10
|
+
# Step 1: Rename tables from plainworker_* to plainjobs_*
|
|
11
|
+
|
|
12
|
+
from plain.models import migrations
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class Migration(migrations.Migration):
|
|
16
|
+
dependencies = [
|
|
17
|
+
("plainjobs", "0003_rename_job_jobprocess_and_more"),
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
operations = [
|
|
21
|
+
migrations.AlterModelTable(
|
|
22
|
+
name="JobRequest",
|
|
23
|
+
table="plainjobs_jobrequest",
|
|
24
|
+
),
|
|
25
|
+
migrations.AlterModelTable(
|
|
26
|
+
name="JobProcess",
|
|
27
|
+
table="plainjobs_jobprocess",
|
|
28
|
+
),
|
|
29
|
+
migrations.AlterModelTable(
|
|
30
|
+
name="JobResult",
|
|
31
|
+
table="plainjobs_jobresult",
|
|
32
|
+
),
|
|
33
|
+
]
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# Step 2: Rename constraints and indexes from plainworker_* to plainjobs_*
|
|
2
|
+
# (Tables were renamed to plainjobs_* in migration 0004)
|
|
3
|
+
|
|
4
|
+
from plain import models
|
|
5
|
+
from plain.models import migrations
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Migration(migrations.Migration):
|
|
9
|
+
dependencies = [
|
|
10
|
+
("plainjobs", "0004_rename_tables_to_plainjobs"),
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
operations = [
|
|
14
|
+
# Remove old constraints (on plainjobs_* tables now)
|
|
15
|
+
migrations.RemoveConstraint(
|
|
16
|
+
model_name="jobprocess",
|
|
17
|
+
name="plainworker_job_unique_uuid",
|
|
18
|
+
),
|
|
19
|
+
migrations.RemoveConstraint(
|
|
20
|
+
model_name="jobrequest",
|
|
21
|
+
name="plainworker_jobrequest_unique_job_class_key",
|
|
22
|
+
),
|
|
23
|
+
migrations.RemoveConstraint(
|
|
24
|
+
model_name="jobrequest",
|
|
25
|
+
name="plainworker_jobrequest_unique_uuid",
|
|
26
|
+
),
|
|
27
|
+
migrations.RemoveConstraint(
|
|
28
|
+
model_name="jobresult",
|
|
29
|
+
name="plainworker_jobresult_unique_uuid",
|
|
30
|
+
),
|
|
31
|
+
# Rename indexes
|
|
32
|
+
migrations.RenameIndex(
|
|
33
|
+
model_name="jobprocess",
|
|
34
|
+
new_name="plainjobs_j_created_04fbb8_idx",
|
|
35
|
+
old_name="plainworker_created_0d3928_idx",
|
|
36
|
+
),
|
|
37
|
+
migrations.RenameIndex(
|
|
38
|
+
model_name="jobprocess",
|
|
39
|
+
new_name="plainjobs_j_queue_d07d21_idx",
|
|
40
|
+
old_name="plainworker_queue_2550ba_idx",
|
|
41
|
+
),
|
|
42
|
+
migrations.RenameIndex(
|
|
43
|
+
model_name="jobprocess",
|
|
44
|
+
new_name="plainjobs_j_unique__67172c_idx",
|
|
45
|
+
old_name="plainworker_unique__9dc0bb_idx",
|
|
46
|
+
),
|
|
47
|
+
migrations.RenameIndex(
|
|
48
|
+
model_name="jobprocess",
|
|
49
|
+
new_name="plainjobs_j_started_5cd62a_idx",
|
|
50
|
+
old_name="plainworker_started_b80ec5_idx",
|
|
51
|
+
),
|
|
52
|
+
migrations.RenameIndex(
|
|
53
|
+
model_name="jobprocess",
|
|
54
|
+
new_name="plainjobs_j_job_cla_19f3c1_idx",
|
|
55
|
+
old_name="plainworker_job_cla_fe2b70_idx",
|
|
56
|
+
),
|
|
57
|
+
migrations.RenameIndex(
|
|
58
|
+
model_name="jobprocess",
|
|
59
|
+
new_name="plainjobs_j_job_req_32b6eb_idx",
|
|
60
|
+
old_name="plainworker_job_req_357898_idx",
|
|
61
|
+
),
|
|
62
|
+
migrations.RenameIndex(
|
|
63
|
+
model_name="jobprocess",
|
|
64
|
+
new_name="plainjobs_j_trace_i_9f93c8_idx",
|
|
65
|
+
old_name="plainworker_trace_i_da2cfa_idx",
|
|
66
|
+
),
|
|
67
|
+
migrations.RenameIndex(
|
|
68
|
+
model_name="jobrequest",
|
|
69
|
+
new_name="plainjobs_j_priorit_fd4fac_idx",
|
|
70
|
+
old_name="plainworker_priorit_785e73_idx",
|
|
71
|
+
),
|
|
72
|
+
migrations.RenameIndex(
|
|
73
|
+
model_name="jobrequest",
|
|
74
|
+
new_name="plainjobs_j_created_1eeb20_idx",
|
|
75
|
+
old_name="plainworker_created_c81fe5_idx",
|
|
76
|
+
),
|
|
77
|
+
migrations.RenameIndex(
|
|
78
|
+
model_name="jobrequest",
|
|
79
|
+
new_name="plainjobs_j_queue_b34b5a_idx",
|
|
80
|
+
old_name="plainworker_queue_2614aa_idx",
|
|
81
|
+
),
|
|
82
|
+
migrations.RenameIndex(
|
|
83
|
+
model_name="jobrequest",
|
|
84
|
+
new_name="plainjobs_j_start_a_f3b8da_idx",
|
|
85
|
+
old_name="plainworker_start_a_4d6020_idx",
|
|
86
|
+
),
|
|
87
|
+
migrations.RenameIndex(
|
|
88
|
+
model_name="jobrequest",
|
|
89
|
+
new_name="plainjobs_j_unique__42f6a6_idx",
|
|
90
|
+
old_name="plainworker_unique__21a534_idx",
|
|
91
|
+
),
|
|
92
|
+
migrations.RenameIndex(
|
|
93
|
+
model_name="jobrequest",
|
|
94
|
+
new_name="plainjobs_j_job_cla_a18abf_idx",
|
|
95
|
+
old_name="plainworker_job_cla_3e7dea_idx",
|
|
96
|
+
),
|
|
97
|
+
migrations.RenameIndex(
|
|
98
|
+
model_name="jobrequest",
|
|
99
|
+
new_name="plainjobs_j_trace_i_194003_idx",
|
|
100
|
+
old_name="plainworker_trace_i_e9dfc5_idx",
|
|
101
|
+
),
|
|
102
|
+
migrations.RenameIndex(
|
|
103
|
+
model_name="jobresult",
|
|
104
|
+
new_name="plainjobs_j_created_7978bf_idx",
|
|
105
|
+
old_name="plainworker_created_6894c5_idx",
|
|
106
|
+
),
|
|
107
|
+
migrations.RenameIndex(
|
|
108
|
+
model_name="jobresult",
|
|
109
|
+
new_name="plainjobs_j_job_pro_751a64_idx",
|
|
110
|
+
old_name="plainworker_job_pro_ceabfb_idx",
|
|
111
|
+
),
|
|
112
|
+
migrations.RenameIndex(
|
|
113
|
+
model_name="jobresult",
|
|
114
|
+
new_name="plainjobs_j_started_6fb2ce_idx",
|
|
115
|
+
old_name="plainworker_started_9bce76_idx",
|
|
116
|
+
),
|
|
117
|
+
migrations.RenameIndex(
|
|
118
|
+
model_name="jobresult",
|
|
119
|
+
new_name="plainjobs_j_ended_a_648f25_idx",
|
|
120
|
+
old_name="plainworker_ended_a_63caaf_idx",
|
|
121
|
+
),
|
|
122
|
+
migrations.RenameIndex(
|
|
123
|
+
model_name="jobresult",
|
|
124
|
+
new_name="plainjobs_j_status_1ef683_idx",
|
|
125
|
+
old_name="plainworker_status_a7ca35_idx",
|
|
126
|
+
),
|
|
127
|
+
migrations.RenameIndex(
|
|
128
|
+
model_name="jobresult",
|
|
129
|
+
new_name="plainjobs_j_job_req_3ddecf_idx",
|
|
130
|
+
old_name="plainworker_job_req_1e1bf2_idx",
|
|
131
|
+
),
|
|
132
|
+
migrations.RenameIndex(
|
|
133
|
+
model_name="jobresult",
|
|
134
|
+
new_name="plainjobs_j_job_cla_8791b4_idx",
|
|
135
|
+
old_name="plainworker_job_cla_d138b5_idx",
|
|
136
|
+
),
|
|
137
|
+
migrations.RenameIndex(
|
|
138
|
+
model_name="jobresult",
|
|
139
|
+
new_name="plainjobs_j_queue_0a2178_idx",
|
|
140
|
+
old_name="plainworker_queue_23d8fe_idx",
|
|
141
|
+
),
|
|
142
|
+
migrations.RenameIndex(
|
|
143
|
+
model_name="jobresult",
|
|
144
|
+
new_name="plainjobs_j_trace_i_02f370_idx",
|
|
145
|
+
old_name="plainworker_trace_i_00c75f_idx",
|
|
146
|
+
),
|
|
147
|
+
# Add new constraints (on plainworker_* tables, but with new names)
|
|
148
|
+
migrations.AddConstraint(
|
|
149
|
+
model_name="jobprocess",
|
|
150
|
+
constraint=models.UniqueConstraint(
|
|
151
|
+
fields=("uuid",), name="plainjobs_job_unique_uuid"
|
|
152
|
+
),
|
|
153
|
+
),
|
|
154
|
+
migrations.AddConstraint(
|
|
155
|
+
model_name="jobrequest",
|
|
156
|
+
constraint=models.UniqueConstraint(
|
|
157
|
+
condition=models.Q(("retry_attempt", 0), ("unique_key__gt", "")),
|
|
158
|
+
fields=("job_class", "unique_key"),
|
|
159
|
+
name="plainjobs_jobrequest_unique_job_class_key",
|
|
160
|
+
),
|
|
161
|
+
),
|
|
162
|
+
migrations.AddConstraint(
|
|
163
|
+
model_name="jobrequest",
|
|
164
|
+
constraint=models.UniqueConstraint(
|
|
165
|
+
fields=("uuid",), name="plainjobs_jobrequest_unique_uuid"
|
|
166
|
+
),
|
|
167
|
+
),
|
|
168
|
+
migrations.AddConstraint(
|
|
169
|
+
model_name="jobresult",
|
|
170
|
+
constraint=models.UniqueConstraint(
|
|
171
|
+
fields=("uuid",), name="plainjobs_jobresult_unique_uuid"
|
|
172
|
+
),
|
|
173
|
+
),
|
|
174
|
+
]
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Generated by Plain 0.74.0 on 2025-10-10 20:57
|
|
2
|
+
|
|
3
|
+
from plain.models import migrations
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
dependencies = [
|
|
8
|
+
("plainjobs", "0005_rename_constraints_and_indexes"),
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
operations = [
|
|
12
|
+
migrations.AlterModelTable(
|
|
13
|
+
name="jobprocess",
|
|
14
|
+
table=None,
|
|
15
|
+
),
|
|
16
|
+
migrations.AlterModelTable(
|
|
17
|
+
name="jobrequest",
|
|
18
|
+
table=None,
|
|
19
|
+
),
|
|
20
|
+
migrations.AlterModelTable(
|
|
21
|
+
name="jobresult",
|
|
22
|
+
table=None,
|
|
23
|
+
),
|
|
24
|
+
]
|
|
File without changes
|