Your IP : 18.116.37.200


Current Path : /opt/alt/python311/lib64/python3.11/concurrent/futures/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/concurrent/futures/__pycache__/process.cpython-311.pyc

�

c��f����:�dZdZddlZddlmZddlZddlZddlZddl	m
Z
ddlZddlZddl
mZddlZddlZddlmZej��ZdaGd	�d
��Zd�Zeje��dZd
ZGd�de��ZGd�d��Zd�ZGd�de��Z Gd�de��Z!Gd�de��Z"Gd�de
��Z#d�Z$d�Z%		d'd�Z&d(d�Z'Gd�d ej(��Z)da*da+d!�Z,d"�Z-Gd#�d$ej.��Z/Gd%�d&ej0��Z1dS))a-	Implements ProcessPoolExecutor.

The following diagram and text describe the data-flow through the system:

|======================= In-process =====================|== Out-of-process ==|

+----------+     +----------+       +--------+     +-----------+    +---------+
|          |  => | Work Ids |       |        |     | Call Q    |    | Process |
|          |     +----------+       |        |     +-----------+    |  Pool   |
|          |     | ...      |       |        |     | ...       |    +---------+
|          |     | 6        |    => |        |  => | 5, call() | => |         |
|          |     | 7        |       |        |     | ...       |    |         |
| Process  |     | ...      |       | Local  |     +-----------+    | Process |
|  Pool    |     +----------+       | Worker |                      |  #1..n  |
| Executor |                        | Thread |                      |         |
|          |     +----------- +     |        |     +-----------+    |         |
|          | <=> | Work Items | <=> |        | <=  | Result Q  | <= |         |
|          |     +------------+     |        |     +-----------+    |         |
|          |     | 6: call()  |     |        |     | ...       |    |         |
|          |     |    future  |     |        |     | 4, result |    |         |
|          |     | ...        |     |        |     | 3, except |    |         |
+----------+     +------------+     +--------+     +-----------+    +---------+

Executor.submit() called:
- creates a uniquely numbered _WorkItem and adds it to the "Work Items" dict
- adds the id of the _WorkItem to the "Work Ids" queue

Local worker thread:
- reads work ids from the "Work Ids" queue and looks up the corresponding
  WorkItem from the "Work Items" dict: if the work item has been cancelled then
  it is simply removed from the dict, otherwise it is repackaged as a
  _CallItem and put in the "Call Q". New _CallItems are put in the "Call Q"
  until "Call Q" is full. NOTE: the size of the "Call Q" is kept small because
  calls placed in the "Call Q" can no longer be cancelled with Future.cancel().
- reads _ResultItems from "Result Q", updates the future stored in the
  "Work Items" dict and deletes the dict entry

Process #1..n:
- reads _CallItems from "Call Q", executes the calls, and puts the resulting
  _ResultItems in "Result Q"
