AlkantarClanX12

Your IP : 18.188.101.251


Current Path : /opt/alt/python37/lib64/python3.7/concurrent/futures/__pycache__/
Upload File :
Current File : //opt/alt/python37/lib64/python3.7/concurrent/futures/__pycache__/process.cpython-37.opt-2.pyc

B

YI~dtm�@s�dZddlZddlZddlmZddlZddlmZddlZddl	m
Z
ddlmZddl
Z
ddlZddlmZddlZddlZddlZe��ZdaGd	d
�d
�Zdd�Zd
ZdZGdd�de�ZGdd�d�Zdd�ZGdd�de�Z Gdd�de�Z!Gdd�de�Z"Gdd�de�Z#dd�Z$dd �Z%d1d!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/d0�d0ej0�Z1e�2e�dS)2z"Brian Quinlan (brian@sweetapp.com)�N)�_base)�Full)�wait)�Queue)�partialFc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�
_ThreadWakeupcCstjdd�\|_|_dS)NF)Zduplex)�mpZPipe�_reader�_writer)�self�r�?/opt/alt/python37/lib64/python3.7/concurrent/futures/process.py�__init__Rsz_ThreadWakeup.__init__cCs|j��|j��dS)N)r
�closer	)rrrr
rUs
z_ThreadWakeup.closecCs|j�d�dS)N�)r
Z
send_bytes)rrrr
�wakeupYsz_ThreadWakeup.wakeupcCsx|j��r|j��qWdS)N)r	ZpollZ
recv_bytes)rrrr
�clear\sz_ThreadWakeup.clearN)�__name__�
__module__�__qualname__rrrrrrrr
rQsrcCsHdatt���}x|D]\}}|��qWx|D]\}}|��q0WdS)NT)�_global_shutdown�list�_threads_wakeups�itemsr�join)r�_�
thread_wakeup�trrr
�_python_exitasr��=c@seZdZdd�Zdd�ZdS)�_RemoteTracebackcCs
||_dS)N)�tb)rr"rrr
rzsz_RemoteTraceback.__init__cCs|jS)N)r")rr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|jffS)N)�_rebuild_excr)r")rrrr
�
__reduce__�sz"_ExceptionWithTraceback.__reduce__N)rrrrr+rrrr
r$sr$cCst|�|_|S)N)r!�	__cause__)r)r"rrr
r*�s
r*c@seZdZdd�ZdS)�	_WorkItemcCs||_||_||_||_dS)N)�future�fn�args�kwargs)rr.r/r0r1rrr
r�sz_WorkItem.__init__N)rrrrrrrr
r-�sr-c@seZdZddd�ZdS)�_ResultItemNcCs||_||_||_dS)N)�work_id�	exception�result)rr3r4r5rrr
r�sz_ResultItem.__init__)NN)rrrrrrrr
r2�sr2c@seZdZdd�ZdS)�	_CallItemcCs||_||_||_||_dS)N)r3r/r0r1)rr3r/r0r1rrr
r�sz_CallItem.__init__N)rrrrrrrr
r6�sr6cs*eZdZd�fdd�	Z�fdd�Z�ZS)�
_SafeQueuercs||_t�j||d�dS)N)�ctx)�pending_work_items�superr)r�max_sizer8r9)�	__class__rr
r�sz_SafeQueue.__init__cslt|t�rZt�t|�||j�}td�d�|���|_	|j
�|jd�}|dk	rh|j
�|�nt��||�dS)Nz

