dragon.mpbridge.queues
Dragon’s replacement of Multiprocessing Queue objects based on Channels.
Functions
|
|
|
|
|
|
|
"Decorator that removes public methods of the decorated class not in public_api. |
Classes
A placeholder connection handle for a queue that has been reset |
|
The Dragon native queue including patches for Python Multiprocessing The API has to exactly match the Multiprocessing.queues.Queue API. |
- restrict_public_api(public_api: list) callable
“Decorator that removes public methods of the decorated class not in public_api. To do so it changes the namespace the first parent & grandparent class. Breaks inheritance.
- class FakeConnectionHandle
Bases:
object
A placeholder connection handle for a queue that has been reset
- class PatchedDragonNativeQueue
Bases:
Queue
The Dragon native queue including patches for Python Multiprocessing The API has to exactly match the Multiprocessing.queues.Queue API.
- __init__(*args, **kwargs)
Init method
- Parameters:
maxsize (int, optional) – sets the upperbound limit on the number of items that can be placed in the queue, defaults to 100
m_uid (int, optional) – The m_uid of the memory pool to use, defaults to _DEF_MUID
block_size (int, optional) – Block size for the underlying channel, defaults to 64 kbytes
joinable (bool, optional) – If this queue should be joinable, defaults to False
policy (object, optional) – policy object, defaults to POLICY_USER
_ext_channel (instance of dragon.channel, optional) – non-local externally managed channel for testing purposes only, defaults to None
- Raises:
QueueError – If something goes wrong during creation
ValueError – If a parameter is wrong
NotImplementedError – If a joinable queue is used with an external channel
- qsize() int
Return the approximate size of the queue. This number may not be reliable.
- Raises:
ValueError – If the queue is closed
- Returns:
approximate number of items in the queue
- Return type:
- put(obj, block=True, timeout=None) None
Puts the serialization of an object onto the queue. This version includes patches for the multiprocessing unit tests
- Parameters:
obj – object to serialize and put
block – Whether to block
timeout – Timeout, if blocking. None means infinity, default
- Returns:
None
- close() None
Indicate that no more data will be put on this queue by the current process. The refcount of the background channel will be released and the channel might be removed, if no other processes are holding it. This version includes a patch for the multiprocessing unit tests.
- join_thread() None
This method is a no-op for Dragon based multiprocessing and exists solely for compatibility with the queues.Queue API.
- cancel_join_thread()
This method is a no-op for Dragon based multiprocessing and exists solely for compatibility with the queues.Queue API.
- class DragonQueue
Bases:
PatchedDragonNativeQueue
- __init__(*args, ctx=None, **kwargs)
Init method
- Parameters:
maxsize (int, optional) – sets the upperbound limit on the number of items that can be placed in the queue, defaults to 100
m_uid (int, optional) – The m_uid of the memory pool to use, defaults to _DEF_MUID
block_size (int, optional) – Block size for the underlying channel, defaults to 64 kbytes
joinable (bool, optional) – If this queue should be joinable, defaults to False
policy (object, optional) – policy object, defaults to POLICY_USER
_ext_channel (instance of dragon.channel, optional) – non-local externally managed channel for testing purposes only, defaults to None
- Raises:
QueueError – If something goes wrong during creation
ValueError – If a parameter is wrong
NotImplementedError – If a joinable queue is used with an external channel
- class DragonJoinableQueue
Bases:
PatchedDragonNativeQueue
- __init__(*args, ctx=None, **kwargs)
Init method
- Parameters:
maxsize (int, optional) – sets the upperbound limit on the number of items that can be placed in the queue, defaults to 100
m_uid (int, optional) – The m_uid of the memory pool to use, defaults to _DEF_MUID
block_size (int, optional) – Block size for the underlying channel, defaults to 64 kbytes
joinable (bool, optional) – If this queue should be joinable, defaults to False
policy (object, optional) – policy object, defaults to POLICY_USER
_ext_channel (instance of dragon.channel, optional) – non-local externally managed channel for testing purposes only, defaults to None
- Raises:
QueueError – If something goes wrong during creation
ValueError – If a parameter is wrong
NotImplementedError – If a joinable queue is used with an external channel
- class DragonSimpleQueue
Bases:
PatchedDragonNativeQueue
- __init__(*args, ctx=None, **kwargs)
Init method
- Parameters:
maxsize (int, optional) – sets the upperbound limit on the number of items that can be placed in the queue, defaults to 100
m_uid (int, optional) – The m_uid of the memory pool to use, defaults to _DEF_MUID
block_size (int, optional) – Block size for the underlying channel, defaults to 64 kbytes
joinable (bool, optional) – If this queue should be joinable, defaults to False
policy (object, optional) – policy object, defaults to POLICY_USER
_ext_channel (instance of dragon.channel, optional) – non-local externally managed channel for testing purposes only, defaults to None
- Raises:
QueueError – If something goes wrong during creation
ValueError – If a parameter is wrong
NotImplementedError – If a joinable queue is used with an external channel
- Queue(maxsize=0, *, ctx=None, use_base_impl=True)
- JoinableQueue(maxsize=0, *, ctx=None, use_base_impl=True)
- SimpleQueue(*, ctx=None, use_base_impl=True)