iddqueue 0.13.0rc2__tar.gz → 0.13.0rc3__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.
- {iddqueue-0.13.0rc2 → iddqueue-0.13.0rc3}/PKG-INFO +11 -8
- {iddqueue-0.13.0rc2 → iddqueue-0.13.0rc3}/README.md +10 -7
- {iddqueue-0.13.0rc2 → iddqueue-0.13.0rc3}/iddqueue/__init__.py +2 -0
- iddqueue-0.13.0rc3/iddqueue/domains.py +70 -0
- {iddqueue-0.13.0rc2 → iddqueue-0.13.0rc3}/pyproject.toml +1 -1
- {iddqueue-0.13.0rc2 → iddqueue-0.13.0rc3}/LICENSE +0 -0
- {iddqueue-0.13.0rc2 → iddqueue-0.13.0rc3}/iddqueue/broker.py +0 -0
- {iddqueue-0.13.0rc2 → iddqueue-0.13.0rc3}/iddqueue/cancellation.py +0 -0
- {iddqueue-0.13.0rc2 → iddqueue-0.13.0rc3}/iddqueue/cancellation.sql +0 -0
- {iddqueue-0.13.0rc2 → iddqueue-0.13.0rc3}/iddqueue/cli.py +0 -0
- {iddqueue-0.13.0rc2 → iddqueue-0.13.0rc3}/iddqueue/control.py +0 -0
- {iddqueue-0.13.0rc2 → iddqueue-0.13.0rc3}/iddqueue/control.sql +0 -0
- {iddqueue-0.13.0rc2 → iddqueue-0.13.0rc3}/iddqueue/coordination.sql +0 -0
- {iddqueue-0.13.0rc2 → iddqueue-0.13.0rc3}/iddqueue/deduplication.sql +0 -0
- {iddqueue-0.13.0rc2 → iddqueue-0.13.0rc3}/iddqueue/failures.py +0 -0
- {iddqueue-0.13.0rc2 → iddqueue-0.13.0rc3}/iddqueue/history.py +0 -0
- {iddqueue-0.13.0rc2 → iddqueue-0.13.0rc3}/iddqueue/history.sql +0 -0
- {iddqueue-0.13.0rc2 → iddqueue-0.13.0rc3}/iddqueue/metrics.py +0 -0
- {iddqueue-0.13.0rc2 → iddqueue-0.13.0rc3}/iddqueue/rate_limits.py +0 -0
- {iddqueue-0.13.0rc2 → iddqueue-0.13.0rc3}/iddqueue/results.py +0 -0
- {iddqueue-0.13.0rc2 → iddqueue-0.13.0rc3}/iddqueue/scheduler.py +0 -0
- {iddqueue-0.13.0rc2 → iddqueue-0.13.0rc3}/iddqueue/scheduler.sql +0 -0
- {iddqueue-0.13.0rc2 → iddqueue-0.13.0rc3}/iddqueue/schema.py +0 -0
- {iddqueue-0.13.0rc2 → iddqueue-0.13.0rc3}/iddqueue/schema.sql +0 -0
- {iddqueue-0.13.0rc2 → iddqueue-0.13.0rc3}/iddqueue/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: iddqueue
|
|
3
|
-
Version: 0.13.
|
|
3
|
+
Version: 0.13.0rc3
|
|
4
4
|
Summary: Postgres Broker for Dramatiq Task Queue
|
|
5
5
|
Keywords: postgres,task queue,dramatiq
|
|
6
6
|
Author: Étienne BERSAC
|
|
@@ -27,8 +27,8 @@ A PostgreSQL broker and Results backend for [Dramatiq](https://dramatiq.io/),
|
|
|
27
27
|
built on synchronous Psycopg 3. Tasks, results and coordination live in PostgreSQL;
|
|
28
28
|
no Redis or ORM is required by IDDQueue.
|
|
29
29
|
|
|
30
|
-
**Current release: [0.13.
|
|
31
|
-
a release candidate for evaluation. [GitHub assets](https://github.com/wa-pis/iddqueue/releases/tag/v0.13.
|
|
30
|
+
**Current release: [0.13.0rc3](https://pypi.org/project/iddqueue/0.13.0rc3/)** —
|
|
31
|
+
a release candidate for evaluation. [GitHub assets](https://github.com/wa-pis/iddqueue/releases/tag/v0.13.0rc3)
|
|
32
32
|
include the wheel, sdist and SHA256 checksums.
|
|
33
33
|
|
|
34
34
|
IDDQueue is a fork of [DALIBO's dramatiq-pg](https://gitlab.com/dalibo/dramatiq-pg)
|
|
@@ -56,7 +56,7 @@ See [compatibility and API stability](SUPPORT.md).
|
|
|
56
56
|
|
|
57
57
|
```sh
|
|
58
58
|
uv venv
|
|
59
|
-
uv pip install "iddqueue[binary]==0.13.
|
|
59
|
+
uv pip install "iddqueue[binary]==0.13.0rc3"
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
The `binary` extra supplies libpq. Base installs require system libpq;
|
|
@@ -119,11 +119,13 @@ Close broker-owned pools on shutdown; callers close pools they supply.
|
|
|
119
119
|
|
|
120
120
|
## Guides and examples
|
|
121
121
|
|
|
122
|
+
[Domain actors and one worker bootstrap](docs/domains.md) are included since RC3.
|
|
123
|
+
|
|
122
124
|
- [Documentation index](docs/index.md), [user guide](docs/user-guide.md), [API](docs/api.md).
|
|
123
125
|
- [Detailed recipes](docs/recipes.md): transactions, middleware, controls, metrics and schedules.
|
|
124
126
|
- [FastAPI](docs/fastapi.md): lifespan, async endpoint thread offload and separate worker.
|
|
125
127
|
- [Deployment and retention](docs/deployment-guide.md), [why PostgreSQL](docs/why.md).
|
|
126
|
-
- [RC notes](docs/rc-0.13.
|
|
128
|
+
- [RC notes](docs/rc-0.13.0rc3.md), [changelog](CHANGELOG.md), [release checks](docs/release.md).
|
|
127
129
|
|
|
128
130
|
The broker and result APIs are synchronous. Async actors use Dramatiq's AsyncIO
|
|
129
131
|
middleware; FastAPI async endpoints offload publication to a thread.
|
|
@@ -138,12 +140,13 @@ is unverified. No tested Django integration is currently provided.
|
|
|
138
140
|
## Compared with dramatiq-pg
|
|
139
141
|
|
|
140
142
|
Baseline: [dramatiq-pg 0.12.0](https://pypi.org/project/dramatiq-pg/0.12.0/),
|
|
141
|
-
compared with the published IDDQueue 0.13.
|
|
143
|
+
compared with the published IDDQueue 0.13.0rc3 prerelease. This describes the published version, not every
|
|
142
144
|
future upstream revision. Both projects provide a PostgreSQL Dramatiq broker.
|
|
143
145
|
|
|
144
|
-
| Area | dramatiq-pg 0.12.0 | IDDQueue 0.13.
|
|
146
|
+
| Area | dramatiq-pg 0.12.0 | IDDQueue 0.13.0rc3 / practical benefit |
|
|
145
147
|
| --- | --- | --- |
|
|
146
148
|
| Core storage and delivery | JSONB tasks/results, delayed tasks, LISTEN/NOTIFY, advisory locks, recovery and maintenance CLI | Preserved; at-least-once delivery still requires idempotent actors |
|
|
149
|
+
| Actor initialization | Broker configured before actor imports | Opt-in Domain declarations import before DSN; explicit startup registration and domain queues |
|
|
147
150
|
| Runtime | Python >=3.6,<4; Dramatiq >=1.5,<2; Psycopg 2 | Python >=3.10,<4; Dramatiq >=2.2.1,<3; synchronous Psycopg 3 and psycopg-pool |
|
|
148
151
|
| Pool lifecycle | Psycopg 2 pools | Lazy owned pools, explicit close, caller-owned pool support |
|
|
149
152
|
| Transactional publication | Regular enqueue | Caller-owned transaction API: commit business data and tasks together |
|
|
@@ -158,7 +161,7 @@ future upstream revision. Both projects provide a PostgreSQL Dramatiq broker.
|
|
|
158
161
|
|
|
159
162
|
See [migration from dramatiq-pg](docs/migration.md) for dependency, pool,
|
|
160
163
|
import, CLI and database changes, including backup and rollback. No throughput
|
|
161
|
-
advantage is claimed here. The 0.13.
|
|
164
|
+
advantage is claimed here. The 0.13.0rc3 prerelease is available on PyPI; the legacy Django
|
|
162
165
|
integration is archived and has not been verified with IDDQueue.
|
|
163
166
|
|
|
164
167
|
## Development and support
|
|
@@ -6,8 +6,8 @@ A PostgreSQL broker and Results backend for [Dramatiq](https://dramatiq.io/),
|
|
|
6
6
|
built on synchronous Psycopg 3. Tasks, results and coordination live in PostgreSQL;
|
|
7
7
|
no Redis or ORM is required by IDDQueue.
|
|
8
8
|
|
|
9
|
-
**Current release: [0.13.
|
|
10
|
-
a release candidate for evaluation. [GitHub assets](https://github.com/wa-pis/iddqueue/releases/tag/v0.13.
|
|
9
|
+
**Current release: [0.13.0rc3](https://pypi.org/project/iddqueue/0.13.0rc3/)** —
|
|
10
|
+
a release candidate for evaluation. [GitHub assets](https://github.com/wa-pis/iddqueue/releases/tag/v0.13.0rc3)
|
|
11
11
|
include the wheel, sdist and SHA256 checksums.
|
|
12
12
|
|
|
13
13
|
IDDQueue is a fork of [DALIBO's dramatiq-pg](https://gitlab.com/dalibo/dramatiq-pg)
|
|
@@ -35,7 +35,7 @@ See [compatibility and API stability](SUPPORT.md).
|
|
|
35
35
|
|
|
36
36
|
```sh
|
|
37
37
|
uv venv
|
|
38
|
-
uv pip install "iddqueue[binary]==0.13.
|
|
38
|
+
uv pip install "iddqueue[binary]==0.13.0rc3"
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
The `binary` extra supplies libpq. Base installs require system libpq;
|
|
@@ -98,11 +98,13 @@ Close broker-owned pools on shutdown; callers close pools they supply.
|
|
|
98
98
|
|
|
99
99
|
## Guides and examples
|
|
100
100
|
|
|
101
|
+
[Domain actors and one worker bootstrap](docs/domains.md) are included since RC3.
|
|
102
|
+
|
|
101
103
|
- [Documentation index](docs/index.md), [user guide](docs/user-guide.md), [API](docs/api.md).
|
|
102
104
|
- [Detailed recipes](docs/recipes.md): transactions, middleware, controls, metrics and schedules.
|
|
103
105
|
- [FastAPI](docs/fastapi.md): lifespan, async endpoint thread offload and separate worker.
|
|
104
106
|
- [Deployment and retention](docs/deployment-guide.md), [why PostgreSQL](docs/why.md).
|
|
105
|
-
- [RC notes](docs/rc-0.13.
|
|
107
|
+
- [RC notes](docs/rc-0.13.0rc3.md), [changelog](CHANGELOG.md), [release checks](docs/release.md).
|
|
106
108
|
|
|
107
109
|
The broker and result APIs are synchronous. Async actors use Dramatiq's AsyncIO
|
|
108
110
|
middleware; FastAPI async endpoints offload publication to a thread.
|
|
@@ -117,12 +119,13 @@ is unverified. No tested Django integration is currently provided.
|
|
|
117
119
|
## Compared with dramatiq-pg
|
|
118
120
|
|
|
119
121
|
Baseline: [dramatiq-pg 0.12.0](https://pypi.org/project/dramatiq-pg/0.12.0/),
|
|
120
|
-
compared with the published IDDQueue 0.13.
|
|
122
|
+
compared with the published IDDQueue 0.13.0rc3 prerelease. This describes the published version, not every
|
|
121
123
|
future upstream revision. Both projects provide a PostgreSQL Dramatiq broker.
|
|
122
124
|
|
|
123
|
-
| Area | dramatiq-pg 0.12.0 | IDDQueue 0.13.
|
|
125
|
+
| Area | dramatiq-pg 0.12.0 | IDDQueue 0.13.0rc3 / practical benefit |
|
|
124
126
|
| --- | --- | --- |
|
|
125
127
|
| Core storage and delivery | JSONB tasks/results, delayed tasks, LISTEN/NOTIFY, advisory locks, recovery and maintenance CLI | Preserved; at-least-once delivery still requires idempotent actors |
|
|
128
|
+
| Actor initialization | Broker configured before actor imports | Opt-in Domain declarations import before DSN; explicit startup registration and domain queues |
|
|
126
129
|
| Runtime | Python >=3.6,<4; Dramatiq >=1.5,<2; Psycopg 2 | Python >=3.10,<4; Dramatiq >=2.2.1,<3; synchronous Psycopg 3 and psycopg-pool |
|
|
127
130
|
| Pool lifecycle | Psycopg 2 pools | Lazy owned pools, explicit close, caller-owned pool support |
|
|
128
131
|
| Transactional publication | Regular enqueue | Caller-owned transaction API: commit business data and tasks together |
|
|
@@ -137,7 +140,7 @@ future upstream revision. Both projects provide a PostgreSQL Dramatiq broker.
|
|
|
137
140
|
|
|
138
141
|
See [migration from dramatiq-pg](docs/migration.md) for dependency, pool,
|
|
139
142
|
import, CLI and database changes, including backup and rollback. No throughput
|
|
140
|
-
advantage is claimed here. The 0.13.
|
|
143
|
+
advantage is claimed here. The 0.13.0rc3 prerelease is available on PyPI; the legacy Django
|
|
141
144
|
integration is archived and has not been verified with IDDQueue.
|
|
142
145
|
|
|
143
146
|
## Development and support
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
from .broker import PostgresBroker
|
|
2
2
|
from .cancellation import ResultCancelled
|
|
3
|
+
from .domains import Domain
|
|
3
4
|
from .rate_limits import PostgresRateLimiterBackend
|
|
4
5
|
from .results import PostgresBackend
|
|
5
6
|
from .schema import generate_coordination_sql, generate_init_sql, generate_upgrade_sql
|
|
6
7
|
|
|
7
8
|
__all__ = [
|
|
9
|
+
"Domain",
|
|
8
10
|
"ResultCancelled",
|
|
9
11
|
"PostgresBackend",
|
|
10
12
|
"PostgresBroker",
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"""Framework-independent declarations, bound explicitly before worker startup."""
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
|
|
5
|
+
from dramatiq import Actor
|
|
6
|
+
from dramatiq.broker import Broker
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class _DeclarationBroker(Broker):
|
|
10
|
+
def __init__(self):
|
|
11
|
+
super().__init__(middleware=[])
|
|
12
|
+
|
|
13
|
+
def declare_queue(self, queue_name):
|
|
14
|
+
# Declarations create no transport resources.
|
|
15
|
+
pass
|
|
16
|
+
|
|
17
|
+
def enqueue(self, message, *, delay=None):
|
|
18
|
+
raise RuntimeError("Register the actor's Domain with a broker before sending")
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class Domain:
|
|
22
|
+
"""One queue and qualified actor names; register once per process."""
|
|
23
|
+
|
|
24
|
+
def __init__(self, name):
|
|
25
|
+
if not isinstance(name, str) or not re.fullmatch(r"[a-zA-Z_][a-zA-Z0-9._-]*", name):
|
|
26
|
+
raise ValueError("domain name must be a valid Dramatiq queue name")
|
|
27
|
+
self.name = name
|
|
28
|
+
self._declarations = _DeclarationBroker()
|
|
29
|
+
self._broker = None
|
|
30
|
+
self._failed = False
|
|
31
|
+
|
|
32
|
+
def actor(self, fn=None, *, actor_name=None, priority=0, **options):
|
|
33
|
+
def decorate(fn):
|
|
34
|
+
if self._broker is not None or self._failed:
|
|
35
|
+
raise RuntimeError("Declare all domain actors before registration")
|
|
36
|
+
if "broker" in options or "queue_name" in options:
|
|
37
|
+
raise ValueError("Domain owns the broker and queue_name")
|
|
38
|
+
name = actor_name if actor_name is not None else fn.__name__
|
|
39
|
+
if not isinstance(name, str) or not name:
|
|
40
|
+
raise ValueError("actor_name must be a nonempty string")
|
|
41
|
+
return Actor(fn, broker=self._declarations, actor_name=f"{self.name}.{name}",
|
|
42
|
+
queue_name=self.name, priority=priority, options=dict(options))
|
|
43
|
+
return decorate if fn is None else decorate(fn)
|
|
44
|
+
|
|
45
|
+
def register(self, broker):
|
|
46
|
+
if self._failed:
|
|
47
|
+
raise RuntimeError("Registration failed; create a new Domain and broker")
|
|
48
|
+
if not isinstance(broker, Broker):
|
|
49
|
+
raise TypeError("register requires a Dramatiq Broker")
|
|
50
|
+
if broker is self._broker:
|
|
51
|
+
return
|
|
52
|
+
if self._broker is not None:
|
|
53
|
+
raise RuntimeError("Domain is already registered with another broker")
|
|
54
|
+
actors = list(self._declarations.actors.values())
|
|
55
|
+
for actor in actors:
|
|
56
|
+
invalid = set(actor.options) - broker.actor_options
|
|
57
|
+
if invalid:
|
|
58
|
+
raise ValueError(f"Undefined actor options for {actor.actor_name}: {sorted(invalid)}")
|
|
59
|
+
if actor.actor_name in broker.actors:
|
|
60
|
+
raise ValueError(f"Actor {actor.actor_name!r} is already registered")
|
|
61
|
+
try:
|
|
62
|
+
for actor in actors:
|
|
63
|
+
actor.broker = broker
|
|
64
|
+
broker.declare_actor(actor)
|
|
65
|
+
except Exception:
|
|
66
|
+
for actor in actors:
|
|
67
|
+
actor.broker = self._declarations
|
|
68
|
+
self._failed = True
|
|
69
|
+
raise
|
|
70
|
+
self._broker = broker
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|