plain.jobs 0.35.1__tar.gz → 0.36.1__tar.gz
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-0.35.1 → plain_jobs-0.36.1}/PKG-INFO +1 -1
- {plain_jobs-0.35.1 → plain_jobs-0.36.1}/plain/jobs/CHANGELOG.md +21 -0
- {plain_jobs-0.35.1 → plain_jobs-0.36.1}/plain/jobs/jobs.py +2 -2
- {plain_jobs-0.35.1 → plain_jobs-0.36.1}/plain/jobs/workers.py +1 -16
- {plain_jobs-0.35.1 → plain_jobs-0.36.1}/pyproject.toml +3 -3
- {plain_jobs-0.35.1 → plain_jobs-0.36.1}/.gitignore +0 -0
- {plain_jobs-0.35.1 → plain_jobs-0.36.1}/LICENSE +0 -0
- {plain_jobs-0.35.1 → plain_jobs-0.36.1}/README.md +0 -0
- {plain_jobs-0.35.1 → plain_jobs-0.36.1}/plain/jobs/README.md +0 -0
- {plain_jobs-0.35.1 → plain_jobs-0.36.1}/plain/jobs/__init__.py +0 -0
- {plain_jobs-0.35.1 → plain_jobs-0.36.1}/plain/jobs/admin.py +0 -0
- {plain_jobs-0.35.1 → plain_jobs-0.36.1}/plain/jobs/chores.py +0 -0
- {plain_jobs-0.35.1 → plain_jobs-0.36.1}/plain/jobs/cli.py +0 -0
- {plain_jobs-0.35.1 → plain_jobs-0.36.1}/plain/jobs/config.py +0 -0
- {plain_jobs-0.35.1 → plain_jobs-0.36.1}/plain/jobs/default_settings.py +0 -0
- {plain_jobs-0.35.1 → plain_jobs-0.36.1}/plain/jobs/middleware.py +0 -0
- {plain_jobs-0.35.1 → plain_jobs-0.36.1}/plain/jobs/migrations/0001_initial.py +0 -0
- {plain_jobs-0.35.1 → plain_jobs-0.36.1}/plain/jobs/migrations/0002_job_span_id_job_trace_id_jobrequest_span_id_and_more.py +0 -0
- {plain_jobs-0.35.1 → plain_jobs-0.36.1}/plain/jobs/migrations/0003_rename_job_jobprocess_and_more.py +0 -0
- {plain_jobs-0.35.1 → plain_jobs-0.36.1}/plain/jobs/migrations/0004_rename_tables_to_plainjobs.py +0 -0
- {plain_jobs-0.35.1 → plain_jobs-0.36.1}/plain/jobs/migrations/0005_rename_constraints_and_indexes.py +0 -0
- {plain_jobs-0.35.1 → plain_jobs-0.36.1}/plain/jobs/migrations/0006_alter_jobprocess_table_alter_jobrequest_table_and_more.py +0 -0
- {plain_jobs-0.35.1 → plain_jobs-0.36.1}/plain/jobs/migrations/__init__.py +0 -0
- {plain_jobs-0.35.1 → plain_jobs-0.36.1}/plain/jobs/models.py +0 -0
- {plain_jobs-0.35.1 → plain_jobs-0.36.1}/plain/jobs/parameters.py +0 -0
- {plain_jobs-0.35.1 → plain_jobs-0.36.1}/plain/jobs/registry.py +0 -0
- {plain_jobs-0.35.1 → plain_jobs-0.36.1}/plain/jobs/scheduling.py +0 -0
- {plain_jobs-0.35.1 → plain_jobs-0.36.1}/plain/jobs/templates/admin/plainqueue/jobresult_detail.html +0 -0
- {plain_jobs-0.35.1 → plain_jobs-0.36.1}/tests/app/settings.py +0 -0
- {plain_jobs-0.35.1 → plain_jobs-0.36.1}/tests/test_parameters.py +0 -0
- {plain_jobs-0.35.1 → plain_jobs-0.36.1}/tests/test_scheduling.py +0 -0
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# plain-jobs changelog
|
|
2
2
|
|
|
3
|
+
## [0.36.1](https://github.com/dropseed/plain/releases/plain-jobs@0.36.1) (2025-10-20)
|
|
4
|
+
|
|
5
|
+
### What's changed
|
|
6
|
+
|
|
7
|
+
- Fixed `run_in_worker()` to properly return `None` when a duplicate job is detected with a unique key, instead of returning the list of in-progress jobs ([5d7df365d6](https://github.com/dropseed/plain/commit/5d7df365d6))
|
|
8
|
+
|
|
9
|
+
### Upgrade instructions
|
|
10
|
+
|
|
11
|
+
- No changes required
|
|
12
|
+
|
|
13
|
+
## [0.36.0](https://github.com/dropseed/plain/releases/plain-jobs@0.36.0) (2025-10-17)
|
|
14
|
+
|
|
15
|
+
### What's changed
|
|
16
|
+
|
|
17
|
+
- Removed internal memory optimization attempts including manual garbage collection and object deletion in worker processes ([c7064ba329](https://github.com/dropseed/plain/commit/c7064ba329))
|
|
18
|
+
- Increased worker sleep interval from 0.1s to 0.5s when no jobs are available, reducing CPU usage during idle periods ([c7064ba329](https://github.com/dropseed/plain/commit/c7064ba329))
|
|
19
|
+
|
|
20
|
+
### Upgrade instructions
|
|
21
|
+
|
|
22
|
+
- No changes required
|
|
23
|
+
|
|
3
24
|
## [0.35.1](https://github.com/dropseed/plain/releases/plain-jobs@0.35.1) (2025-10-17)
|
|
4
25
|
|
|
5
26
|
### What's changed
|
|
@@ -119,9 +119,9 @@ class Job(metaclass=JobType):
|
|
|
119
119
|
# Only need to look at in progress jobs
|
|
120
120
|
# if we also have a unique key.
|
|
121
121
|
# Otherwise it's up to the user to use _in_progress()
|
|
122
|
-
if
|
|
122
|
+
if self._in_progress(unique_key):
|
|
123
123
|
span.set_attribute(ERROR_TYPE, "DuplicateJob")
|
|
124
|
-
return
|
|
124
|
+
return None
|
|
125
125
|
|
|
126
126
|
# Is recording is not enough here... because we also record for summaries!
|
|
127
127
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
import gc
|
|
4
3
|
import logging
|
|
5
4
|
import multiprocessing
|
|
6
5
|
import os
|
|
@@ -122,7 +121,7 @@ class Worker:
|
|
|
122
121
|
# We don't want to convert too many JobRequests to Jobs,
|
|
123
122
|
# because anything not started yet will be cancelled on deploy etc.
|
|
124
123
|
# It's easier to leave them in the JobRequest db queue as long as possible.
|
|
125
|
-
time.sleep(0.
|
|
124
|
+
time.sleep(0.5)
|
|
126
125
|
continue
|
|
127
126
|
|
|
128
127
|
with transaction.atomic():
|
|
@@ -157,19 +156,11 @@ class Worker:
|
|
|
157
156
|
|
|
158
157
|
job_process_uuid = str(job.uuid) # Make a str copy
|
|
159
158
|
|
|
160
|
-
# Release these now
|
|
161
|
-
del job_request
|
|
162
|
-
del job
|
|
163
|
-
|
|
164
159
|
future = self.executor.submit(process_job, job_process_uuid)
|
|
165
160
|
future.add_done_callback(
|
|
166
161
|
partial(future_finished_callback, job_process_uuid)
|
|
167
162
|
)
|
|
168
163
|
|
|
169
|
-
# Do a quick sleep regardless to see if it
|
|
170
|
-
# gives processes a chance to start up
|
|
171
|
-
time.sleep(0.1)
|
|
172
|
-
|
|
173
164
|
def shutdown(self) -> None:
|
|
174
165
|
if self._is_shutting_down:
|
|
175
166
|
# Already shutting down somewhere else
|
|
@@ -339,9 +330,6 @@ def process_job(job_process_uuid: str) -> None:
|
|
|
339
330
|
|
|
340
331
|
job_result = middleware_chain(job_process)
|
|
341
332
|
|
|
342
|
-
# Release it now
|
|
343
|
-
del job_process
|
|
344
|
-
|
|
345
333
|
duration = job_result.ended_at - job_result.started_at # type: ignore[unsupported-operator]
|
|
346
334
|
duration = duration.total_seconds()
|
|
347
335
|
|
|
@@ -357,8 +345,6 @@ def process_job(job_process_uuid: str) -> None:
|
|
|
357
345
|
job_result.queue,
|
|
358
346
|
duration,
|
|
359
347
|
)
|
|
360
|
-
|
|
361
|
-
del job_result
|
|
362
348
|
except Exception as e:
|
|
363
349
|
# Raising exceptions inside the worker process doesn't
|
|
364
350
|
# seem to be caught/shown anywhere as configured.
|
|
@@ -367,4 +353,3 @@ def process_job(job_process_uuid: str) -> None:
|
|
|
367
353
|
logger.exception(e)
|
|
368
354
|
finally:
|
|
369
355
|
request_finished.send(sender=None)
|
|
370
|
-
gc.collect()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "plain.jobs"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.36.1"
|
|
4
4
|
description = "Process background jobs with a database-driven job queue."
|
|
5
5
|
authors = [{name = "Dave Gaeddert", email = "dave.gaeddert@dropseed.dev"}]
|
|
6
6
|
readme = "README.md"
|
|
@@ -10,8 +10,8 @@ dependencies = [
|
|
|
10
10
|
"plain.models<1.0.0",
|
|
11
11
|
]
|
|
12
12
|
|
|
13
|
-
[
|
|
14
|
-
dev
|
|
13
|
+
[dependency-groups]
|
|
14
|
+
dev = [
|
|
15
15
|
"pytest>=8.0.0",
|
|
16
16
|
]
|
|
17
17
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{plain_jobs-0.35.1 → plain_jobs-0.36.1}/plain/jobs/migrations/0003_rename_job_jobprocess_and_more.py
RENAMED
|
File without changes
|
{plain_jobs-0.35.1 → plain_jobs-0.36.1}/plain/jobs/migrations/0004_rename_tables_to_plainjobs.py
RENAMED
|
File without changes
|
{plain_jobs-0.35.1 → plain_jobs-0.36.1}/plain/jobs/migrations/0005_rename_constraints_and_indexes.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{plain_jobs-0.35.1 → plain_jobs-0.36.1}/plain/jobs/templates/admin/plainqueue/jobresult_detail.html
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|