dragon.mpbridge.queues.DragonSimpleQueue
- class DragonSimpleQueue
Bases:
PatchedDragonNativeQueue
A simplified queue co-located on the same node by default as the creating process
- __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
Methods
__init__
(*args[, ctx])Init method
close
()Indicate that no more data will be put on this queue by the current process.
empty
()Return True if the queue is empty, False otherwise.
get
([block, timeout])Remove and return an item from the queue.
put
(obj[, block, timeout])Puts the serialization of an object onto the queue.
- __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
- 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.
- empty() bool
Return True if the queue is empty, False otherwise. This might not be reliable
- Raises:
ValueError – If the queue is closed
- Returns:
Wether or not the queue is empty
- Return type:
- get(block: bool = True, timeout: float = None) object
Remove and return an item from the queue.
- Parameters:
- Raises:
ValueError – If queue is closed
queue.Empty – If queue is empty
- Returns:
The next item 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