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@s_ddlZddlZddlmZddlmZddlZddl	m
Zddlm
Z
ddlmZddlmZejZejZdefd	„ƒYZejZd
efd„ƒYZdejfd
„ƒYZdejfd„ƒYZdejfd„ƒYZdefd„ƒYZdejfd„ƒYZdefd„ƒYZdS(iÿÿÿÿN(tfutures(tprocess(tqueue(t_green(t_thread(t_utilstRejectedSubmissioncBseZdZRS(sEException raised when a submitted call is rejected (for some reason).(t__name__t
__module__t__doc__(((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyR#st	_GatherercBs>eZed„Zed„ƒZd„Zd„Zd„ZRS(cCs.||_|ƒ|_tƒ|_||_dS(N(t_submit_funct_stats_locktExecutorStatisticst_statst_start_before_submit(tselftsubmit_functlock_factorytstart_before_submit((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyt__init__,s	cCs|jS(N(R(R((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyt
statistics2scCs |jtƒ|_WdQXdS(N(RR
R(R((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pytclear6s
c
CsÓtdtjƒ|ƒ}|j«|jj|jj|jj|jjf\}}}}|jƒrr|d7}n3|d7}|j	ƒdk	r›|d7}n||7}td|d|d|d|ƒ|_WdQXdS(s®Capture statistics

        :param started_at: when the activity the future has performed
                           was started at
        :param fut: future object
        gitfailurestexecutedtruntimet	cancelledN(tmaxRtnowRRRRRRt	exceptiontNoneR
(Rt
started_attfuttelapsedRRRR((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyt_capture_stats:s 	
			



cOse|jrtjƒ}n|j|||Ž}|jsEtjƒ}n|jtj|j|ƒƒ|S(s2Submit work to be executed and capture statistics.(RRRRtadd_done_callbackt	functoolstpartialR"(RtfntargstkwargsRR ((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pytsubmit[s		
(	RRtFalseRtpropertyRRR"R)(((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyR
+s
		!tThreadPoolExecutorcBsneZdZejƒZddd„Zed„ƒZ	ed„ƒZ
d„Zed„Z
d„Zd„ZRS(	sÛExecutor that uses a thread pool to execute calls asynchronously.

    It gathers statistics about the submissions executed for post-analysis...

    See: https://docs.python.org/dev/library/concurrent.futures.html
    cCs |dkrtjƒ}n|dkr6tdƒ‚n||_tjƒ|_tj	ƒ|_
t|_g|_
|p{d„|_t|j|jjƒ|_dS(sÅInitializes a thread pool executor.

        :param max_workers: maximum number of workers that can be
                            simultaneously active at the same time, further
                            submitted work will be queued up when this limit
                            is reached.
        :type max_workers: int
        :param check_and_reject: a callback function that will be provided
                                 two position arguments, the first argument
                                 will be this executor instance, and the second
                                 will be the number of currently queued work
                                 items in this executors backlog; the callback
                                 should raise a :py:class:`.RejectedSubmission`
                                 exception if it wants to have this submission
                                 rejected.
        :type check_and_reject: callback
        is%Max workers must be greater than zerocSsdS(N(R(tetwaiting((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyt<lambda>ŒsN(RRtget_optimal_thread_countt
ValueErrort_max_workerstcompat_queuetQueuet_work_queuet	threadingtRLockt_shutdown_lockR*t	_shutdownt_workerst_check_and_rejectR
t_submittlock_objectt	_gatherer(Rtmax_workerstcheck_and_reject((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyRqs			cCs
|jjS(s<:class:`.ExecutorStatistics` about the executors executions.(R>R(R((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyRscCs|jS(s6Accessor to determine if the executor is alive/active.(R9(R((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pytalive”scCs[|js"t|jƒ|jkrWtjj||jƒ}|jj|ƒ|jƒndS(sSpin up a worker if needed.N(	R:tlenR2RtThreadWorkertcreate_and_registerR5tappendtstart(Rtw((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyt_maybe_spin_up™s
	cCsq|j8|js=t|_x|jD]}|jƒq&WnWdQX|rmx!|jD]}tj|ƒqSWndS(N(R8R9tTrueR:tstopRtjoin_thread(RtwaitRG((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pytshutdown¦s
		cOs9tƒ}|jƒ|jjtj||||ƒƒ|S(N(tFutureRHR5tputRtWorkItem(RR&R'R(tf((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyR<°s	
"cOs[|jL|jr"tdƒ‚n|j||jjƒƒ|jj|||ŽSWdQXdS(s8Submit some work to be executed (and gather statistics).s1Can not schedule new futures after being shutdownN(R8R9tRuntimeErrorR;R5tqsizeR>R)(RR&R'R(((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyR)¶s

	N(RRR	Rt	ThreadingR6RRR+RRARHRIRMR<R)(((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyR,gs	

	tProcessPoolExecutorcBsMeZdZejƒZdd„Zed„ƒZ	ed„ƒZ
d„ZRS(sÜExecutor that uses a process pool to execute calls asynchronously.

    It gathers statistics about the submissions executed for post-analysis...

    See: https://docs.python.org/dev/library/concurrent.futures.html
    cCsz|dkrtjƒ}ntt|ƒjd|ƒ|jdkrRtdƒ‚nttt|ƒj	|j
jƒ|_dS(NR?is%Max workers must be greater than zero(
RRR0tsuperRURR2R1R
R)R6R=R>(RR?((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyRÊscCs|jS(s6Accessor to determine if the executor is alive/active.(t_shutdown_thread(R((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyRA×scCs
|jjS(s<:class:`.ExecutorStatistics` about the executors executions.(R>R(R((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyRÜscOs|jj|||ŽS(s8Submit some work to be executed (and gather statistics).(R>R)(RR&R'R(((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyR)ásN(RRR	RRTR6RRR+RARR)(((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyRUÀs
tSynchronousExecutorcBsqeZdZejƒZed„d„Zed„ƒZ	e
d„Zd„Zed„ƒZ
d„Zd„ZRS(	sŠExecutor that uses the caller to execute calls synchronously.

    This provides an interface to a caller that looks like an executor but
    will execute the calls inside the caller thread instead of executing it
    in a external process/thread for when this type of functionality is
    useful to provide...

    It gathers statistics about the submissions executed for post-analysis...
    cCs
|jƒS(N(trun(twork((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyR/óscCs¤|rtjrtdƒ‚ntj|ƒs=tdƒ‚n||_t|_|rmt	j
|_
t|_n	t
|_||_t|j|j
jdtƒ|_dS(sÓSynchronous executor constructor.

        :param green: when enabled this forces the usage of greened lock
                      classes and green futures (so that the internals of this
                      object operate correctly under eventlet)
        :type green: bool
        :param run_work_func: callable that takes a single work item and
                              runs it (typically in a blocking manner)
        :param run_work_func: callable
        s6Eventlet is needed to use a green synchronous executors*Run work parameter expected to be callableRN(RtEVENTLET_AVAILABLERRtsixtcallableR1t_run_work_funcR*t_shutoffRR6tGreenFuturet_future_clsRNR
R<R=RIR>(Rtgreent
run_work_func((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyRós					cCs|jS(s6Accessor to determine if the executor is alive/active.(R_(R((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyRAscCs
t|_dS(N(RIR_(RRL((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyRMscCs&|jr"t|_|jjƒndS(sˆRestarts this executor (*iff* previously shutoff/shutdown).

        NOTE(harlowja): clears any previously gathered statistics.
        N(R_R*R>R(R((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pytrestarts		cCs
|jjS(s<:class:`.ExecutorStatistics` about the executors executions.(R>R(R((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyR scOs.|jrtdƒ‚n|jj|||ŽS(s8Submit some work to be executed (and gather statistics).s1Can not schedule new futures after being shutdown(R_RRR>R)(RR&R'R(((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyR)%s	cOs/|jƒ}|jtj||||ƒƒ|S(N(RaR^RRP(RR&R'R(R ((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyR<,s(RRR	RRTR6R*RR+RARIRMRdRR)R<(((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyRXæs				R`cBseZejZd„ZRS(cCsStt|ƒjƒtjs+tdƒ‚ntjdƒsOtjj	ƒ|_
ndS(Ns(Eventlet is needed to use a green futuretthread(RVR`RRR[RRRtis_monkey_patchedR6tcondition_objectt
_condition(R((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyR5s
	(RRRNR	R(((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyR`2s	tGreenThreadPoolExecutorcBskeZdZejZdd	d„Zed„ƒZed„ƒZ	d„Z
d„Zd„Ze
d„ZRS(
s?Executor that uses a green thread pool to execute calls asynchronously.

    See: https://docs.python.org/dev/library/concurrent.futures.html
    and http://eventlet.net/doc/modules/greenpool.html for information on
    how this works.

    It gathers statistics about the submissions executed for post-analysis...
    iècCs¬tjstdƒ‚n|dkr3tdƒ‚n||_tj|jƒ|_tjƒ|_	|pld„|_
|jjƒ|_
t|_t|j|jjƒ|_dS(sËInitializes a green thread pool executor.

        :param max_workers: maximum number of workers that can be
                            simulatenously active at the same time, further
                            submitted work will be queued up when this limit
                            is reached.
        :type max_workers: int
        :param check_and_reject: a callback function that will be provided
                                 two position arguments, the first argument
                                 will be this executor instance, and the second
                                 will be the number of currently queued work
                                 items in this executors backlog; the callback
                                 should raise a :py:class:`.RejectedSubmission`
                                 exception if it wants to have this submission
                                 rejected.
        :type check_and_reject: callback
        s*Eventlet is needed to use a green executoris%Max workers must be greater than zerocSsdS(N(R(R-R.((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyR/gsN(RR[RRR1R2RtPoolt_poolR4t
_delayed_workR;R6R=R8R*R9R
R<R>(RR?R@((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyRNs				cCs|jS(s6Accessor to determine if the executor is alive/active.(R9(R((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyRAmscCs
|jjS(s<:class:`.ExecutorStatistics` about the executors executions.(R>R(R((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyRrscOs[|jL|jr"tdƒ‚n|j||jjƒƒ|jj|||ŽSWdQXdS(sÔSubmit some work to be executed (and gather statistics).

        :param args: non-keyworded arguments
        :type args: list
        :param kwargs: key-value arguments
        :type kwargs: dictionary
        s1Can not schedule new futures after being shutdownN(R8R9RRR;RlRSR>R)(RR&R'R(((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyR)ws

	cOsGtƒ}tj||||ƒ}|j|ƒsC|jj|ƒn|S(N(R`RRPt_spin_upRlRO(RR&R'R(RQRZ((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyR<†s
	cCsR|jjƒ|jjƒ}||jkrN|jjtj||jƒƒtSt	S(sÆSpin up a greenworker if less than max_workers.

        :param work: work to be given to the greenworker
        :returns: whether a green worker was spun up or not
        :rtype: boolean
        (
RktrunningR.R2tspawn_nRtGreenWorkerRlRIR*(RRZRA((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyRms
cCs^|j&|js%t|_t}nt}WdQX|rZ|rZ|jjƒ|jjƒndS(N(R8R9RIR*RltjoinRktwaitall(RRLtshutoff((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyRMšs
			
N(RRR	RR6RRR+RARR)R<RmRIRM(((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyRiBs				
R
cBseZdZddddgZdZddddd„Zed	„ƒZed
„ƒZed„ƒZ	ed„ƒZ
ed
„ƒZd„ZRS(s;Holds *immutable* information about a executors executions.t	_failurest	_executedt_runtimet
_cancelledsŠ<ExecutorStatistics object at 0x%(ident)x (failures=%(failures)s, executed=%(executed)s, runtime=%(runtime)0.2f, cancelled=%(cancelled)s)>igcCs(||_||_||_||_dS(N(RtRuRvRw(RRRRR((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyR°s			cCs|jS(s•How many submissions ended up raising exceptions.

        :returns: how many submissions ended up raising exceptions
        :rtype: number
        (Rt(R((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyR¶scCs|jS(s‰How many submissions were executed (failed or not).

        :returns: how many submissions were executed
        :rtype: number
        (Ru(R((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyR¿scCs|jS(s—Total runtime of all submissions executed (failed or not).

        :returns: total runtime of all submissions executed
        :rtype: number
        (Rv(R((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyRÈscCs|jS(sHow many submissions were cancelled before executing.

        :returns: how many submissions were cancelled before executing
        :rtype: number
        (Rw(R((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyRÑscCs|j|jS(sÔThe average runtime of all submissions executed.

        :returns: average runtime of all submissions executed
        :rtype: number
        :raises: ZeroDivisionError when no executions have occurred.
        (RvRu(R((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pytaverage_runtimeÚscCs@|jit|ƒd6|jd6|jd6|jd6|jd6S(NtidentRRRR(t
_REPR_MSG_TPLtidRtRuRvRw(R((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyt__repr__äs	



(
RRR	t	__slots__RzRR+RRRRRxR|(((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyR
¦s				
(R$R6t
concurrentRt_futurestconcurrent.futuresRt_processR\t	six.movesRR3tfuturistRRRtTimeoutErrortCancelledErrort	ExceptionRRNtobjectR
tExecutorR,RURXR`RiR
(((sF/home/tvault/.virtenv/lib/python2.7/site-packages/futurist/_futures.pyt<module>s&			<Y&Ld