prompy.threadio package¶
prompy.threadio.pooled_caller module¶
-
class
prompy.threadio.pooled_caller.PooledCaller(**pool_kwargs)[source]¶ Bases:
prompy.container.BasePromiseContainerClass wrapper for urlcall. Auto-add calls to a PromiseQueuePool to be resolved.
prompy.threadio.promise_queue module¶
-
class
prompy.threadio.promise_queue.PromiseQueue(start=False, max_idle=0.5, on_stop=None, queue_timeout=0.01, interval=0.01, daemon=False)[source]¶ Bases:
prompy.container.PromiseContainer-
__init__(start=False, max_idle=0.5, on_stop=None, queue_timeout=0.01, interval=0.01, daemon=False)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
add_promise(promise)[source]¶ Add a promise to the container.
Parameters: promise ( Promise[~PromiseReturnType]) –Returns:
-
error¶
-
running¶
-
-
class
prompy.threadio.promise_queue.PromiseQueuePool(pool_size=8, start=False, max_idle=0.5, daemon=False)[source]¶ Bases:
prompy.container.BasePromiseRunner-
__init__(pool_size=8, start=False, max_idle=0.5, daemon=False)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
prompy.threadio.tpromise module¶
Threaded Promise
Auto insert in a global thread pool.
Use the following environ vars:
- PROMPY_THREAD_POOL_SIZE=2
- PROMPY_THREAD_IDLE_TIME=0.5
- PROMPY_THREAD_DAEMON=false
-
class
prompy.threadio.tpromise.TPromise(starter, *args, **kwargs)[source]¶ Bases:
prompy.promise.PromiseA promise with auto insert in a threadio.PromiseQueue.
-
__init__(starter, *args, **kwargs)[source]¶ Promise takes at least a starter method with params to this promise resolve and reject. Does not call exec by default but with start_now the execution will be synchronous.
Parameters: - starter – otherwise known as executor.
- then – initial resolve callback
- catch – initial catch callback
- complete – initial complete callback
- raise_again – raise the rejection error again.
- start_now –
- results_buffer_size – number of results to keep in the buffer.
-