"""
{}"""r%)�
isinstancer6r&r'r(�
__traceback__r!�formatrr,r9�popr3r.�
set_exceptionr:�_on_queue_feeder_error)r�e�objr"�	work_item)r<rr
rB�s
z!_SafeQueue._on_queue_feeder_error)r)rrrrrB�
__classcell__rr)r<r
r7�sr7cgs0t|�}x"tt�||��}|s"dS|Vq
WdS)N)�zip�tuple�	itertools�islice)�	chunksize�	iterables�it�chunkrrr
�_get_chunks�srOcs�fdd�|D�S)Ncsg|]}�|��qSrr)�.0r0)r/rr
�
<listcomp>�sz"_process_chunk.<locals>.<listcomp>r)r/rNr)r/r
�_process_chunk�s	rRc
Cs^y|�t|||d��Wn@tk
rX}z"t||j�}|�t||d��Wdd}~XYnXdS)N)r5r4)r4)�putr2�
BaseExceptionr$r>)�result_queuer3r5r4rCr)rrr
�_sendback_result�s
rVc
Cs�|dk	r:y||�Wn$tk
r8tjjddd�dSXx�|jdd�}|dkrb|�t���dSy|j|j	|j
�}Wn>tk
r�}z t||j�}t
||j|d�Wdd}~XYnXt
||j|d�~q<WdS)NzException in initializer:T)�exc_info)�block)r4)r5)rTrZLOGGERZcritical�getrS�os�getpidr/r0r1r$r>rVr3)�
call_queuerU�initializer�initargsZ	call_item�rrCr)rrr
�_process_worker�s$
"r`cCsxxr|��rdSy|jdd�}Wntjk
r4dSX||}|j��rh|jt||j|j	|j
�dd�q||=qqWdS)NF)rXT)ZfullrY�queueZEmptyr.Zset_running_or_notify_cancelrSr6r/r0r1)r9Zwork_idsr\r3rErrr
�_add_call_item_to_queue�s 

