plain.jobs 0.36.3__py3-none-any.whl → 0.37.1__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 +21 -0
- plain/jobs/__init__.py +2 -1
- plain/jobs/admin.py +6 -6
- plain/jobs/middleware.py +25 -3
- plain/jobs/workers.py +2 -2
- {plain_jobs-0.36.3.dist-info → plain_jobs-0.37.1.dist-info}/METADATA +1 -1
- {plain_jobs-0.36.3.dist-info → plain_jobs-0.37.1.dist-info}/RECORD +9 -9
- {plain_jobs-0.36.3.dist-info → plain_jobs-0.37.1.dist-info}/WHEEL +0 -0
- {plain_jobs-0.36.3.dist-info → plain_jobs-0.37.1.dist-info}/licenses/LICENSE +0 -0
plain/jobs/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# plain-jobs changelog
|
|
2
2
|
|
|
3
|
+
## [0.37.1](https://github.com/dropseed/plain/releases/plain-jobs@0.37.1) (2025-10-24)
|
|
4
|
+
|
|
5
|
+
### What's changed
|
|
6
|
+
|
|
7
|
+
- Fixed admin interface filter functionality to correctly use `preset` instead of `display` for filtering job results ([26fde7d562](https://github.com/dropseed/plain/commit/26fde7d562))
|
|
8
|
+
|
|
9
|
+
### Upgrade instructions
|
|
10
|
+
|
|
11
|
+
- No changes required
|
|
12
|
+
|
|
13
|
+
## [0.37.0](https://github.com/dropseed/plain/releases/plain-jobs@0.37.0) (2025-10-22)
|
|
14
|
+
|
|
15
|
+
### What's changed
|
|
16
|
+
|
|
17
|
+
- Added `JobMiddleware` abstract base class for creating custom job middleware ([29e5c6df1a](https://github.com/dropseed/plain/commit/29e5c6df1a))
|
|
18
|
+
- Changed "preparing to execute job" log message from `logger.info` to `logger.debug` to reduce log noise ([8e25856639](https://github.com/dropseed/plain/commit/8e25856639))
|
|
19
|
+
|
|
20
|
+
### Upgrade instructions
|
|
21
|
+
|
|
22
|
+
- If you have custom job middleware, update them to inherit from `JobMiddleware` and implement the `process_job()` method instead of `__call__()`
|
|
23
|
+
|
|
3
24
|
## [0.36.3](https://github.com/dropseed/plain/releases/plain-jobs@0.36.3) (2025-10-20)
|
|
4
25
|
|
|
5
26
|
### What's changed
|
plain/jobs/__init__.py
CHANGED
plain/jobs/admin.py
CHANGED
|
@@ -204,21 +204,21 @@ class JobResultViewset(AdminViewset):
|
|
|
204
204
|
output_field=models.BooleanField(),
|
|
205
205
|
),
|
|
206
206
|
)
|
|
207
|
-
if self.
|
|
207
|
+
if self.preset == "Successful":
|
|
208
208
|
return queryset.successful()
|
|
209
|
-
if self.
|
|
209
|
+
if self.preset == "Errored":
|
|
210
210
|
return queryset.errored()
|
|
211
|
-
if self.
|
|
211
|
+
if self.preset == "Cancelled":
|
|
212
212
|
return queryset.cancelled()
|
|
213
|
-
if self.
|
|
213
|
+
if self.preset == "Lost":
|
|
214
214
|
return queryset.lost()
|
|
215
|
-
if self.
|
|
215
|
+
if self.preset == "Retried":
|
|
216
216
|
return queryset.retried()
|
|
217
217
|
return queryset
|
|
218
218
|
|
|
219
219
|
def get_fields(self) -> list[str]:
|
|
220
220
|
fields = super().get_fields()
|
|
221
|
-
if self.
|
|
221
|
+
if self.preset == "Retried":
|
|
222
222
|
fields.append("retries")
|
|
223
223
|
fields.append("retry_attempt")
|
|
224
224
|
return fields
|
plain/jobs/middleware.py
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
+
from abc import ABC, abstractmethod
|
|
3
4
|
from collections.abc import Callable
|
|
4
5
|
from typing import TYPE_CHECKING
|
|
5
6
|
|
|
@@ -9,11 +10,32 @@ if TYPE_CHECKING:
|
|
|
9
10
|
from .models import JobProcess, JobResult
|
|
10
11
|
|
|
11
12
|
|
|
12
|
-
class
|
|
13
|
-
|
|
13
|
+
class JobMiddleware(ABC):
|
|
14
|
+
"""
|
|
15
|
+
Abstract base class for job middleware.
|
|
16
|
+
|
|
17
|
+
Subclasses must implement process_job() to handle the job execution cycle.
|
|
18
|
+
|
|
19
|
+
Example:
|
|
20
|
+
class MyJobMiddleware(JobMiddleware):
|
|
21
|
+
def process_job(self, job: JobProcess) -> JobResult:
|
|
22
|
+
# Pre-processing
|
|
23
|
+
result = self.run_job(job)
|
|
24
|
+
# Post-processing
|
|
25
|
+
return result
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
def __init__(self, run_job: Callable[[JobProcess], JobResult]):
|
|
14
29
|
self.run_job = run_job
|
|
15
30
|
|
|
16
|
-
|
|
31
|
+
@abstractmethod
|
|
32
|
+
def process_job(self, job: JobProcess) -> JobResult:
|
|
33
|
+
"""Process the job and return a result. Must be implemented by subclasses."""
|
|
34
|
+
...
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class AppLoggerMiddleware(JobMiddleware):
|
|
38
|
+
def process_job(self, job: JobProcess) -> JobResult:
|
|
17
39
|
with app_logger.include_context(
|
|
18
40
|
job_request_uuid=str(job.job_request_uuid), job_process_uuid=str(job.uuid)
|
|
19
41
|
):
|
plain/jobs/workers.py
CHANGED
|
@@ -144,7 +144,7 @@ class Worker:
|
|
|
144
144
|
time.sleep(1)
|
|
145
145
|
continue
|
|
146
146
|
|
|
147
|
-
logger.
|
|
147
|
+
logger.debug(
|
|
148
148
|
'Preparing to execute job job_class=%s job_request_uuid=%s job_priority=%s job_source="%s" job_queues="%s"',
|
|
149
149
|
job_request.job_class,
|
|
150
150
|
job_request.uuid,
|
|
@@ -327,7 +327,7 @@ def process_job(job_process_uuid: str) -> None:
|
|
|
327
327
|
for middleware_path in reversed(settings.JOBS_MIDDLEWARE):
|
|
328
328
|
middleware_class = import_string(middleware_path)
|
|
329
329
|
middleware_instance = middleware_class(middleware_chain)
|
|
330
|
-
middleware_chain = middleware_instance
|
|
330
|
+
middleware_chain = middleware_instance.process_job
|
|
331
331
|
|
|
332
332
|
job_result = middleware_chain(job_process)
|
|
333
333
|
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
plain/jobs/CHANGELOG.md,sha256=
|
|
1
|
+
plain/jobs/CHANGELOG.md,sha256=H3RG65KNXrQ_KIZCkmWq08XGID-MXhocTSaHfEE2hJU,13878
|
|
2
2
|
plain/jobs/README.md,sha256=Xuhz2Q48G9WeGCh5OWGVBlaSea4eKCqWzcTAtZRrS0I,6835
|
|
3
|
-
plain/jobs/__init__.py,sha256=
|
|
4
|
-
plain/jobs/admin.py,sha256=
|
|
3
|
+
plain/jobs/__init__.py,sha256=yN6m5CxQuzB5tKVXVPwGSSh2jtwQybVDHj1V4M3z2F0,147
|
|
4
|
+
plain/jobs/admin.py,sha256=SVaNX3DAebpYLVhc2KEN7oLJEbc69CHaPI_4-Pw4L7Q,6779
|
|
5
5
|
plain/jobs/chores.py,sha256=oyVU-BfcJxMM3eK2_umn38N2mBsNpcDrZfpeEQju_DA,528
|
|
6
6
|
plain/jobs/cli.py,sha256=PPoT7xjl818BZnmI0yA_UCLEQkzl_Tv1_hiuJW9UE-Q,5911
|
|
7
7
|
plain/jobs/config.py,sha256=PQsl-LxWsWLnjC98f0mvtdcCOuXvXKDMjrCRf1fq44Y,550
|
|
8
8
|
plain/jobs/default_settings.py,sha256=r_95ucg_KY1XW1jarZy8VO3p-ylbllKMUrHzOPJiX6U,227
|
|
9
9
|
plain/jobs/jobs.py,sha256=-tBt_5V2KwGui7OpBcq1gANVn3YvKEoBJn0MXNlnKlo,7761
|
|
10
|
-
plain/jobs/middleware.py,sha256=
|
|
10
|
+
plain/jobs/middleware.py,sha256=iQbVPnQz91OpkfNFsDh6-G0RLWW7KxYssUKdk7JEdNE,1228
|
|
11
11
|
plain/jobs/models.py,sha256=TYOjMT0dSF69uzfY2m13ZPwo6G0WOVJUbgJvsDFxBhI,15889
|
|
12
12
|
plain/jobs/parameters.py,sha256=t9PwEZgwNCJx3YobsT-jfaVZdfMBS54XJcBrT9Wnsg0,6313
|
|
13
13
|
plain/jobs/registry.py,sha256=Rwn5Htll10e549vD2Mu0oyoDynyHhE0bGYZ2bq9uzPU,1679
|
|
14
14
|
plain/jobs/scheduling.py,sha256=fqpFnVoIIV-muf82WzuLyioSmiilfZ76KFjXzt8grIk,7851
|
|
15
|
-
plain/jobs/workers.py,sha256=
|
|
15
|
+
plain/jobs/workers.py,sha256=eqaFqHRtpzh2QBdQ0dfUSMXMzpoxZOUlxw-7N661cUs,13558
|
|
16
16
|
plain/jobs/migrations/0001_initial.py,sha256=EIgIEMVyTsStyx9dmKM8Jb_hwn694Yo31-74DZkNTqo,9452
|
|
17
17
|
plain/jobs/migrations/0002_job_span_id_job_trace_id_jobrequest_span_id_and_more.py,sha256=ph5BwwOAwdfjdNh9RItYmX_IA29lO-Dd9GymYzvChXQ,1953
|
|
18
18
|
plain/jobs/migrations/0003_rename_job_jobprocess_and_more.py,sha256=EdLucHxiH_QshLL2peIcMULRCQyFMPxh476AxCxW5Wk,2615
|
|
@@ -21,7 +21,7 @@ plain/jobs/migrations/0005_rename_constraints_and_indexes.py,sha256=PDGpOw6__tVf
|
|
|
21
21
|
plain/jobs/migrations/0006_alter_jobprocess_table_alter_jobrequest_table_and_more.py,sha256=FY0_pcw0mL8MkUSatpDXWtA_xQw0kTZBGIyjLcmYeJE,546
|
|
22
22
|
plain/jobs/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
23
23
|
plain/jobs/templates/admin/plainqueue/jobresult_detail.html,sha256=Ybp1s_dARo_bFDcLEzEfETheP8SzqHHE_NNSKhv_eh8,198
|
|
24
|
-
plain_jobs-0.
|
|
25
|
-
plain_jobs-0.
|
|
26
|
-
plain_jobs-0.
|
|
27
|
-
plain_jobs-0.
|
|
24
|
+
plain_jobs-0.37.1.dist-info/METADATA,sha256=R35qymvSrJTj1UsdmlncDIMimqi238zD0nHwuta8118,7162
|
|
25
|
+
plain_jobs-0.37.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
26
|
+
plain_jobs-0.37.1.dist-info/licenses/LICENSE,sha256=cvKM3OlqHx3ijD6e34zsSUkPvzl-ya3Dd63A6EHL94U,1500
|
|
27
|
+
plain_jobs-0.37.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|