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    
Size: Mime:
ó
ǍEYc@slddlZddlZddlZddlmZddlmZddlmZddl	m
Z
ddl	mZddl	mZddl
Z
ddlmZejeƒZd	efd
„ƒYZdefd„ƒYZd
„Zdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd„ƒYZdS(iÿÿÿÿN(tevent(tgreenthread(tlog(texcutils(t
reflection(t	timeutils(t_tLoopingCallDonecBseZdZed„ZRS(skException to break out and stop a LoopingCallBase.

    The poll-function passed to LoopingCallBase can raise this exception to
    break out of the loop normally. This is somewhat analogous to
    StopIteration.

    An optional return-value can be included as the argument to the exception;
    this return-value will be returned by LoopingCallBase.wait()

    cCs
||_dS(sA:param retvalue: Value that LoopingCallBase.wait() should return.N(tretvalue(tselfR((sM/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_service/loopingcall.pyt__init__/s(t__name__t
__module__t__doc__tTrueR
(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_service/loopingcall.pyR#s
tLoopingCallTimeOutcBseZdZRS(sException for a timed out LoopingCall.

    The LoopingCall will raise this exception when a timeout is provided
    and it is exceeded.
    (RRR
(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_service/loopingcall.pyR4scs‡‡‡fd†}|S(sCWrapper that calls into wrapped function and logs errors as needed.csayˆ||ŽSWnItk
r'‚n6tk
r\tjdiˆd6ˆd6dtƒdSXdS(Ns%(kind)s %(func_name)r failedtkindt	func_nametexc_infoi(Rt	ExceptiontLOGterrorR(targstkwargs(tfRR(sM/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_service/loopingcall.pytfunc@s

	((RRRR((RRRsM/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_service/loopingcall.pyt
_safe_wrapper=stLoopingCallBasecBseeZedƒZedƒZdd„Zd„Zd„Zd„Z	de
d„Zde
d„ZRS(	sUnknown looping calls2A looping call can only run one function at a timecOs:||_||_||_t|_d|_d|_dS(N(RtkwRtFalset_runningtNonet_threadtdone(R	RRR((sM/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_service/loopingcall.pyR
Ts					cCs
t|_dS(N(RR(R	((sM/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_service/loopingcall.pytstop\scCs
|jjƒS(N(R!twait(R	((sM/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_service/loopingcall.pyR#_scOsd|_t|_dS(N(RR RR(R	tgtRR((sM/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_service/loopingcall.pyt_on_donebs	cCsw|jdk	r!t|jƒ‚nt|_tjƒ|_t	j
|j|d|d|ƒ|_|jj|j
ƒ|jS(syStart the looping

        :param idle_for: Callable that takes two positional arguments, returns
                         how long to idle for. The first positional argument is
                         the last result from the function being looped and the
                         second positional argument is the time it took to
                         calculate that result.
        :param initial_delay: How long to delay before starting the looping.
                              Value is in seconds.
        :param stop_on_exception: Whether to stop if an exception occurs.
        :returns: eventlet event instance
        t
initial_delaytstop_on_exceptionN(R RtRuntimeErrort_RUN_ONLY_ONE_MESSAGERRRtEventR!Rtspawnt	_run_looptlinkR%(R	tidle_forR&R'((sM/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_service/loopingcall.pyt_startfs
	cCs‹|j}tj|jƒ}|r*|jnt|j||ƒ}|rUtj|ƒnytjƒ}xŠ|j	rð|j
ƒ||j|jŽ}|j
ƒ|j	s¦Pn|||jƒƒ}	tjdi|d6|	d6|d6ƒtj|	ƒqgWWn‚tk
r}
|jj|
jƒnmtk
rvtjƒ}z8tjdi|d6|d6d|ƒ|jj|ŒWd~XdSX|jjtƒdS(Ns7%(kind)s %(func_name)r sleeping for %(idle).02f secondsRtidleRs%(kind)s %(func_name)r failedR(t_KINDRtget_callable_nameRRRtsleepRt	StopWatchRtrestartRRR"telapsedRttraceRR!tsendRRtsysRRtsend_exceptionR(R	t
idle_for_funcR&R'RRRtwatchtresultR0teR((sM/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_service/loopingcall.pyR,}s>		

		
	N(
RRRR1R)RR
R"R#R%RR/R,(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_service/loopingcall.pyRNs			tFixedIntervalLoopingCallcBs5eZdZedƒZedƒZded„ZRS(sA fixed interval looping call.sAA fixed interval looping call can only run one function at a timesFixed interval looping callcs+‡‡fd†}ˆj|d|d|ƒS(Ncsgt|ˆdƒ}|dkrRtjˆjƒ}tjdi|d6|d6ƒn|dkrc|SdS(Niis@Function %(func_name)r run outlasted interval by %(delay).2f secRtdelay(troundRR2RRtwarning(R=R6R@R(tintervalR	(sM/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_service/loopingcall.pyt	_idle_for¬s	R&R'(R/(R	RCR&R'RD((RCR	sM/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_service/loopingcall.pytstart«sN(	RRR
RR)R1RRRE(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_service/loopingcall.pyR?£st#FixedIntervalWithTimeoutLoopingCallcBs8eZdZedƒZedƒZdedd„ZRS(s>A fixed interval looping call with timeout checking mechanism.s^A fixed interval looping call with timeout checking and can only run one function at at a times2Fixed interval looping call with timeout checking.ics=tjƒ‰‡‡‡‡fd†}ˆj|d|d|ƒS(Ncs¨t|ˆdƒ}|dkrRtjˆjƒ}tjdi|d6|d6ƒntjƒˆ}ˆdkr“|ˆkr“ttdƒ|ƒ‚n|dkr¤|SdS(Niis@Function %(func_name)r run outlasted interval by %(delay).2f secRR@s*Looping call timed out after %.02f seconds(	RARR2RRRBttimeRR(R=R6R@Rtelapsed_time(RCR	t
start_timettimeout(sM/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_service/loopingcall.pyRDÅs		
R&R'(RGR/(R	RCR&R'RJRD((RCR	RIRJsM/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_service/loopingcall.pyREÁsN(	RRR
RR)R1RRRE(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_service/loopingcall.pyRF¸s
tDynamicLoopingCallcBsDeZdZedƒZedƒZedƒZdded„Z	RS(s˜A looping call which sleeps until the next known event.

    The function called should return how long to sleep for before being
    called again.
    sCA dynamic interval looping call can only run one function at a timesYA dynamic interval looping call should supply either an interval or periodic_interval_maxsDynamic interval looping callcs+‡‡fd†}ˆj|d|d|ƒS(Ncs[|}|dkr9ˆdk	r'ˆ}qWtˆjƒ‚nˆdk	rWt|ˆƒ}n|S(N(RR(t!_TASK_MISSING_SLEEP_VALUE_MESSAGEtmin(tsuggested_delayR6R@(tperiodic_interval_maxR	(sM/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_service/loopingcall.pyRDés	R&R'(R/(R	R&ROR'RD((ROR	sM/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_service/loopingcall.pyREçsN(
RRR
RR)RLR1RRRE(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_service/loopingcall.pyRK×s	tBackOffLoopingCallcBsYeZdZejƒZedƒZedƒZd	d„Z
d	dddddd„ZRS(
sÇRun a method in a loop with backoff on error.

    The passed in function should return True (no error, return to
    initial_interval),
    False (error, start backing off), or raise LoopingCallDone(retvalue=None)
    (quit looping, return retvalue if set).

    When there is an error, the call will backoff on each failure. The
    backoff will be equal to double the previous base interval times some
    jitter. If a backoff would put it over the timeout, it halts immediately,
    so the call will never take more than timeout, but may and likely will
    take less time.

    When the function return value is True or False, the interval will be
    multiplied by a random jitter. If min_jitter or max_jitter is None,
    there will be no jitter (jitter=1). If min_jitter is below 0.5, the code
    may not backoff and may increase its retry rate.

    If func constantly returns True, this function will not return.

    To run a func and wait for a call to finish (by raising a LoopingCallDone):

        timer = BackOffLoopingCall(func)
        response = timer.start().wait()

    :param initial_delay: delay before first running of function
    :param starting_interval: initial interval in seconds between calls to
                              function. When an error occurs and then a
                              success, the interval is returned to
                              starting_interval
    :param timeout: time in seconds before a LoopingCallTimeout is raised.
                    The call will never take longer than timeout, but may quit
                    before timeout.
    :param max_interval: The maximum interval between calls during errors
    :param jitter: Used to vary when calls are actually run to avoid group of
                   calls all coming at the exact same time. Uses
                   random.gauss(jitter, 0.1), with jitter as the mean for the
                   distribution. If set below .5, it can cause the calls to
                   come more rapidly after each failure.
    :param min_interval: The minimum interval in seconds between calls to
                         function.
    :raises: LoopingCallTimeout if time spent doing error retries would exceed
             timeout.
    s%Dynamic backoff interval looping callsKA dynamic backoff interval looping call can only run one function at a timecOs5tt|ƒjd|||Žd|_d|_dS(NRii(tsuperRPR
t_error_timet	_interval(R	RRR((sM/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_service/loopingcall.pyR
0s	ii,gè?gü©ñÒMbP?csdˆjdk	r!tˆjƒ‚ndˆ_ˆˆ_‡‡‡‡‡‡fd†}ˆj|d|ƒS(NicsÖtˆjjˆdƒƒ}|r>ˆˆ_dˆ_ˆj|Stˆjd|ˆƒ}t|ˆƒ}tˆjdˆˆƒˆ_ˆdkr¿ˆj|ˆkr¿ttdƒˆjƒ‚nˆj|7_|SdS(Ngš™™™™™¹?iis*Looping call timed out after %.02f seconds(	tabst_RNGtgaussRSRRtmaxRMRR(tsuccesst_elapsedt
random_jitterR0(tjittertmax_intervaltmin_intervalR	tstarting_intervalRJ(sM/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_service/loopingcall.pyRD>s			R&(R RR(R)RRRSR/(R	R&R^RJR\R[R]RD((R[R\R]R	R^RJsM/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_service/loopingcall.pyRE5s		N(RRR
trandomtSystemRandomRURR1R)RR
RE(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_service/loopingcall.pyRPýs,	tRetryDecoratorcBs,eZdZddddd„Zd„ZRS(sªDecorator for retrying a function upon suggested exceptions.

    The decorated function is retried for the given number of times, and the
    sleep time between the retries is incremented until max sleep time is
    reached. If the max retry count is set to -1, then the decorated function
    is invoked indefinitely until an exception is thrown, and the caught
    exception is not in the list of suggested exceptions.
    iÿÿÿÿi
i<cCs:||_||_||_||_d|_d|_dS(s¯Configure the retry object using the input params.

        :param max_retry_count: maximum number of times the given function must
                                be retried when one of the input 'exceptions'
                                is caught. When set to -1, it will be retried
                                indefinitely until an exception is thrown
                                and the caught exception is not in param
                                exceptions.
        :param inc_sleep_time: incremental time in seconds for sleep time
                               between retries
        :param max_sleep_time: max sleep time in seconds beyond which the sleep
                               time will not be incremented using param
                               inc_sleep_time. On reaching this threshold,
                               max_sleep_time will be used as the sleep time.
        :param exceptions: suggested exceptions for which the function must be
                           retried, if no exceptions are provided (the default)
                           then all exceptions will be reraised, and no
                           retrying will be triggered.
        iN(t_max_retry_countt_inc_sleep_timet_max_sleep_timet_exceptionst_retry_countt_sleep_time(R	tmax_retry_counttinc_sleep_timetmax_sleep_timet
exceptions((sM/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_service/loopingcall.pyR
cs					csLtjˆƒ‰‡‡‡fd†‰tjˆƒ‡‡‡fd†ƒ}|S(Nc
sd}y@ˆjr6tjdiˆd6ˆjd6ƒnˆ||Ž}Wn¹ˆjk
rtjƒ—}tjdˆƒˆjdkrLjjˆjkrÇtjdiˆjd6ˆjd6ˆd6ƒn1t|_	ˆjd7_ˆj
ˆj7_
ˆj
SWdQXnXt|ƒ‚dS(	Ns7Invoking %(func_name)s; retry count is %(retry_count)d.Rtretry_counts\Exception which is in the suggested list of exceptions occurred while invoking function: %s.iÿÿÿÿs†Cannot retry %(func_name)s upon suggested exception since retry count (%(retry_count)d) reached max retry count (%(max_retry_count)d).Rhi(
RRfRtdebugReRtsave_and_reraise_exceptionRbRtreraiseRgRcR(RRR=tctxt(RRR	(sM/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_service/loopingcall.pyt_func‚s,		
		

	csAtˆ||Ž}|jdˆjƒ}tjdˆƒ|jƒS(NROs"Waiting for function %s to return.(RKRERdRRmR#(RRtlooptevt(RqRR	(sM/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_service/loopingcall.pyR¢s(RR2tsixtwraps(R	RR((RqRRR	sM/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_service/loopingcall.pyt__call__s $((RRR
R
Rv(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_service/loopingcall.pyRaYs(R_R9RGteventletRRtoslo_logRtloggingt
oslo_utilsRRRRttoslo_service._i18nRt	getLoggerRRRRRRtobjectRR?RFRKRPRa(((sM/home/tvault/.virtenv/lib/python2.7/site-packages/oslo_service/loopingcall.pyt<module>s(		U&\