Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
python3-tvault-contego / usr / lib / python3.6 / site-packages / contego / __pycache__ / async_utils.cpython-36.opt-1.pyc
Size: Mime:
3

nS
bÕã@s@ddlmZmZmZddlmZddlmZdd„Zdd„Z	dS)	é)ÚThreadÚEventÚBoundedSemaphore)Úwraps)ÚRetryExceptioncstˆƒ‡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()
    cstˆ||d}|jƒ|S)N)ÚtargetÚargsÚkwargs)rÚstart)rr	Úfunc_hl)Úfunc©ú!/usr/lib/python3.6/async_utils.pyÚ
async_func szrun_async.<locals>.async_func)r)rrr
)rrÚ	run_async	srcs‡fdd„}|S)Ncstˆƒ‡‡fdd„ƒ}|S)Ncs‚tƒ}‡fdd„}ˆjdƒrvy2|j|ˆdœƒt|||d}|jƒ|jƒ|Stk
rrˆjƒtdƒ‚Yq~Xntdƒ‚dS)Nc
s:|jdƒ}|jdƒ}|jƒz|||ŽWdˆjƒXdS)NÚthread_start_eventÚactual_func)ÚpopÚsetÚrelease)rr	ZtheventZthfunc)Ú
throttlingr
rÚthread_wrapper_func/s

zYrun_async_by_throttle.<locals>.run_async.<locals>.async_func.<locals>.thread_wrapper_funcF)rr)rrr	z	Retry....)	rÚacquireÚupdaterr
ÚwaitÚ
BaseExceptionrr)rr	Zeventrr)rrr
rr+s	
z<run_async_by_throttle.<locals>.run_async.<locals>.async_func)r)rr)r)rrr*sz(run_async_by_throttle.<locals>.run_asyncr
)rrr
)rrÚrun_async_by_throttle)srN)
Z	threadingrrrÚ	functoolsrZcontego.exceptionrrrr
r
r
rÚ<module>s