rbc
sFd��fdd�}��fdd�}|j}	|j}
|	|
g}�xt||��dd����D�}t||�}
d}d}|	|
kr�y|	��}d}Wq�tk
r�}zt�t|�||j	�}Wdd}~XYq�Xn|
|
kr�d}d}|�
�|�rt|���dk	r�d	�_d�_d�t
d
�}|dk	�r tdd�|��d
��|_x$|��D]\}}|j�|�~�q*W|�
�x���D]}|���qXW|�dSt|t��r���|�}|����s�|�dSnL|dk	�r�|�|jd�}|dk	�r�|j�r�|j�|j�n|j�|j�~~|��|��r:y$�dk	�rd�_|�s |�dSWntk
�r8YnXd�q6WdS)Ncstp�dkp�jS)N)r�_shutdown_threadr)�executorrr
�
shutting_down?sz/_queue_management_worker.<locals>.shutting_downc	s�tdd����D��}|}d}xn||kr�|dkr�xBt||�D]2}y��d�|d7}Wq>tk
rnPYq>Xq>Wtdd����D��}q W���x���D]}|��q�WdS)Ncss|]}|��VqdS)N)�is_alive)rP�prrr
�	<genexpr>EszD_queue_management_worker.<locals>.shutdown_worker.<locals>.<genexpr>rrcss|]}|��VqdS)N)rf)rPrgrrr
rhQs)�sum�values�rangeZ
put_nowaitrrr)Zn_children_aliveZn_children_to_stopZn_sentinels_sent�irg)r\�	processesrr
�shutdown_workerCs
z1_queue_management_worker.<locals>.shutdown_workercSsg|]
}|j�qSr)�sentinel)rPrgrrr
rQhsz,_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''')r	rbrjrZrecvrTr&r'r(r>r�_brokenrc�BrokenProcessPoolr!rr,rr.rAZ	terminater=�intr@r3r4Z
set_resultr5r)Zexecutor_referencermr9Zwork_ids_queuer\rUrrernZ
result_readerZ
wakeup_readerZreadersZworker_sentinelsZready�causeZ	is_brokenZresult_itemrCZbper3rErgr)r\rdrmr
�_queue_management_worker!s�(




rtc	Cshtrtrtt��dayt�d�}Wnttfk
r:dSX|dkrHdS|dkrTdSd|att��dS)NT�SC_SEM_NSEMS_MAX����z@system provides too few semaphores (%d available, 256 necessary))�_system_limits_checked�_system_limited�NotImplementedErrorrZ�sysconf�AttributeError�
ValueError)Z	nsems_maxrrr
�_check_system_limits�sr~ccs.x(|D] }|��x|r$|��VqWqWdS)N)�reverser@)�iterableZelementrrr
�_chain_from_iterable_of_lists�s
r�c@seZdZdS)rqN)rrrrrrr
rq�srqcsheZdZddd�Zdd�Zdd�Zd	d
�Zejjj	e_	ddd��fd
d�
Z
ddd�Zejjj	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�win32rz"max_workers must be greater than 0zmax_workers must be <= zinitializer must be a callableF)r;r8r9T)$r~rZ�	cpu_count�_max_workers�sys�platform�min�_MAX_WINDOWS_WORKERSr}rZget_context�_mp_context�callable�	TypeError�_initializer�	_initargs�_queue_management_thread�
_processesrc�	threadingZLock�_shutdown_lockrp�_queue_count�_pending_work_items�EXTRA_QUEUED_CALLSr7�_call_queueZ
_ignore_epipeZSimpleQueue�
_result_queuerar�	_work_idsr�_queue_management_thread_wakeup)r�max_workersZ
mp_contextr]r^Z
queue_sizerrr
r�sF







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_cbAszFProcessPoolExecutor._start_queue_management_thread.<locals>.weakref_cbZQueueManagerThread)�targetr0�nameT)r�r��_adjust_process_countr�ZThreadrt�weakref�refr�r�r�r�r�Zdaemon�startr)rr�rrr
�_start_queue_management_thread<s 



z2ProcessPoolExecutor._start_queue_management_threadcCsTxNtt|j�|j�D]8}|jjt|j|j|j	|j
fd�}|��||j|j<qWdS)N)r�r0)
rk�lenr�r�r�ZProcessr`r�r�r�r�r��pid)rrrgrrr
r�Wsz)ProcessPoolExecutor._adjust_process_countc	Os�t|�dkr|^}}}n>|s&td��n0d|krB|�d�}|^}}ntdt|�d��|j��|jrnt|j��|jr|td��tr�td��t	�
�}t||||�}||j|j
<|j�|j
�|j
d7_
|j��|��|SQRXdS)N�zEdescriptor 'submit' of 'ProcessPoolExecutor' object needs an argumentr/z6submit expected at least 1 positional argument, got %drz*cannot schedule new futures after shutdownz6cannot schedule new futures after interpreter shutdown)r�r�r@r�rprqrc�RuntimeErrorrrZFuturer-r�r�r�rSr�rr�)r0r1rr/�f�wrrr
�submitbs0




zProcessPoolExecutor.submitr)�timeoutrKcs:|dkrtd��t�jtt|�t|d|i�|d�}t|�S)Nrzchunksize must be >= 1.rK)r�)r}r:�maprrRrOr�)rr/r�rKrL�results)r<rr
r��szProcessPoolExecutor.mapTc	Cs�|j�d|_WdQRX|jr6|j��|r6|j��d|_|jdk	rd|j��|r^|j��d|_d|_	d|_
|jr�|j��d|_dS)NT)r�rcr�r�rrr�rZjoin_threadr�r�)rrrrr
�shutdown�s"





zProcessPoolExecutor.shutdown)NNNr)T)
rrrrr�r�r�r�Executor�__doc__r�r�rFrr)r<r
r��s
J!
r�)NN)3�
__author__�atexitrZ�concurrent.futuresrrarZmultiprocessingrZmultiprocessing.connectionrZmultiprocessing.queuesrr�r��	functoolsrrIr�r&�WeakKeyDictionaryrrrrr�r��	Exceptionr!r$r*�objectr-r2r6r7rOrRrVr`rbrtrxryr~r�ZBrokenExecutorrqr�r��registerrrrr
�<module>.sT
		

(&!L