AlkantarClanX12

Your IP : 18.225.195.153


Current Path : /opt/alt/python38/lib64/python3.8/concurrent/futures/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/concurrent/futures/__pycache__/process.cpython-38.opt-2.pyc

U

i�fzn�@s�dZddlZddlZddlmZddlZddlmZddlZddl	Zddl
mZddlZddl
Z
ddlmZddlZddlZddlZe
��ZdaGdd	�d	�Zd
d�ZdZd
ZGdd�de�ZGdd�d�Zdd�ZGdd�de�ZGdd�de�Z Gdd�de�Z!Gdd�de�Z"dd�Z#dd�Z$d0d d!�Z%d"d#�Z&d$d%�Z'd&d'�Z(da)da*d(d)�Z+d*d+�Z,Gd,d-�d-ej-�Z.Gd.d/�d/ej/�Z0e�1e�dS)1z"Brian Quinlan (brian@sweetapp.com)�N)�_base)�Full)�Queue)�partialFc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�
_ThreadWakeupcCstjdd�\|_|_dS)NF)Zduplex)�mpZPipe�_reader�_writer��self�r�?/opt/alt/python38/lib64/python3.8/concurrent/futures/process.py�__init__Rsz_ThreadWakeup.__init__cCs|j��|j��dS�N)r	�closerr
rrr
rUs
z_ThreadWakeup.closecCs|j�d�dS)N�)r	Z
send_bytesr
rrr
�wakeupYsz_ThreadWakeup.wakeupcCs|j��r|j��qdSr)rZpollZ
recv_bytesr
rrr
�clear\s
z_ThreadWakeup.clearN)�__name__�
__module__�__qualname__rrrrrrrr
rQsrcCs@datt���}|D]\}}|��q|D]\}}|��q*dS�NT)�_global_shutdown�list�_threads_wakeups�itemsr�join)r�_�
thread_wakeup�trrr
�_python_exitas
r ��=c@seZdZdd�Zdd�ZdS)�_RemoteTracebackcCs
||_dSr��tb)rr%rrr
rzsz_RemoteTraceback.__init__cCs|jSrr$r
rrr
�__str__|sz_RemoteTraceback.__str__N)rrrrr&rrrr
r#ysr#c@seZdZdd�Zdd�ZdS)�_ExceptionWithTracebackcCs0t�t|�||�}d�|�}||_d||_dS)N�z

"""
%s""")�	traceback�format_exception�typer�excr%)rr,r%rrr
r�s
z _ExceptionWithTraceback.__init__cCst|j|jffSr)�_rebuild_excr,r%r
rrr
�
__reduce__�sz"_ExceptionWithTraceback.__reduce__N)rrrrr.rrrr
r'sr'cCst|�|_|Sr)r#�	__cause__)r,r%rrr
r-�s
r-c@seZdZdd�ZdS)�	_WorkItemcCs||_||_||_||_dSr)�future�fn�args�kwargs)rr1r2r3r4rrr
r�sz_WorkItem.__init__N�rrrrrrrr
r0�sr0c@seZdZddd�ZdS)�_ResultItemNcCs||_||_||_dSr)�work_id�	exception�result)rr7r8r9rrr
r�sz_ResultItem.__init__)NNr5rrrr
r6�sr6c@seZdZdd�ZdS)�	_CallItemcCs||_||_||_||_dSr)r7r2r3r4)rr7r2r3r4rrr
r�sz_CallItem.__init__Nr5rrrr
r:�sr:cs*eZdZd�fdd�	Z�fdd�Z�ZS)�
_SafeQueuercs||_t�j||d�dS)N)�ctx)�pending_work_items�superr)r�max_sizer<r=��	__class__rr
r�sz_SafeQueue.__init__cslt|t�rZt�t|�||j�}td�d�|���|_	|j
�|jd�}|dk	rh|j
�|�nt��||�dS)Nz

