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 / dist-packages / contego / __pycache__ / async_utils.cpython-35.pyc
Size: Mime:


º2]×ã@sXddlmZmZmZddlmZddlmZdd„Zdd„Z	dS)	é)ÚThreadÚEventÚBoundedSemaphore)Úwraps)ÚRetryExceptioncs"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()
    cs)tdˆd|d|ƒ}|jƒ|S)NÚtargetÚargsÚkwargs)rÚstart)rr	Úfunc_hl)Úfunc©ú5/usr/lib/python3/dist-packages/contego/async_utils.pyÚ
async_funcs
zrun_async.<locals>.async_func)r)rrr
)rrÚ	run_async	srcs‡fdd†}|S)Ncs%tˆƒ‡‡fdd†ƒ}|S)Nc
s¸tƒ}‡fdd†}ˆjdƒr¨yP|jd|dˆiƒtd|d|d|ƒ}|jƒ|jƒ|SWq´tk
r¤ˆjƒtd	ƒ‚Yq´Xntd	ƒ‚dS)
Nc
sK|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_funcFrrrrr	z	Retry....)	rÚacquireÚupdaterr
ÚwaitÚ
BaseExceptionrr)rr	Úeventrr)rrr
rr*s		



z<run_async_by_throttle.<locals>.run_async.<locals>.async_func)r)rr)r)rrr)s!z(run_async_by_throttle.<locals>.run_asyncr
)rrr
)rrÚrun_async_by_throttle(srN)
Ú	threadingrrrÚ	functoolsrZcontego.exceptionrrrr
r
r
rÚ<module>s