blocking_dict
stick_ray.blocking_dict
Module Contents
- async parallel(*awaitables, return_exceptions=False)[source]
Run multiple requests in parallel.
- Parameters:
*awaitables (Awaitable) – awaitables to run in parallel
return_exceptions (bool) – if True, return exceptions instead of raising them
- Returns:
list of results
- Return type:
List[Union[Any, BaseException]]
- class BlockingDict[source]
Bases:
objectA blocking dictionary that can be used to store and retrieve items in a thread-safe manner.
- keys()[source]
Returns a list of keys in the dictionary.
- Returns:
list of keys
- Return type:
List[Hashable]
- async put(key, value)[source]
Put an item into the dictionary with the given key. Overwrites the existing value with same key, if it exists.
- Parameters:
key (Hashable) – key
value (Any) – value
- async peek(key, timeout=None)[source]
Get an item from the dictionary, leaving the item there, optionally blocking and with timeout.
- Parameters:
key (Hashable) – key
timeout (Optional[float]) – timeout in seconds to wait when blocking.
- Returns:
item matching key
- Raises:
asyncio.Timeout if timeout elapsed and item not found –
- Return type:
Any