z"Brian Quinlan (brian@sweetapp.com)�N)�_base)�Queue)�partial)�format_exceptionFc�&�eZdZd�Zd�Zd�Zd�ZdS)�
_ThreadWakeupc�X�d|_tjd���\|_|_dS)NF)�duplex)�_closed�mp�Pipe�_reader�_writer��selfs �A/opt/alt/python311/lib64/python3.11/concurrent/futures/process.py�__init__z_ThreadWakeup.__init__Cs(�����%'�W�E�%:�%:�%:�"���d�l�l�l�c��|js;d|_|j���|j���dSdS�NT)rr�closerrs rrz_ThreadWakeup.closeGsM���|�	!��D�L��L��� � � ��L��� � � � � �	!�	!rc�L�|js|j�d��dSdS)Nr)rr�
send_bytesrs r�wakeupz_ThreadWakeup.wakeupRs2���|�	)��L�#�#�C�(�(�(�(�(�	)�	)rc��|jsM|j���r6|j���|j����2dSdSdS�N)rr�poll�
recv_bytesrs r�clearz_ThreadWakeup.clearVsl���|�	*��,�#�#�%�%�
*���'�'�)�)�)��,�#�#�%�%�
*�
*�
*�	*�	*�
*�
*rN)�__name__�
__module__�__qualname__rrrr�rrrrBsP������;�;�;�	!�	!�	!�)�)�)�*�*�*�*�*rrc���datt�����}|D]\}}|����|D]\}}|����dSr)�_global_shutdown�list�_threads_wakeups�itemsr�join)r(�_�
thread_wakeup�ts    r�_python_exitr-\sw�����!�'�'�)�)�*�*�E�!�����=�������������1�	��������r��=c��eZdZd�Zd�ZdS)�_RemoteTracebackc��||_dSr��tb)rr4s  rrz_RemoteTraceback.__init__|s
������rc��|jSrr3rs r�__str__z_RemoteTraceback.__str__~s	���w�rN)r r!r"rr6r#rrr1r1{s2�������������rr1c��eZdZd�Zd�ZdS)�_ExceptionWithTracebackc��d�tt|��||����}||_d|j_d|z|_dS)N�z

"""
%s""")r)r�type�exc�
__traceback__r4)rr<r4s   rrz _ExceptionWithTraceback.__init__�sI��
�W�W�%�d�3�i�i��b�9�9�
:�
:�����"&���� �2�%����rc�,�t|j|jffSr)�_rebuild_excr<r4rs r�
__reduce__z"_ExceptionWithTraceback.__reduce__�s���d�h���0�0�0rN)r r!r"rr@r#rrr8r8�s2������&�&�&�1�1�1�1�1rr8c�.�t|��|_|Sr)r1�	__cause__)r<r4s  rr?r?�s��$�R�(�(�C�M��Jrc��eZdZd�ZdS)�	_WorkItemc�>�||_||_||_||_dSr)�future�fn�args�kwargs)rrFrGrHrIs     rrz_WorkItem.__init__�s"����������	�����rN�r r!r"rr#rrrDrD��#����������rrDc��eZdZdd�ZdS)�_ResultItemNc�>�||_||_||_||_dSr)�work_id�	exception�result�exit_pid)rrOrPrQrRs     rrz_ResultItem.__init__�s"�����"������ ��
�
�
r�NNNrJr#rrrMrM�s(������!�!�!�!�!�!rrMc��eZdZd�ZdS)�	_CallItemc�>�||_||_||_||_dSr)rOrGrHrI)rrOrGrHrIs     rrz_CallItem.__init__�s"����������	�����rNrJr#rrrUrU�rKrrUc�.��eZdZdZd�fd�	Z�fd�Z�xZS)�
_SafeQueuez=Safe Queue set exception to the future object linked to a jobrc�x��||_||_||_t���||���dS)N)�ctx)�pending_work_items�
shutdown_lockr+�superr)r�max_sizerZr[r\r+�	__class__s      �rrz_SafeQueue.__init__�s>���"4���*���*���
������s��+�+�+�+�+rc� ��t|t��r�tt|��||j��}td�d�|������|_|j	�
|jd��}|j5|j
���ddd��n#1swxYwY|�|j�|��dSdSt#���||��dS)Nz

