Repository URL to install this package:
|
Version:
5.2.8.22-5.2 ▾
|
python3-tvault-contego
/
usr
/
lib
/
python3.9
/
site-packages
/
contego
/
__pycache__
/
async_utils.cpython-39.pyc
|
|---|
a
5½ËhÕ ã @ s@ d dl mZmZmZ d dlmZ d dlmZ dd Zdd Z dS ) é )ÚThreadÚEventÚBoundedSemaphore©Úwraps)ÚRetryExceptionc s t fdd}|S )aÛ
run_async(func)
function decorator, intended to make "func" run in a separate
thread (asynchronously).
Returns the created Thread object
E.g.:
@run_async
def task1():
do_something
@run_async
def task2():
do_something_too
t1 = task1()
t2 = task2()
...
t1.join()
t2.join()
c s t | |d}| ¡ |S )N©ÚtargetÚargsÚkwargs)r Ústart)r
r Úfunc_hl©Úfunc© ú7/usr/lib/python3.9/site-packages/contego/async_utils.pyÚ
async_func s zrun_async.<locals>.async_funcr ©r r r r r Ú run_async s r c s fdd}|S )Nc s t fdd}|S )Nc s t }fdd} d¡rvz4| | d¡ t|| |d}| ¡ | ¡ |W S tyr ¡ tdY q~0 ntdd S )Nc sF | d¡}| d¡}| ¡ z|| i |¤ W ¡ n
¡ 0 d S )NÚthread_start_eventÚactual_func)ÚpopÚsetÚrelease)r
r ZtheventZthfunc©Ú
throttlingr r Úthread_wrapper_func/ s
zYrun_async_by_throttle.<locals>.run_async.<locals>.async_func.<locals>.thread_wrapper_funcF)r r r z Retry....) r ÚacquireÚupdater r ÚwaitÚ
BaseExceptionr r )r
r Zeventr r
)r r r r r + s
ÿz<run_async_by_throttle.<locals>.run_async.<locals>.async_funcr r r r r r * s z(run_async_by_throttle.<locals>.run_asyncr )r r r r r Úrun_async_by_throttle) s r! N)
Ú threadingr r r Ú functoolsr Zcontego.exceptionr r r! r r r r Ú<module> s