"""
{}"""r()�
isinstancer:r)r*r+�
__traceback__r#�formatrr/r=�popr7r1�
set_exceptionr>�_on_queue_feeder_error)r�e�objr%�	work_itemr@rr
rG�s
z!_SafeQueue._on_queue_feeder_error)r)rrrrrG�
__classcell__rrr@r
r;�sr;cgs,t|�}tt�||��}|s dS|VqdSr)�zip�tuple�	itertools�islice)�	chunksize�	iterables�it�chunkrrr
�_get_chunks�s
rTcs�fdd�|D�S)Ncsg|]}�|��qSrr)�.0r3�r2rr
�
<listcomp>�sz"_process_chunk.<locals>.<listcomp>r)r2rSrrVr
�_process_chunk�s	rXc
Cs^z|�t|||d��Wn@tk
rX}z"t||j�}|�t||d��W5d}~XYnXdS)N)r9r8�r8)�putr6�
BaseExceptionr'rC)�result_queuer7r9r8rHr,rrr
�_sendback_result�s
�r]c
Cs�|dk	r<z||�Wn&tk
r:tjjddd�YdSX|jdd�}|dkrb|�t���dSz|j|j	|j
�}Wn>tk
r�}z t||j�}t
||j|d�W5d}~XYnXt
||j|d�~~q<dS)NzException in initializer:T)�exc_info��blockrY)r9)r[rZLOGGERZcritical�getrZ�os�getpidr2r3r4r'rCr]r7)�
call_queuer\�initializer�initargsZ	call_item�rrHr,rrr
�_process_worker�s$
"rhcCsv|��rdSz|jdd�}Wntjk
r4YdSX||}|j��rh|jt||j|j	|j
�dd�q||=qqdS)NFr_T)Zfullra�queueZEmptyr1Zset_running_or_notify_cancelrZr:r2r3r4)r=Zwork_idsrdr7rJrrr
�_add_call_item_to_queue�s"
��rjc
s>d��fdd�}��fdd�}|j}	|j}
|	|
g}t||��dd����D�}tj�||�}
d}d}|	|
kr�z|	��}d}Wq�tk
r�}zt�	t
|�||j�}W5d}~XYq�Xn|
|
kr�d}d}|��|�rl|���dk	r�d	�_
d�_d�td
�}|dk	�r tdd�|��d
��|_|��D]\}}|j�|�~�q(|�����D]}|���qR|�dSt|t��r���|�}|����s�|�dSnL|dk	�r�|�|jd�}|dk	�r�|j�r�|j�|j�n|j�|j�~~|��|��r4z&�dk	�rd�_|�s|�WdSWntk
�r2YnXd�q2dS)Ncstp�dkp�jSr)r�_shutdown_threadr)�executorrr
�
shutting_down@s�z/_queue_management_worker.<locals>.shutting_downc	s�tdd����D��}|}d}||kr�|dkr�t||�D]6}z��d�|d7}Wq:tk
rnYqrYq:Xq:tdd����D��}q������D]}|��q�dS)Ncss|]}|��VqdSr�Zis_alive�rU�prrr
�	<genexpr>FszD_queue_management_worker.<locals>.shutdown_worker.<locals>.<genexpr>rr!css|]}|��VqdSrrnrorrr
rqRs)�sum�values�rangeZ
put_nowaitrrr)Zn_children_aliveZn_children_to_stopZn_sentinels_sent�irp)rd�	processesrr
�shutdown_workerDs
z1_queue_management_worker.<locals>.shutdown_workercSsg|]
}|j�qSr)�sentinelrorrr
rWisz,_queue_management_worker.<locals>.<listcomp>TFzKA child process terminated abruptly, the process pool is not usable anymorez^A process in the process pool was terminated abruptly while the future was running or pending.z
'''
r(z''')rrjrsrZ
connection�waitZrecvr[r)r*r+rCr�_brokenrk�BrokenProcessPoolr#rr/rr1rFZ	terminaterB�intrEr7r8Z
set_resultr9r)Zexecutor_referencervr=Zwork_ids_queuerdr\rrmrwZ
result_readerZ
wakeup_readerZreadersZworker_sentinelsZready�causeZ	is_brokenZresult_itemrHZbper7rJrpr)rdrlrvr
�_queue_management_worker"s��	(
�




