Skip to content

Commit

Permalink
doc
Browse files Browse the repository at this point in the history
  • Loading branch information
bjudkewitz committed Sep 3, 2024
1 parent 03060c2 commit ec4aab1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
![GitHub last commit](https://img.shields.io/github/last-commit/danionella/dejaq)

# DéjàQueue
# Déjà Queue

A fast drop-in replacement for `multiprocessing.Queue` taking advantage of a [shared memory](https://docs.python.org/3/library/multiprocessing.html#multiprocessing.Array) ring buffer and [pickle protocol 5 with out-of-band data](https://peps.python.org/pep-0574/). As with other queues in Python, data is transmitted via `put` and `get` calls.
A fast drop-in replacement for `multiprocessing.Queue` taking advantage of a [shared memory](https://docs.python.org/3/library/multiprocessing.html#multiprocessing.Array) ring buffer and [pickle protocol 5 out-of-band data](https://peps.python.org/pep-0574/) to minimize copies. As with other queues in Python, data is transmitted via `put` and `get` calls.

DejaQueue supports any type of picklable Python object, including numpy arrays or nested dictionaries with mixed content. It uses locks to support more than one producer and comsumer process.
`dejaq.DejaQueue` supports any type of picklable Python object, including numpy arrays or nested dictionaries with mixed content. It uses locks to support more than one producer and comsumer process.

Auto-generated API documentation: https://danionella.github.io/dejaq

## Usage example
```python
import numpy as np
from multiprocessing import Process
from dqjaq import DejaQueue
from dejaq import DejaQueue

def produce(queue):
for i in range(20):
Expand Down
3 changes: 2 additions & 1 deletion dejaq/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

@dataclasses.dataclass
class FrameInfo:
''' A class to store metadata about a frame in a FIFO queue.'''
nbytes: int
head: int
tail: int
Expand Down Expand Up @@ -207,7 +208,7 @@ def callback_wrapper(array_bytes, meta):
return array, meta

class DejaQueue(ByteFIFO):
""" A fast queue for Python objects. The queue is implemented as a ring buffer in shared memory.
""" A fast queue for arbitrary (picklable) Python objects. The queue is implemented as a ring buffer in shared memory.
Args:
buffer_size (int): The size of the buffer in bytes.
Expand Down

0 comments on commit ec4aab1

Please sign in to comment.