"""
{}"""r:)�
isinstancerUrr;r=r1�formatr)rBr[�poprOr\r+rrF�
set_exceptionr]�_on_queue_feeder_error)r�e�objr4�	work_itemr_s     �rrez!_SafeQueue._on_queue_feeder_error�s1����c�9�%�%�	3�!�$�q�'�'�1�a�o�>�>�B�*�>�+@�+@�������+M�+M�N�N�A�K��/�3�3�C�K��F�F�I��#�
,�
,��"�)�)�+�+�+�
,�
,�
,�
,�
,�
,�
,�
,�
,�
,�
,����
,�
,�
,�
,�
�$�� �.�.�q�1�1�1�1�1�%�$�
�G�G�*�*�1�c�2�2�2�2�2s�C�C�C)r)r r!r"�__doc__rre�
__classcell__�r_s@rrXrX�s\�������G�G�,�,�,�,�,�,�
3�
3�
3�
3�
3�
3�
3�
3�
3rrXc'�pK�t|�}	ttj||����}|sdS|V��+)z, Iterates over zip()ed iterables in chunks. TN)�zip�tuple�	itertools�islice)�	chunksize�	iterables�it�chunks    r�_get_chunksru�sI����	�i��B���i�&�r�9�5�5�6�6���	��F�����	rc� ���fd�|D��S)z� Processes a chunk of an iterable passed to map.

    Runs the function passed to map() on a chunk of the
    iterable passed to map.

    This function is run in a separate process.

    c���g|]}�|���Sr#r#)�.0rHrGs  �r�
<listcomp>z"_process_chunk.<locals>.<listcomp>�s���(�(�(�$�B�B��I�(�(�(rr#)rGrts` r�_process_chunkrz�s���)�(�(�(�%�(�(�(�(rc��	|�t||||�����dS#t$rE}t||j��}|�t|||�����Yd}~dSd}~wwxYw)z.Safely send back the given result or exception)rQrPrR�rPrRN)�putrM�
BaseExceptionr8r=)�result_queuerOrQrPrRrfr<s       r�_sendback_resultr��s���9�����W�V�/8�8�M�M�M�	N�	N�	N�	N�	N���9�9�9�%�a���9�9������W��.6�8�8�8�	9�	9�	9�	9�	9�	9�	9�	9�	9�����9���s�&*�
A9�:A4�4A9c�:�|�9	||�n2#t$r%tj�dd���YdSwxYwd}d}	|�d���}|�(|�t
j����dS|�|dz
}||krt
j��}	|j|j	i|j
��}t||j||���~nD#t$r7}	t|	|	j��}
t||j|
|�	��Yd}	~	nd}	~	wwxYw~|�dS��)
a�Evaluates calls from call_queue and places the results in result_queue.

    This worker is run in a separate process.

    Args:
        call_queue: A ctx.Queue of _CallItems that will be read and
            evaluated by the worker.
        result_queue: A ctx.Queue of _ResultItems that will written
            to by the worker.
        initializer: A callable initializer, or None
        initargs: A tuple of args for the initializer
    NzException in initializer:T)�exc_infor��blockr.)rQrRr|)r~r�LOGGER�critical�getr}�os�getpidrGrHrIr�rOr8r=)�
call_queuer�initializer�initargs�	max_tasks�	num_tasksrR�	call_item�rrfr<s           r�_process_workerr��s�����	��K��"�"�"���	�	�	��L�!�!�"=��!�M�M�M�
�F�F�		����
�I��H���N�N��N�.�.�	������R�Y�[�[�)�)�)��F�� ���N�I��I�%�%��9�;�;��		��	��i�n�A�	�0@�A�A�A�
�\�9�+<�Q�&.�
0�
0�
0�
0�����	0�	0�	0�)�!�Q�_�=�=�C��\�9�+<��&.�
0�
0�
0�
0�
0�
0�
0�
0�
0�����	0����
����F�9s$�
�+9�9�"C�
D�-D�Dc�^��eZdZdZ�fd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Z�xZS)
�_ExecutorManagerThreadatManages the communication between this process and the worker processes.

    The manager is run in a local thread.

    Args:
        executor: A reference to the ProcessPoolExecutor that owns
            this thread. A weakref will be own by the manager as well as
            references to internal objects used to introspect the state of
            the executor.
    c�\��|j|_|j|_|j|jfd�}t	j||��|_|j|_|j	|_