r~c	Csjtrtrtt��dazt�d�}Wnttfk
r<YdSX|dkrJdS|dkrVdSd|att��dS)NT�SC_SEM_NSEMS_MAX����z@system provides too few semaphores (%d available, 256 necessary))�_system_limits_checked�_system_limited�NotImplementedErrorrb�sysconf�AttributeError�
ValueError)Z	nsems_maxrrr
�_check_system_limits�s �r�ccs&|D]}|��|r|��VqqdSr)�reverserE)�iterableZelementrrr
�_chain_from_iterable_of_lists�sr�c@seZdZdS)r{N)rrrrrrr
r{�sr{csteZdZddd�Zdd�Zdd�Zd	d
�Zejjj	e_	ejjj
e_
ddd��fd
d�
Zddd�Zejjj
e_
�Z
S)�ProcessPoolExecutorNrcCst�|dkr6t��pd|_tjdkrntt|j�|_n8|dkrHtd��n tjdkrh|tkrhtdt����||_|dkr~t	�
�}||_|dk	r�t|�s�t
d��||_||_d|_i|_d|_t��|_d|_d|_i|_|jt}t||j|jd�|_d	|j_|��|_t� �|_!t"�|_#dS)
Nr!Zwin32rz"max_workers must be greater than 0zmax_workers must be <= zinitializer must be a callableF)r?r<r=T)$r�rb�	cpu_count�_max_workers�sys�platform�min�_MAX_WINDOWS_WORKERSr�rZget_context�_mp_context�callable�	TypeError�_initializer�	_initargs�_queue_management_thread�
_processesrk�	threadingZLock�_shutdown_lockrz�_queue_count�_pending_work_items�EXTRA_QUEUED_CALLSr;�_call_queueZ
_ignore_epipeZSimpleQueue�
_result_queuerir�	_work_idsr�_queue_management_thread_wakeup)rZmax_workersZ
mp_contextrerfZ
queue_sizerrr
r�sP

�

��

�

zProcessPoolExecutor.__init__c	Csv|jdkrr|jfdd�}|��tjtt�||�|j|j	|j
|j|j|jfdd�|_d|j_
|j��|jt|j<dS)NcSstj�d�|��dS)Nz?Executor collected: triggering callback for QueueManager wakeup)r�util�debugr)rrrrr
�
weakref_cbBszFProcessPoolExecutor._start_queue_management_thread.<locals>.weakref_cbZQueueManagerThread)�targetr3�nameT)r�r��_adjust_process_countr�ZThreadr~�weakref�refr�r�r�r�r�Zdaemon�startr)rr�rrr
�_start_queue_management_thread=s(
�

��

�z2ProcessPoolExecutor._start_queue_management_threadcCsPtt|j�|j�D]8}|jjt|j|j|j	|j
fd�}|��||j|j<qdS)N)r�r3)
rt�lenr�r�r�ZProcessrhr�r�r�r�r��pid)rrrprrr
r�Xs��z)ProcessPoolExecutor._adjust_process_countc
Os
t|�dkr|^}}}nV|s&td��nHd|krZ|�d�}|^}}ddl}|jdtdd�ntdt|�d��|j��|jr�t|j��|j	r�t
d	��tr�t
d
��t�
�}t||||�}||j|j<|j�|j�|jd7_|j��|��|W5QR�SQRXdS)N�zEdescriptor 'submit' of 'ProcessPoolExecutor' object needs an argumentr2rz.Passing 'fn' as keyword argument is deprecated)�
stacklevelz6submit expected at least 1 positional argument, got %dr!z*cannot schedule new futures after shutdownz6cannot schedule new futures after interpreter shutdown)r�r�rE�warnings�warn�DeprecationWarningr�rzr{rk�RuntimeErrorrrZFuturer0r�r�r�rZr�rr�)r3r4rr2r��f�wrrr
�submitcs<

�
�

zProcessPoolExecutor.submitr!)�timeoutrPcs:|dkrtd��t�jtt|�t|d|i�|d�}t|�S)Nr!zchunksize must be >= 1.rP)r�)r�r>�maprrXrTr�)rr2r�rPrQZresultsr@rr
r��s�zProcessPoolExecutor.mapTc	Cs�|j�d|_W5QRX|jr6|j��|r6|j��d|_|jdk	rd|j��|r^|j��d|_d|_	d|_
|jr�|j��d|_dSr)r�rkr�r�rrr�rZjoin_threadr�r�)rryrrr
�shutdown�s"





zProcessPoolExecutor.shutdown)NNNr)T)rrrrr�r�r�r�Executor�__text_signature__�__doc__r�r�rKrrr@r
r��s�
K$
r�)NN)2�
__author__�atexitrbZconcurrent.futuresrrirZmultiprocessingrZmultiprocessing.connectionZmultiprocessing.queuesrr�r��	functoolsrrNr�r)�WeakKeyDictionaryrrrr r�r��	Exceptionr#r'r-�objectr0r6r:r;rTrXr]rhrjr~r�r�r�r�ZBrokenExecutorr{r�r��registerrrrr
�<module>.sT
		

)&!P