python-pq 0.6.0__tar.gz → 0.6.2__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.
- {python_pq-0.6.0 → python_pq-0.6.2}/PKG-INFO +13 -1
- {python_pq-0.6.0 → python_pq-0.6.2}/README.md +12 -0
- {python_pq-0.6.0 → python_pq-0.6.2}/pyproject.toml +1 -1
- {python_pq-0.6.0 → python_pq-0.6.2}/src/pq/__init__.py +1 -3
- {python_pq-0.6.0 → python_pq-0.6.2}/src/pq/client.py +5 -3
- {python_pq-0.6.0 → python_pq-0.6.2}/src/pq/logging.py +4 -5
- {python_pq-0.6.0 → python_pq-0.6.2}/LICENSE +0 -0
- {python_pq-0.6.0 → python_pq-0.6.2}/src/pq/config.py +0 -0
- {python_pq-0.6.0 → python_pq-0.6.2}/src/pq/migrations/README +0 -0
- {python_pq-0.6.0 → python_pq-0.6.2}/src/pq/migrations/__init__.py +0 -0
- {python_pq-0.6.0 → python_pq-0.6.2}/src/pq/migrations/env.py +0 -0
- {python_pq-0.6.0 → python_pq-0.6.2}/src/pq/migrations/script.py.mako +0 -0
- {python_pq-0.6.0 → python_pq-0.6.2}/src/pq/migrations/versions/20260109T055839Z_476683af098d_initial_schema.py +0 -0
- {python_pq-0.6.0 → python_pq-0.6.2}/src/pq/migrations/versions/20260109T063747Z_2483bec70083_add_client_id.py +0 -0
- {python_pq-0.6.0 → python_pq-0.6.2}/src/pq/migrations/versions/20260205T120000Z_a1b2c3d4e5f6_add_max_concurrent.py +0 -0
- {python_pq-0.6.0 → python_pq-0.6.2}/src/pq/migrations/versions/20260205T180000Z_b7c8d9e0f1a2_add_periodic_key.py +0 -0
- {python_pq-0.6.0 → python_pq-0.6.2}/src/pq/migrations/versions/20260217T120000Z_c3d4e5f6a7b8_add_periodic_active.py +0 -0
- {python_pq-0.6.0 → python_pq-0.6.2}/src/pq/migrations/versions/__init__.py +0 -0
- {python_pq-0.6.0 → python_pq-0.6.2}/src/pq/models.py +0 -0
- {python_pq-0.6.0 → python_pq-0.6.2}/src/pq/priority.py +0 -0
- {python_pq-0.6.0 → python_pq-0.6.2}/src/pq/registry.py +0 -0
- {python_pq-0.6.0 → python_pq-0.6.2}/src/pq/serialization.py +0 -0
- {python_pq-0.6.0 → python_pq-0.6.2}/src/pq/worker.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: python-pq
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.2
|
|
4
4
|
Summary: Postgres-backed job queue for Python
|
|
5
5
|
Keywords: postgres,job-queue,task-queue,background-jobs,worker
|
|
6
6
|
Author: ricwo
|
|
@@ -248,6 +248,18 @@ pq.run_worker(pre_execute=setup_tracing, post_execute=flush_tracing)
|
|
|
248
248
|
|
|
249
249
|
Hooks run in the forked child, making them safe for fork-unsafe resources like OpenTelemetry.
|
|
250
250
|
|
|
251
|
+
## Logging
|
|
252
|
+
|
|
253
|
+
pq uses [loguru](https://github.com/Delgan/loguru) internally and does **not** configure the logger on import. This means it inherits whatever logging setup the host application has already established.
|
|
254
|
+
|
|
255
|
+
If you are running pq as a standalone script and want pq's default log format, call `configure_logging()` explicitly during startup:
|
|
256
|
+
|
|
257
|
+
```python
|
|
258
|
+
from pq.logging import configure_logging
|
|
259
|
+
|
|
260
|
+
configure_logging()
|
|
261
|
+
```
|
|
262
|
+
|
|
251
263
|
## Serialization
|
|
252
264
|
|
|
253
265
|
Arguments are serialized automatically:
|
|
@@ -212,6 +212,18 @@ pq.run_worker(pre_execute=setup_tracing, post_execute=flush_tracing)
|
|
|
212
212
|
|
|
213
213
|
Hooks run in the forked child, making them safe for fork-unsafe resources like OpenTelemetry.
|
|
214
214
|
|
|
215
|
+
## Logging
|
|
216
|
+
|
|
217
|
+
pq uses [loguru](https://github.com/Delgan/loguru) internally and does **not** configure the logger on import. This means it inherits whatever logging setup the host application has already established.
|
|
218
|
+
|
|
219
|
+
If you are running pq as a standalone script and want pq's default log format, call `configure_logging()` explicitly during startup:
|
|
220
|
+
|
|
221
|
+
```python
|
|
222
|
+
from pq.logging import configure_logging
|
|
223
|
+
|
|
224
|
+
configure_logging()
|
|
225
|
+
```
|
|
226
|
+
|
|
215
227
|
## Serialization
|
|
216
228
|
|
|
217
229
|
Arguments are serialized automatically:
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
"""PQ - Postgres-backed task queue."""
|
|
2
2
|
|
|
3
|
-
import pq.logging # noqa: F401 - configures loguru on import
|
|
4
|
-
|
|
5
3
|
from pq.client import PQ
|
|
6
4
|
from pq.models import Periodic, Task, TaskStatus
|
|
7
5
|
from pq.priority import Priority
|
|
8
6
|
from pq.worker import PostExecuteHook, PreExecuteHook, TaskTimeoutError
|
|
9
7
|
|
|
10
|
-
__version__ = "0.6.
|
|
8
|
+
__version__ = "0.6.2"
|
|
11
9
|
|
|
12
10
|
__all__ = [
|
|
13
11
|
"PQ",
|
|
@@ -352,17 +352,19 @@ class PQ:
|
|
|
352
352
|
result = session.execute(stmt)
|
|
353
353
|
return result.rowcount > 0
|
|
354
354
|
|
|
355
|
-
def unschedule(self, task: Callable[..., Any], *, key: str = "") -> bool:
|
|
355
|
+
def unschedule(self, task: Callable[..., Any] | str, *, key: str = "") -> bool:
|
|
356
356
|
"""Remove a periodic task.
|
|
357
357
|
|
|
358
358
|
Args:
|
|
359
|
-
task: The scheduled function to remove
|
|
359
|
+
task: The scheduled function to remove, or its import path
|
|
360
|
+
as a 'module:name' string (useful when the module has
|
|
361
|
+
been removed and the callable is no longer importable).
|
|
360
362
|
key: Discriminator key. Defaults to "" (the default schedule).
|
|
361
363
|
|
|
362
364
|
Returns:
|
|
363
365
|
True if task was found and deleted, False otherwise.
|
|
364
366
|
"""
|
|
365
|
-
name = get_function_path(task)
|
|
367
|
+
name = task if isinstance(task, str) else get_function_path(task)
|
|
366
368
|
with self.session() as session:
|
|
367
369
|
stmt = delete(Periodic).where(Periodic.name == name, Periodic.key == key)
|
|
368
370
|
result = session.execute(stmt)
|
|
@@ -8,7 +8,10 @@ from loguru import logger
|
|
|
8
8
|
def configure_logging() -> None:
|
|
9
9
|
"""Configure loguru with a clean, aligned format.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
This is an opt-in helper for applications that want pq's default log
|
|
12
|
+
format. Call it explicitly during application startup. pq itself never
|
|
13
|
+
calls this function so it will not interfere with an existing loguru
|
|
14
|
+
configuration.
|
|
12
15
|
"""
|
|
13
16
|
# Remove default handler
|
|
14
17
|
logger.remove()
|
|
@@ -21,7 +24,3 @@ def configure_logging() -> None:
|
|
|
21
24
|
level="DEBUG",
|
|
22
25
|
colorize=True,
|
|
23
26
|
)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
# Auto-configure on import
|
|
27
|
-
configure_logging()
|
|
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
|