|j|_|j
|_|j|_|j|_t'�����dS)Nc��tj�d��|5|���ddd��dS#1swxYwYdS)Nz?Executor collected: triggering callback for QueueManager wakeup)r�util�debugr)r*r+r\s   r�
weakref_cbz3_ExecutorManagerThread.__init__.<locals>.weakref_cb1s���
�G�M�M�1�
2�
2�
2��
'�
'��$�$�&�&�&�
'�
'�
'�
'�
'�
'�
'�
'�
'�
'�
'�
'����
'�
'�
'�
'�
'�
's�A�A�A)�_executor_manager_thread_wakeupr+�_shutdown_lockr\�weakref�ref�executor_reference�
_processes�	processes�_call_queuer��
_result_queuer�	_work_ids�work_ids_queue�_max_tasks_per_child�max_tasks_per_child�_pending_work_itemsr[r]r)r�executorr�r_s   �rrz_ExecutorManagerThread.__init__#s����
&�E���%�4���&*�%7�%)�%7�	'�	'�	'�	'�#*�+�h�
�"C�"C���"�,���#�.���%�2���'�0���$,�#@�� �#+�">���
���������rc��	|���|���\}}}|r|�|��dS|��|�|��|jdu}|r3|j�|j��}|���~|���x}rP|r4|j	5|�
��ddd��n#1swxYwYn|j���~|�
��rE|���|���|js|���dS��\r)�add_call_item_to_queue�wait_result_broken_or_wakeup�terminate_broken�process_result_itemrRr�rcr)r�r\�_adjust_process_count�_idle_worker_semaphore�release�is_shutting_down�flag_executor_shutting_downr[�join_executor_internals)r�result_item�	is_broken�cause�process_exited�pr�s       r�runz_ExecutorManagerThread.runRs���(	��'�'�)�)�)�,0�,M�,M�,O�,O�)�K��E��
��%�%�e�,�,�,����&��(�(��5�5�5�!,�!5�T�!A��!����*�*�;�+?�@�@�A��F�F�H�H�H� �#�6�6�8�8�8�8�!�%�B�!�/�=�=�$�:�:�<�<�<�=�=�=�=�=�=�=�=�=�=�=����=�=�=�=��!�7�?�?�A�A�A� ��$�$�&�&�
��0�0�2�2�2�
�+�+�-�-�-��.���0�0�2�2�2��F�Q(	s�<C�C!�$C!c�v�	|j���rdS	|j�d���}|j|}|j���r<|j�t||j	|j
|j��d���n|j|=��#tj
$rYdSwxYw��)NTFr�)r��fullr�r�r[rF�set_running_or_notify_cancelr}rUrGrHrI�queue�Empty)rrOrhs   rr�z-_ExecutorManagerThread.add_call_item_to_queues���	���#�#�%�%�
���
��-�1�1��1�>�>��!�3�G�<�	��#�@�@�B�B���O�'�'�	�'�2;�,�2;�.�2;�2B�)D�)D�/3�	(�4�4�4�4��/��8����;�
�
�
����
����	s�B$�$B7�6B7c��|jj}|jjrJ�|jj}||g}d�t	|j�����D��}tj�	||z��}d}d}d}||vrR	|�
��}d}n@#t$r-}	tt|	��|	|	j��}Yd}	~	nd}	~	wwxYw||vrd}|j���|||fS)Nc��g|]	}|j��
Sr#)�sentinel�rxr�s  rryzG_ExecutorManagerThread.wait_result_broken_or_wakeup.<locals>.<listcomp>�s��N�N�N�1�A�J�N�N�NrTF)rrr+rr&r��valuesr�
connection�wait�recvr~rr;r=r)
r�
result_reader�
wakeup_reader�readers�worker_sentinels�readyr�r�r�rfs
          rr�z3_ExecutorManagerThread.wait_result_broken_or_wakeup�s/���)�1�
��%�-�-�-�-��*�2�
� �-�0��N�N��T�^�5J�5J�5L�5L�0M�0M�N�N�N���
�"�"�7�-=�#=�>�>�����	����E�!�!�
F�+�0�0�2�2��!�	�	�� �
F�
F�
F�(��a���!�Q�_�E�E�����������
F�����e�
#�
#��I�	
�� � �"�"�"��I�u�,�,s�B�
C�)#C�Cc���t|t��rc|���sJ�|j�|��}|���|js|���dSdS|j�|jd��}|�I|j	r!|j
�|j	��dS|j
�|j
��dSdSr)ra�intr�r�rcr)r�r[rOrPrFrd�
set_resultrQ)rr�r�rhs    rr�z*_ExecutorManagerThread.process_result_item�s����k�3�'�'�	D��(�(�*�*�*�*�*���"�"�;�/�/�A�
�F�F�H�H�H��>�
��,�,�.�.�.���
�
�
�/�3�3�K�4G��N�N�I��$��(�D��$�2�2�;�3H�I�I�I�I�I��$�/�/��0B�C�C�C�C�C�	%�$rc�N�|���}tp
|dup|jSr)r�r%�_shutdown_thread)rr�s  rr�z'_ExecutorManagerThread.is_shutting_down�s4���*�*�,�,��
!�-�H��$4�-��,�	.rc��|���}|�d|_d|_d}td��}|�+t	dd�|���d���|_|j���D] \}}|j	�
|��~�!|j���|j�
��D]}|����|jj���t$jdkr|jj���|���dS)NzKA child process terminated abruptly, the process pool is not usable anymoreTz^A process in the process pool was terminated abruptly while the future was running or pending.z
'''
r:z'''�win32)r��_brokenr��BrokenProcessPoolr1r)rBr[r(rFrdrr�r��	terminater�rr�sys�platformrr�)rr�r��bperOrhr�s       rr�z'_ExecutorManagerThread.terminate_broken�sX���*�*�,�,����!1�H��)-�H�%��H� �!6�7�7����,�-�"�'�'�%�.�.�-�-�-�/�/�C�M�#'�"9�"?�"?�"A�"A�	�	��G�Y���*�*�3�/�/�/��	���%�%�'�'�'���&�&�(�(�	�	�A�
�K�K�M�M�M�M�	
���%�%�'�'�'��<�7�"�"��O�#�)�)�+�+�+�	
�$�$�&�&�&�&�&rc�T�|���}|��d|_|jr�i}|j���D]#\}}|j���s|||<�$||_		|j���n#tj
$rYnwxYw�1d|_dSdSdS)NTF)r�r��_cancel_pending_futuresr[r(rF�cancelr��
get_nowaitr�r�)rr��new_pending_work_itemsrOrhs     rr�z2_ExecutorManagerThread.flag_executor_shutting_down	s����*�*�,�,����(,�H�%��/�
9�*,�&�*.�*A�*G�*G�*I�*I�D�D�&�G�Y�$�+�2�2�4�4�D�:C�.�w�7��*@��'����+�6�6�8�8�8�8�� �;�����������49��0�0�0�) ��
9�
9s�-B�B�Bc�L�|���}d}||kr�|���dkrmt||z
��D]8}	|j�d��|dz
}�##tj$rYnwxYw||kr|���dk�idSdSdSdS)Nrr.)�get_n_children_alive�ranger��
put_nowaitr��Full)r�n_children_to_stop�n_sentinels_sent�is    r�shutdown_workersz'_ExecutorManagerThread.shutdown_workers#s���!�6�6�8�8���� �"4�4�4��-�-�/�/�!�3�3��-�0@�@�A�A�
�
����O�.�.�t�4�4�4�$��)�$�$���z�����E�E�����
 �"4�4�4��-�-�/�/�!�3�3�3�3�5�4�3�3�5�4s�
A*�*A=�<A=c�b�|���|j���|j���|j5|j���ddd��n#1swxYwY|j���D]}|����dSr)	r�r�r�join_threadr\r+r�r�r)�rr�s  rr�z._ExecutorManagerThread.join_executor_internals1s������������������#�#�%�%�%�
�
�	'�	'���$�$�&�&�&�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'����	'�	'�	'�	'���&�&�(�(�	�	�A�
�F�F�H�H�H�H�	�	s�A4�4A8�;A8c�b�td�|j���D����S)Nc3�>K�|]}|���V��dSr)�is_aliver�s  r�	<genexpr>z>_ExecutorManagerThread.get_n_children_alive.<locals>.<genexpr>?s*����A�A�A�1�:�:�<�<�A�A�A�A�A�Ar)�sumr�r�rs rr�z+_ExecutorManagerThread.get_n_children_alive=s-���A�A���)>�)>�)@�)@�A�A�A�A�A�Ar)r r!r"rirr�r�r�r�r�r�r�r�r�r�rjrks@rr�r�s��������	�	�-�-�-�-�-�^+�+�+�Z���.!-�!-�!-�FD�D�D�..�.�.�-'�-'�-'�^9�9�9�4���
�
�
�B�B�B�B�B�B�Brr�c�L�trtrtt���da	ddl}n$#t$rdatt���wxYw	tjd��}n#ttf$rYdSwxYw|dkrdS|dkrdSd|zatt���)NTrzxThis Python build lacks multiprocessing.synchronize, usually due to named semaphores being unavailable on this platform.�SC_SEM_NSEMS_MAX����z@system provides too few semaphores (%d available, 256 necessary))	�_system_limits_checked�_system_limited�NotImplementedError�multiprocessing.synchronize�ImportErrorr��sysconf�AttributeError�
ValueError)�multiprocessing�	nsems_maxs  r�_check_system_limitsr�Fs����7��	7�%�o�6�6�6�!��3�*�*�*�*�*���3�3�3�
F�	�"�/�2�2�2�3������J�1�2�2�	�	���J�'������������B���	���C���	��4�6?�@�O�
�o�
.�
.�.s�+�!A�A%�%A:�9A:c#�pK�|D]0}|���|r|���V�|��1dS)z�
    Specialized implementation of itertools.chain.from_iterable.
    Each item in *iterable* should be a list.  This function is
    careful not to keep references to yielded objects.
    N)�reverserc)�iterable�elements  r�_chain_from_iterable_of_listsrfsX����� � ���������	 ��+�+�-�-�����	 �� � rc��eZdZdZdS)r�zy
    Raised when a process in a ProcessPoolExecutor terminated abruptly
    while a future was in the running state.
    N)r r!r"rir#rrr�r�rs���������rr�c���eZdZ		ddd�d�Zd�Zd�Zd�Zd�Zd	�Ze	j
jje_dd
d��fd�
Zddd�d�Z
e	j
j
je
_�xZS)�ProcessPoolExecutorNr#)r�c��t��|�Jtj��pd|_tjdkrt
t|j��|_nN|dkrtd���tjdkr"|tkrtdt�����||_|�*|�tj
d��}ntj
��}||_|j�d�	��d
k|_
|�t|��std���||_||_|�gt%|t&��std���|dkrtd
���|j�d�	��d
krtd���||_d|_i|_d|_t1j��|_t1jd��|_d|_d|_i|_d|_ tC��|_"|jtFz}tI||j|j|j|j"���|_%d|j%_&|�'��|_(tSj*��|_+dS)aHInitializes a new ProcessPoolExecutor instance.

        Args:
            max_workers: The maximum number of processes that can be used to
                execute the given calls. If None or not given then as many
                worker processes will be created as the machine has processors.
            mp_context: A multiprocessing context to launch the workers. This
                object should provide SimpleQueue, Queue and Process. Useful
                to allow specific multiprocessing start methods.
            initializer: A callable used to initialize worker processes.
            initargs: A tuple of arguments to pass to the initializer.
            max_tasks_per_child: The maximum number of tasks a worker process
                can complete before it will exit and be replaced with a fresh
                worker process. The default of None means worker process will
                live as long as the executor. Requires a non-'fork' mp_context
                start method. When given, we default to using 'spawn' if no
                mp_context is supplied.
        Nr.r�rz"max_workers must be greater than 0zmax_workers must be <= �spawnF)�
allow_none�forkzinitializer must be a callablez&max_tasks_per_child must be an integerz max_tasks_per_child must be >= 1zpmax_tasks_per_child is incompatible with the 'fork' multiprocessing start method; supply a different mp_context.)r^rZr[r\r+T),r�r��	cpu_count�_max_workersr�r��min�_MAX_WINDOWS_WORKERSr�r�get_context�_mp_context�get_start_method�#_safe_to_dynamically_spawn_children�callable�	TypeError�_initializer�	_initargsrar�r��_executor_manager_threadr�r��	threading�Lockr��	Semaphorer�r��_queue_countr�r�rr��EXTRA_QUEUED_CALLSrXr��
_ignore_epipe�SimpleQueuer�r�rr�)r�max_workers�
mp_contextr�r�r��
queue_sizes       rrzProcessPoolExecutor.__init__zs���(	������ "���� 3�!�D���|�w�&�&�$'�(<�(,�(9�%;�%;��!���a��� �!E�F�F�F��,�'�)�)��2�2�2� �D�.B�D�D�F�F�F�!,�D����"�.��^�G�4�4�
�
��^�-�-�
�%���� �1�1�U�1�C�C�v�M�	
�0��"�8�K�+@�+@�"��<�=�=�=�'���!����*��1�3�7�7�
E�� H�I�I�I�$��)�)� �!C�D�D�D���0�0�E�0�B�B�f�L�L� �"C�D�D�D�%8��!�)-��%����!&���'�n�.�.���&/�&9�!�&<�&<��#�������#%�� �',��$�0=����,��&�);�;�
�%��T�%5�#�7��-��>�	@�@�@���*.���&�'�3�3�5�5����������rc���|j�^|js|���t|��|_|j���|jt|j<dSdSr)rr�_launch_processesr��startr�r'rs r�_start_executor_manager_threadz2ProcessPoolExecutor._start_executor_manager_thread�sn���(�0��;�
)��&�&�(�(�(�,B�4�,H�,H�D�)��)�/�/�1�1�1��4�
�T�:�;�;�;�
1�0rc��|j�d���rdSt|j��}||jkr|���dSdS)NF)�blocking)r��acquire�lenr�r
�_spawn_process)r�
process_counts  rr�z)ProcessPoolExecutor._adjust_process_count�sb���&�.�.��.�>�>�	��F��D�O�,�,�
��4�,�,�,�
���!�!�!�!�!�-�,rc��|jr
Jd���tt|j��|j��D]}|����dS)NzhProcesses cannot be fork()ed after the thread has started, deadlock in the child processes could result.)rr�r'r�r
r()rr*s  rr!z%ProcessPoolExecutor._launch_processessp���0�	A�	A�@�	A�	A�0��s�4�?�+�+�T�->�?�?�	"�	"�A����!�!�!�!�	"�	"rc���|j�t|j|j|j|j|jf���}|���||j	|j
<dS)N)�targetrH)r�Processr�r�r�rrr�r"r��pidr�s  rr(z"ProcessPoolExecutor._spawn_process	sg����$�$�"��"��$��#��.��+�	-�
%�
.�
.��	
���	�	�	�!"�������rc�,�|j5|jrt|j���|jrt	d���t
rt	d���t
j��}t||||��}||j	|j
<|j�|j
��|xj
dz
c_
|j
���|jr|���|���|cddd��S#1swxYwYdS)Nz*cannot schedule new futures after shutdownz6cannot schedule new futures after interpreter shutdownr.)r�r�r�r��RuntimeErrorr%r�FuturerDr�rr�r}r�rrr�r#)rrGrHrI�f�ws      r�submitzProcessPoolExecutor.submitsg��
�
 �	�	��|�
