shared-multiprocess-queue 0.1.1__py3-none-any.whl → 0.1.4__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.
- shared_multiprocess_queue/__init__.py +6 -0
- {shared_queue → shared_multiprocess_queue}/queue.py +4 -13
- {shared_multiprocess_queue-0.1.1.dist-info → shared_multiprocess_queue-0.1.4.dist-info}/METADATA +4 -4
- shared_multiprocess_queue-0.1.4.dist-info/RECORD +6 -0
- shared_multiprocess_queue-0.1.4.dist-info/top_level.txt +1 -0
- shared_multiprocess_queue-0.1.1.dist-info/RECORD +0 -6
- shared_multiprocess_queue-0.1.1.dist-info/top_level.txt +0 -1
- shared_queue/__init__.py +0 -6
- {shared_multiprocess_queue-0.1.1.dist-info → shared_multiprocess_queue-0.1.4.dist-info}/WHEEL +0 -0
|
@@ -11,7 +11,7 @@ import asyncio
|
|
|
11
11
|
import struct
|
|
12
12
|
import time
|
|
13
13
|
from multiprocessing import shared_memory
|
|
14
|
-
from typing import Any, Protocol
|
|
14
|
+
from typing import Any, Protocol
|
|
15
15
|
|
|
16
16
|
import cloudpickle
|
|
17
17
|
|
|
@@ -74,11 +74,7 @@ class SharedMemoryQueue:
|
|
|
74
74
|
self.item_size = item_size
|
|
75
75
|
|
|
76
76
|
# Create or connect to shared memory lock
|
|
77
|
-
self._lock = SharedMemoryLock(
|
|
78
|
-
name=f"{name}_queue_lock",
|
|
79
|
-
create=create,
|
|
80
|
-
run_id=run_id
|
|
81
|
-
)
|
|
77
|
+
self._lock = SharedMemoryLock(name=f"{name}_queue_lock", create=create, run_id=run_id)
|
|
82
78
|
|
|
83
79
|
# Calculate total size needed
|
|
84
80
|
data_size = capacity * item_size
|
|
@@ -425,7 +421,6 @@ class SharedMemoryQueue:
|
|
|
425
421
|
raise Empty("Queue is empty (timeout)")
|
|
426
422
|
await asyncio.sleep(0.001) # Brief async sleep before retry
|
|
427
423
|
|
|
428
|
-
|
|
429
424
|
def put_batch(self, items: list[Any]) -> None:
|
|
430
425
|
"""
|
|
431
426
|
Put multiple items atomically under a single lock acquisition.
|
|
@@ -604,11 +599,7 @@ class SharedMemoryQueue:
|
|
|
604
599
|
self.item_size = state["item_size"]
|
|
605
600
|
|
|
606
601
|
# Reconnect to the same shared memory lock
|
|
607
|
-
self._lock = SharedMemoryLock(
|
|
608
|
-
name=f"{self.name}_queue_lock",
|
|
609
|
-
create=False,
|
|
610
|
-
run_id=self.run_id
|
|
611
|
-
)
|
|
602
|
+
self._lock = SharedMemoryLock(name=f"{self.name}_queue_lock", create=False, run_id=self.run_id)
|
|
612
603
|
|
|
613
604
|
# Reconnect to existing shared memory
|
|
614
605
|
shm_name = f"{self.run_id}-{self.name}-queue" if self.run_id else f"{self.name}-queue"
|
|
@@ -625,4 +616,4 @@ class Empty(Exception):
|
|
|
625
616
|
class Full(Exception):
|
|
626
617
|
"""Raised when queue is full"""
|
|
627
618
|
|
|
628
|
-
pass
|
|
619
|
+
pass
|
{shared_multiprocess_queue-0.1.1.dist-info → shared_multiprocess_queue-0.1.4.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: shared-multiprocess-queue
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.4
|
|
4
4
|
Summary: A shared-memory based multiprocessing queue for cross-process communication
|
|
5
5
|
Author-email: Raymond Chastain <RaymondLC92@protonmail.com>
|
|
6
6
|
License: MIT
|
|
@@ -39,7 +39,7 @@ Or for development:
|
|
|
39
39
|
|
|
40
40
|
```bash
|
|
41
41
|
git clone <repo-url>
|
|
42
|
-
cd
|
|
42
|
+
cd shared_multiprocess_queue
|
|
43
43
|
uv sync
|
|
44
44
|
uv pip install -e .
|
|
45
45
|
```
|
|
@@ -47,7 +47,7 @@ uv pip install -e .
|
|
|
47
47
|
## Quick Start
|
|
48
48
|
|
|
49
49
|
```python
|
|
50
|
-
from
|
|
50
|
+
from shared_multiprocess_queue import SharedMemoryQueue
|
|
51
51
|
from multiprocessing import Process
|
|
52
52
|
import time
|
|
53
53
|
|
|
@@ -313,7 +313,7 @@ uv sync
|
|
|
313
313
|
uv run pytest
|
|
314
314
|
|
|
315
315
|
# Run tests with coverage
|
|
316
|
-
uv run pytest --cov=
|
|
316
|
+
uv run pytest --cov=shared_multiprocess_queue
|
|
317
317
|
|
|
318
318
|
# Type checking
|
|
319
319
|
uv run mypy .
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
shared_multiprocess_queue/__init__.py,sha256=HWGgz9NhPsTVZjQzWOhab661kvR43FlSjDjaJJIkSEA,205
|
|
2
|
+
shared_multiprocess_queue/queue.py,sha256=HPYXJdYMaenaQIKgvRmGXpJfSJBg-V50-qMmOHciCsw,24251
|
|
3
|
+
shared_multiprocess_queue-0.1.4.dist-info/METADATA,sha256=wOStFglR5xF1L3E95KAJpwkFIWm9vgOm6nngQTUtQV4,9008
|
|
4
|
+
shared_multiprocess_queue-0.1.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
5
|
+
shared_multiprocess_queue-0.1.4.dist-info/top_level.txt,sha256=Ww0fsiysnOORQbStHMU1GJTzkygRlL4DctHG2TCQX3c,26
|
|
6
|
+
shared_multiprocess_queue-0.1.4.dist-info/RECORD,,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
shared_multiprocess_queue
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
shared_queue/__init__.py,sha256=n7Ol-4ftiIarTO4vZpBMV-V1aAkxcjpHtpqzVFDMJPY,204
|
|
2
|
-
shared_queue/queue.py,sha256=tt2IA5jckivnOMY06Vrs4fEUDyCBWbJV-H4dnIi4470,24354
|
|
3
|
-
shared_multiprocess_queue-0.1.1.dist-info/METADATA,sha256=lQdVctNFcI1DgCL1Yo1u5qWCZ58jA97FwlCgtX1NxeU,8969
|
|
4
|
-
shared_multiprocess_queue-0.1.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
5
|
-
shared_multiprocess_queue-0.1.1.dist-info/top_level.txt,sha256=jyPOO-FyMPquhn_5tpGt4WS9V0Aa0JjoYgt-aAH8eyw,13
|
|
6
|
-
shared_multiprocess_queue-0.1.1.dist-info/RECORD,,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
shared_queue
|
shared_queue/__init__.py
DELETED
{shared_multiprocess_queue-0.1.1.dist-info → shared_multiprocess_queue-0.1.4.dist-info}/WHEEL
RENAMED
|
File without changes
|