AlkantarClanX12

Your IP : 3.15.214.185


Current Path : /usr/lib64/python2.7/multiprocessing/
Upload File :
Current File : //usr/lib64/python2.7/multiprocessing/pool.pyo

�
{fc@sTdgZddlZddlZddlZddlZddlZddlmZmZm	Z	ddl
mZmZdZ
dZdZej�Zd�Zd	efd
��YZefed�Zdefd��YZd
efd��YZeZdefd��YZdefd��YZdefd��YZdefd��YZdS(tPooli����N(tProcesst	cpu_counttTimeoutError(tFinalizetdebugiiicCs
t|�S(N(tmap(targs((s,/usr/lib64/python2.7/multiprocessing/pool.pytmapstar@stMaybeEncodingErrorcBs)eZdZd�Zd�Zd�ZRS(sVWraps possible unpickleable errors, so they can be
    safely sent through the socket.cCsAt|�|_t|�|_tt|�j|j|j�dS(N(treprtexctvaluetsuperR	t__init__(tselfRR((s,/usr/lib64/python2.7/multiprocessing/pool.pyRKscCsd|j|jfS(Ns(Error sending result: '%s'. Reason: '%s'(RR(R((s,/usr/lib64/python2.7/multiprocessing/pool.pyt__str__Ps	cCsdt|�S(Ns<MaybeEncodingError: %s>(tstr(R((s,/usr/lib64/python2.7/multiprocessing/pool.pyt__repr__Ts(t__name__t
__module__t__doc__RRR(((s,/usr/lib64/python2.7/multiprocessing/pool.pyR	Gs		cCs�|j}|j}t|d�r>|jj�|jj�n|dk	rW||�nd}xI|dks~|r�||kr�y
|�}Wn"ttfk
r�t	d�PnX|dkr�t	d�Pn|\}	}
}}}
yt
|||
�f}Wntk
r}t|f}nXy||	|
|f�WnMtk
r�}t
||d�}t	d|�||	|
t|ff�nXd}}	}}}}
|d7}q`Wt	d|�dS(Nt_writeris)worker got EOFError or IOError -- exitingsworker got sentinel -- exitingis0Possible encoding error while sending result: %ssworker exiting after %d tasks(tputtgetthasattrRtcloset_readertNonetEOFErrortIOErrorRtTruet	ExceptiontFalseR	(tinqueuetoutqueuetinitializertinitargstmaxtasksRRt	completedttasktjobtitfuncRtkwdstresulttetwrapped((s,/usr/lib64/python2.7/multiprocessing/pool.pytworkerXs@		

!


cBseZdZeZddddd�Zd�Zd�Zd�Zd�Z	did�Z
dd�Zdd	�Zdd
�Z
didd�Zddd�Zed
��Zed��Zed��Zed��Zd�Zd�Zd�Zd�Zed��Zed��ZRS(sH
    Class which supports an async version of the `apply()` builtin
    cCs/|j�tj�|_i|_t|_||_||_||_|dkr|y
t
�}Wq|tk
rxd}q|Xn|dkr�td��n|dk	r�t
|d�r�td��n||_g|_|j�tjdtjd|f�|_t|j_t|j_|jj�tjdtjd|j|j|j|j|jf�|_t|j_t|j_|jj�tjdtjd|j|j|jf�|_ t|j _t|j _|j j�t!||j"d|j|j#|j|j|j|j|j |jfdd�|_$dS(	Nis&Number of processes must be at least 1t__call__sinitializer must be a callablettargetRtexitpriorityi(%t
_setup_queuestQueuet
_taskqueuet_cachetRUNt_statet_maxtasksperchildt_initializert	_initargsRRtNotImplementedErrort
ValueErrorRt	TypeErrort
_processest_poolt_repopulate_poolt	threadingtThreadRt_handle_workerst_worker_handlerRtdaemontstartt
_handle_taskst
_quick_putt	_outqueuet
_task_handlert_handle_resultst
_quick_gett_result_handlerRt_terminate_poolt_inqueuet
_terminate(Rt	processesR$R%tmaxtasksperchild((s,/usr/lib64/python2.7/multiprocessing/pool.pyR�sX
					


		
		
		
		
cCswt}xjttt|j���D]M}|j|}|jdk	r"td|�|j�t	}|j|=q"q"W|S(s�Cleanup after any worker processes which have exited due to reaching
        their specified lifetime.  Returns True if any workers were cleaned up.
        scleaning up worker %dN(
R!treversedtrangetlenRAtexitcodeRRtjoinR(RtcleanedR*R0((s,/usr/lib64/python2.7/multiprocessing/pool.pyt_join_exited_workers�s"

c
Cs�x�t|jt|j��D]�}|jdtd|j|j|j|j	|j
f�}|jj|�|jj
dd�|_t|_|j�td�qWdS(s�Bring the number of pool processes up to the specified number,
        for use after reaping workers which have exited.
        R2RRt
PoolWorkersadded workerN(RVR@RWRARR0RQRKR;R<R:tappendtnametreplaceRRGRHR(RR*tw((s,/usr/lib64/python2.7/multiprocessing/pool.pyRB�s#	
cCs|j�r|j�ndS(sEClean up any exited workers and start replacements for them.
        N(R[RB(R((s,/usr/lib64/python2.7/multiprocessing/pool.pyt_maintain_pool�scCsPddlm}|�|_|�|_|jjj|_|jjj|_	dS(Ni(tSimpleQueue(
tqueuesRbRQRKRtsendRJRtrecvRN(RRb((s,/usr/lib64/python2.7/multiprocessing/pool.pyR4�s
cCs|j|||�j�S(s1
        Equivalent of `apply()` builtin
        (tapply_asyncR(RR+RR,((s,/usr/lib64/python2.7/multiprocessing/pool.pytapply�scCs|j|||�j�S(s/
        Equivalent of `map()` builtin
        (t	map_asyncR(RR+titerablet	chunksize((s,/usr/lib64/python2.7/multiprocessing/pool.pyR�sics�|dkrQt|j��|jj��fd�t|�D��jf��Stj�||�}t|j��|jj�fd�t|�D��jf�d��D�SdS(sZ
        Equivalent of `itertools.imap()` -- can be MUCH slower than `Pool.map()`
        ic3s0|]&\}}�j|�|fifVqdS(N(t_job(t.0R*tx(R+R-(s,/usr/lib64/python2.7/multiprocessing/pool.pys	<genexpr>sc3s0|]&\}}�j|t|fifVqdS(N(RkR(RlR*Rm(R-(s,/usr/lib64/python2.7/multiprocessing/pool.pys	<genexpr>
scss"|]}|D]}|Vq
qdS(N((Rltchunktitem((s,/usr/lib64/python2.7/multiprocessing/pool.pys	<genexpr>sN(tIMapIteratorR7R6Rt	enumeratet_set_lengthRt
_get_tasks(RR+RiRjttask_batches((R+R-s,/usr/lib64/python2.7/multiprocessing/pool.pytimap�scs�|dkrQt|j��|jj��fd�t|�D��jf��Stj�||�}t|j��|jj�fd�t|�D��jf�d��D�SdS(sK
        Like `imap()` method but ordering of results is arbitrary
        ic3s0|]&\}}�j|�|fifVqdS(N(Rk(RlR*Rm(R+R-(s,/usr/lib64/python2.7/multiprocessing/pool.pys	<genexpr>sc3s0|]&\}}�j|t|fifVqdS(N(RkR(RlR*Rm(R-(s,/usr/lib64/python2.7/multiprocessing/pool.pys	<genexpr>scss"|]}|D]}|Vq
qdS(N((RlRnRo((s,/usr/lib64/python2.7/multiprocessing/pool.pys	<genexpr>!sN(tIMapUnorderedIteratorR7R6RRqRrRRs(RR+RiRjRt((R+R-s,/usr/lib64/python2.7/multiprocessing/pool.pytimap_unorderedscCsAt|j|�}|jj|jd|||fgdf�|S(s>
        Asynchronous equivalent of `apply()` builtin
        N(tApplyResultR7R6RRkR(RR+RR,tcallbackR-((s,/usr/lib64/python2.7/multiprocessing/pool.pyRf#s+cs�t|d�st|�}n|dkrhtt|�t|j�d�\}}|rh|d7}qhnt|�dkr�d}ntj|||�}t|j	|t|�|��|j
j�fd�t|�D�df��S(s<
        Asynchronous equivalent of `map()` builtin
        t__len__iiic3s0|]&\}}�j|t|fifVqdS(N(RkR(RlR*Rm(R-(s,/usr/lib64/python2.7/multiprocessing/pool.pys	<genexpr>=sN(
RtlistRtdivmodRWRARRst	MapResultR7R6RRq(RR+RiRjRytextraRt((R-s,/usr/lib64/python2.7/multiprocessing/pool.pyRh,s(	cCsotj�}xB|jtks6|jrP|jtkrP|j�tjd�qW|j	j
d�td�dS(Ng�������?sworker handler exiting(
RCtcurrent_threadR9R8R7t	TERMINATERattimetsleepR6RRR(tpooltthread((s,/usr/lib64/python2.7/multiprocessing/pool.pyREAs*
cCs
tj�}x�t|jd�D]q\}}d}d}	zGy�x�t|�D]�\}	}|jrmtd�Pny||�WqJtk
r�}
|d \}}y||j	|t
|
f�Wq�tk
r�q�XqJXqJW|r�td�||	d�nwPWn}tk
r|}
|r|d nd\}}||krX||j	|dt
|
f�n|r}td�||	d�q}nXWdd}}}XqWtd�y@td�|jd�td	�x|D]}|d�q�WWnt
k
r�td
�nXtd�dS(
Ni����s'task handler found thread._state != RUNisdoing set_length()iistask handler got sentinels/task handler sending sentinel to result handlers(task handler sending sentinel to workerss/task handler got IOError when sending sentinelsstask handler exiting(ii(RCRtiterRRRqR9RR t_setR!tKeyErrorRR(t	taskqueueRR#R�tcacheR�ttaskseqt
set_lengthR(R*R.R)tindtextp((s,/usr/lib64/python2.7/multiprocessing/pool.pyRINsR	


!






cCs�tj�}x�y
|�}Wn"ttfk
r@td�dSX|jrXtd�Pn|dkrrtd�Pn|\}}}y||j||�Wntk
r�nXd}}}qWx�|rq|jt	krqy
|�}Wn"ttfk
rtd�dSX|dkr%td�q�n|\}}}y||j||�Wntk
r_nXd}}}q�Wt
|d�r�td�y5x.td�D] }|jj
�s�Pn|�q�WWq�ttfk
r�q�Xntdt|�|j�dS(	Ns.result handler got EOFError/IOError -- exitings,result handler found thread._state=TERMINATEsresult handler got sentinels&result handler ignoring extra sentinelRs"ensuring that outqueue is not fulli
s7result handler exiting: len(cache)=%s, thread._state=%s(RCRRRRR9RR�R�R�RRVRtpollRW(R#RR�R�R(R)R*tobj((s,/usr/lib64/python2.7/multiprocessing/pool.pyRM�sZ

	







ccsDt|�}x1ttj||��}|s1dS||fVqWdS(N(R�ttuplet	itertoolstislice(R+tittsizeRm((s,/usr/lib64/python2.7/multiprocessing/pool.pyRs�scCstd��dS(Ns:pool objects cannot be passed between processes or pickled(R=(R((s,/usr/lib64/python2.7/multiprocessing/pool.pyt
__reduce__�scCs5td�|jtkr1t|_t|j_ndS(Nsclosing pool(RR9R8tCLOSERF(R((s,/usr/lib64/python2.7/multiprocessing/pool.pyR�s
	cCs-td�t|_t|j_|j�dS(Nsterminating pool(RR�R9RFRR(R((s,/usr/lib64/python2.7/multiprocessing/pool.pyt	terminate�s
	cCsStd�|jj�|jj�|jj�x|jD]}|j�q;WdS(Nsjoining pool(RRFRYRLRORA(RR�((s,/usr/lib64/python2.7/multiprocessing/pool.pyRY�s



cCsWtd�|jj�x9|j�rR|jj�rR|jj�tjd�qWdS(Ns7removing tasks from inqueue until task handler finishedi(	Rt_rlocktacquiretis_aliveRR�ReR�R�(R"ttask_handlerR�((s,/usr/lib64/python2.7/multiprocessing/pool.pyt_help_stuff_finish�s



c	
Cs�td�t|_t|_td�|j||t|��t|_|jd�td�tj�|k	r�|j	d�n|r�t
|dd�r�td�x-|D]"}	|	jdkr�|	j�q�q�Wntd�tj�|k	r|j	d�ntd	�tj�|k	r,|j	d�n|r�t
|dd�r�td
�x;|D]0}	|	j
�rVtd|	j�|	j	�qVqVWndS(Nsfinalizing pools&helping task handler/workers to finishsjoining worker handlerg}Ô%�I�TiR�sterminating workerssjoining task handlersjoining result handlersjoining pool workersscleaning up worker %d(RR�R9R�RWRRRCRRYRRXR�R�tpid(
tclsR�R"R#R�tworker_handlerR�tresult_handlerR�R�((s,/usr/lib64/python2.7/multiprocessing/pool.pyRP�s6
		
	







N((((RRRRRRR[RBRaR4RgRRuRwRfRhtstaticmethodRERIRMRsR�RR�RYR�tclassmethodRP(((s,/usr/lib64/python2.7/multiprocessing/pool.pyR�s0	:					
4<							RxcBsDeZd�Zd�Zd�Zdd�Zdd�Zd�ZRS(cCsStjtj��|_tj�|_||_t|_	||_
|||j<dS(N(RCt	ConditiontLockt_condtjob_countertnextRkR7R!t_readyt	_callback(RR�Ry((s,/usr/lib64/python2.7/multiprocessing/pool.pyRs			cCs|jS(N(R�(R((s,/usr/lib64/python2.7/multiprocessing/pool.pytready&scCs|jS(N(t_success(R((s,/usr/lib64/python2.7/multiprocessing/pool.pyt
successful)scCsB|jj�z |js,|jj|�nWd|jj�XdS(N(R�R�R�twaittrelease(Rttimeout((s,/usr/lib64/python2.7/multiprocessing/pool.pyR�-s

	cCs<|j|�|jst�n|jr/|jS|j�dS(N(R�R�RR�t_value(RR�((s,/usr/lib64/python2.7/multiprocessing/pool.pyR5s
			cCs�|\|_|_|jr7|jr7|j|j�n|jj�zt|_|jj�Wd|jj�X|j	|j
=dS(N(R�R�R�R�R�RR�tnotifyR�R7Rk(RR*R�((s,/usr/lib64/python2.7/multiprocessing/pool.pyR�>s
	N(	RRRR�R�RR�RR�(((s,/usr/lib64/python2.7/multiprocessing/pool.pyRxs				R}cBseZd�Zd�ZRS(cCstj|||�t|_dg||_||_|dkr`d|_t|_||j	=n||t
||�|_dS(Ni(RxRRR�RR�t
_chunksizet_number_leftR�Rktbool(RR�RjtlengthRy((s,/usr/lib64/python2.7/multiprocessing/pool.pyRRs				
cCs|\}}|r�||j||j|d|j+|jd8_|jdkr|jrn|j|j�n|j|j=|jj�zt|_	|jj
�Wd|jj�XqnWt|_
||_|j|j=|jj�zt|_	|jj
�Wd|jj�XdS(Nii(R�R�R�R�R7RkR�R�RR�R�R�R!R�(RR*tsuccess_resulttsuccessR-((s,/usr/lib64/python2.7/multiprocessing/pool.pyR�^s*"	

			

	(RRRR�(((s,/usr/lib64/python2.7/multiprocessing/pool.pyR}Ps	RpcBs>eZd�Zd�Zdd�ZeZd�Zd�ZRS(cCsktjtj��|_tj�|_||_tj	�|_
d|_d|_
i|_|||j<dS(Ni(RCR�R�R�R�R�RkR7tcollectionstdequet_itemst_indexRt_lengtht	_unsorted(RR�((s,/usr/lib64/python2.7/multiprocessing/pool.pyRs				cCs|S(N((R((s,/usr/lib64/python2.7/multiprocessing/pool.pyt__iter__�scCs�|jj�z�y|jj�}Wn�tk
r�|j|jkrNt�n|jj|�y|jj�}Wq�tk
r�|j|jkr�t�nt	�q�XnXWd|jj
�X|\}}|r�|S|�dS(N(R�R�R�tpopleftt
IndexErrorR�R�t
StopIterationR�RR�(RR�RoR�R((s,/usr/lib64/python2.7/multiprocessing/pool.pyR��s&

	
	cCs�|jj�z�|j|kr�|jj|�|jd7_xJ|j|jkr�|jj|j�}|jj|�|jd7_qAW|jj�n
||j|<|j|jkr�|j	|j
=nWd|jj�XdS(Ni(R�R�R�R�R]R�tpopR�R�R7RkR�(RR*R�((s,/usr/lib64/python2.7/multiprocessing/pool.pyR��s

cCs^|jj�z<||_|j|jkrH|jj�|j|j=nWd|jj�XdS(N(R�R�R�R�R�R7RkR�(RR�((s,/usr/lib64/python2.7/multiprocessing/pool.pyRr�s
	
N(	RRRR�RR�t__next__R�Rr(((s,/usr/lib64/python2.7/multiprocessing/pool.pyRp}s	
		RvcBseZd�ZRS(cCst|jj�zR|jj|�|jd7_|jj�|j|jkr^|j|j=nWd|jj	�XdS(Ni(
R�R�R�R]R�R�R�R7RkR�(RR*R�((s,/usr/lib64/python2.7/multiprocessing/pool.pyR��s

(RRR�(((s,/usr/lib64/python2.7/multiprocessing/pool.pyRv�st
ThreadPoolcBsBeZddlmZdddd�Zd�Zed��ZRS(i(RcCstj||||�dS(N(RR(RRSR$R%((s,/usr/lib64/python2.7/multiprocessing/pool.pyR�scCs@tj�|_tj�|_|jj|_|jj|_dS(N(R5RQRKRRJRRN(R((s,/usr/lib64/python2.7/multiprocessing/pool.pyR4�scCsW|jj�z5|jj�|jjdg|�|jj�Wd|jj�XdS(N(t	not_emptyR�tqueuetcleartextendRt
notify_allR�(R"R�R�((s,/usr/lib64/python2.7/multiprocessing/pool.pyR��s

N((	RRtdummyRRRR4R�R�(((s,/usr/lib64/python2.7/multiprocessing/pool.pyR��s	(t__all__RCR5R�R�R�tmultiprocessingRRRtmultiprocessing.utilRRR8R�R�tcountR�RR R	RR0tobjectRRxtAsyncResultR}RpRvR�(((s,/usr/lib64/python2.7/multiprocessing/pool.pyt<module>#s,		,��.-I