6�'���5�5�5��$�
Q�"�#O�P�P�P��
;�"�$:�;�;�;�����A��!�R��v�.�.�A�:;�D�$�T�%6�7��N���t�0�1�1�1�����"����0�7�7�9�9�9��7�
-��*�*�,�,�,��/�/�1�1�1��+	�	�	�	�	�	�	�	�	�	�	�	����	�	�	�	�	�	s�C4D	�	D
�D
r.)�timeoutrqc����|dkrtd���t���tt|��t|d|i�|���}t
|��S)ajReturns an iterator equivalent to map(fn, iter).

        Args:
            fn: A callable that will take as many arguments as there are
                passed iterables.
            timeout: The maximum number of seconds to wait. If None, then there
                is no limit on the wait time.
            chunksize: If greater than one, the iterables will be chopped into
                chunks of size chunksize and submitted to the process pool.
                If set to one, the items in the list will be sent one at a time.

        Returns:
            An iterator equivalent to: map(func, *iterables) but the calls may
            be evaluated out-of-order.

        Raises:
            TimeoutError: If the entire result iterator could not be generated
                before the given timeout.
            Exception: If fn(*args) raises for any values.
        r.zchunksize must be >= 1.rq)r5)r�r]�maprrzrur)rrGr5rqrr�resultsr_s      �rr7zProcessPoolExecutor.map-sh���*�q�=�=��6�7�7�7��'�'�+�+�g�n�b�9�9�)�9�J�	�J�J�&-��/�/��-�W�5�5�5rTF)�cancel_futuresc�n�|j5||_d|_|j�|j���ddd��n#1swxYwY|j�|r|j���d|_d|_|j�|r|j�	��d|_d|_
d|_dSr)r�r�r�r�rrr)r�r�rr�)rr�r9s   r�shutdownzProcessPoolExecutor.shutdownJs��
�
 �	>�	>�+9�D�(�$(�D�!��3�?��4�;�;�=�=�=�	>�	>�	>�	>�	>�	>�	>�	>�	>�	>�	>����	>�	>�	>�	>��(�4��4��)�.�.�0�0�0�)-��%������)�d�)���$�$�&�&�&�!������/3��,�,�,s�/A�A�
A)NNNr#)T)r r!r"rr#r�r!r(r4r�Executorrir7r;rjrks@rrrys��������48�,.�l'�GK�l'�l'�l'�l'�l'�\5�5�5�
"�
"�
"�"�"�"�	#�	#�	#����.�^�*�2�F�N�*.�!�6�6�6�6�6�6�6�:4�E�4�4�4�4�4�(�~�.�6�H�����rrrSr)2ri�
__author__r��concurrent.futuresrr�r�r�multiprocessing.connection�multiprocessing.queuesrrr��	functoolsrror��	tracebackr�WeakKeyDictionaryr'r%rr-�_register_atexitrr�	Exceptionr1r8r?�objectrDrMrUrXrurzr�r��Threadr�r�r�r�r�BrokenExecutorr�r<rr#rr�<module>rIsY��(�(�T2�
�	�	�	�	�$�$�$�$�$�$���������!�!�!�!�(�(�(�(�(�(�������������������
�
�
�
�&�&�&�&�&�&�-�7�,�.�.����*�*�*�*�*�*�*�*�4����	��<�(�(�(����������y����	1�	1�	1�	1�	1�	1�	1�	1�������������!�!�!�!�!�&�!�!�!����������3�3�3�3�3��3�3�3�2���	)�	)�	)�DH�"�	9�	9�	9�	9�3�3�3�3�lhB�hB�hB�hB�hB�Y�-�hB�hB�hB�V	����/�/�/�@	 �	 �	 �������,����e7�e7�e7�e7�e7�%�.�e7�e7�e7�e7�e7r

?>