Your IP : 3.143.7.112


Current Path : /opt/alt/python312/lib64/python3.12/concurrent/futures/__pycache__/
Upload File :
Current File : //opt/alt/python312/lib64/python3.12/concurrent/futures/__pycache__/process.cpython-312.opt-2.pyc

�

�Q�f���� �	dZddlZddlmZddlZddlZddlZddlm	Z	ddl
Z
ddlZddlm
Z
ddlZddlZddlmZej$�ZdaGd�d	�Zd
�Ze
j.e�dZdZGd
�de�ZGd�d�Zd�ZGd�de�ZGd�de�Z Gd�de�Z!Gd�de	�Z"d�Z#d�Z$		d&d�Z%d'd�Z&Gd�de
jN�Z(da)da*d �Z+d!�Z,Gd"�d#ejZ�Z.Gd$�d%ej^�Z0y)(z"Brian Quinlan (brian@sweetapp.com)�N)�_base)�Queue)�partial)�format_exceptionFc�$�eZdZd�Zd�Zd�Zd�Zy)�
_ThreadWakeupc�X�d|_tjd��\|_|_y)NF)�duplex)�_closed�mp�Pipe�_reader�_writer��selfs �A/opt/alt/python312/lib64/python3.12/concurrent/futures/process.py�__init__z_ThreadWakeup.__init__Es �����%'�W�W�E�%:�"���d�l�c��|js<d|_|jj�|jj�yy�NT)rr�closerrs rrz_ThreadWakeup.closeIs7���|�|��D�L��L�L��� ��L�L��� �rc�T�|js|jjd�yy)Nr)rr�
send_bytesrs r�wakeupz_ThreadWakeup.wakeupTs ���|�|��L�L�#�#�C�(�rc��|jsQ|jj�r6|jj�|jj�r�5yyy�N)rr�poll�
recv_bytesrs r�clearz_ThreadWakeup.clearXs@���|�|��,�,�#�#�%����'�'�)��,�,�#�#�%�rN)�__name__�
__module__�__qualname__rrrr�rrrrDs��;�	!�)�*rrc��dattj��}|D]\}}|j	��|D]\}}|j��yr)�_global_shutdown�list�_threads_wakeups�itemsr�join)r(�_�
thread_wakeup�ts    r�_python_exitr-^sP�����!�'�'�)�*�E�!���=�����"����1�	����r��=c��eZdZd�Zd�Zy)�_RemoteTracebackc��||_yr��tb)rr4s  rrz_RemoteTraceback.__init__~s	����rc��|jSrr3rs r�__str__z_RemoteTraceback.__str__�s���w�w�rN)r r!r"rr6r#rrr1r1}s���rr1c��eZdZd�Zd�Zy)�_ExceptionWithTracebackc��djtt|�||��}||_d|j_d|z|_y)N�z

"""
%s""")r)r�type�exc�
__traceback__r4)rr<r4s   rrz _ExceptionWithTraceback.__init__�s?��
�W�W�%�d�3�i��b�9�
:�����"&����� �2�%��rc�>�t|j|jffSr)�_rebuild_excr<r4rs r�
__reduce__z"_ExceptionWithTraceback.__reduce__�s���d�h�h����0�0�0rN)r r!r"rr@r#rrr8r8�s��&�1rr8c�&�t|�|_|Sr)r1�	__cause__)r<r4s  rr?r?�s��$�R�(�C�M��Jrc��eZdZd�Zy)�	_WorkItemc�<�||_||_||_||_yr)�future�fn�args�kwargs)rrFrGrHrIs     rrz_WorkItem.__init__�s����������	���rN�r r!r"rr#rrrDrD����rrDc��eZdZdd�Zy)�_ResultItemNc�<�||_||_||_||_yr)�work_id�	exception�result�exit_pid)rrOrPrQrRs     rrz_ResultItem.__init__�s�����"������ ��
r�NNNrJr#rrrMrM�s��!rrMc��eZdZd�Zy)�	_CallItemc�<�||_||_||_||_yr)rOrGrHrI)rrOrGrHrIs     rrz_CallItem.__init__�s����������	���rNrJr#rrrUrU�rKrrUc�,��eZdZ	d�fd�	Z�fd�Z�xZS)�
_SafeQueuec�R��||_||_||_t�|�||��y)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�}tdj
dj|���|_|jj|jd�}|j5|jj�ddd�|�|jj!|�yyt"�|�I||�y#1swY�9xYw)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�s�����c�9�%�!�$�q�'�1�a�o�o�>�B�*�>�+@�+@������+M�N�A�K��/�/�3�3�C�K�K��F�I��#�#��"�"�)�)�+�$�
�$�� � �.�.�q�1�%�
�G�*�1�c�2�$�#�s�C%�%C.)r)r r!r"rre�
__classcell__�r_s@rrXrX�s���G�,�
3�
3rrXc'�lK�	t|�}	ttj||��}|sy|���'�wr)�zip�tuple�	itertools�islice)�	chunksize�	iterables�it�chunks    r�_get_chunksrt�s<����6�	�i��B�
��i�&�&�r�9�5�6������	�s�24c�4�	|D�cgc]}||���	c}Scc}wrr#)rGrsrHs   r�_process_chunkrv�s%���#(�(�%�$�B��I�%�(�(��(s�c���		|jt||||���y#t$r=}t||j�}|jt|||���Yd}~yd}~wwxYw)N)rQrPrR�rPrR)�putrM�
BaseExceptionr8r=)�result_queuerOrQrPrRrfr<s       r�_sendback_resultr|�sk��8�9�����W�V�/8�8�M�	N���9�%�a����9������W��.6�8�	9�	9��9�s�"�	A(�3A#�#A(c�D�	|�	||�d}d}	|j	d��}|�$|jt
j��y|�|dz
}||k\rt
j�}	|j|ji|j��}t||j||��~~|�y��#t$r$tjjdd��YywxYw#t$r9}	t|	|	j�}
t||j|
|��Yd}	~	�rd}	~	wwxYw)	NzException in initializer:T)�exc_infor��blockr.)rQrRrx)rzr�LOGGER�critical�getry�os�getpidrGrHrIr|rOr8r=)�
call_queuer{�initializer�initargs�	max_tasks�	num_tasksrR�	call_item�rrfr<s           r�_process_workerr��s8�����	���"��I��H�
��N�N��N�.�	������R�Y�Y�[�)��� ���N�I��I�%��9�9�;��		��	���i�n�n�A�	�0@�0@�A�A�
�\�9�+<�+<�Q�&.�
0��
����9���	��L�L�!�!�"=��!�M�
�		��*�	0�)�!�Q�_�_�=�C��\�9�+<�+<��&.�
0�
0��	0�s)�B-�(&C�-*C�C�	D�&/D�Dc�j��eZdZ	�fd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
dd�Zd
�Z�xZS)�_ExecutorManagerThreadc���|j|_|j|_|j|jfd�}t	j
||�|_|j|_|j|_
|j|_|j|_|j|_|j"|_t&�|�Q�y)Nc��tjjd�|5|j�ddd�y#1swYyxYw)Nz?Executor collected: triggering callback for QueueManager wakeup)r�util�debugr)r*r+r\s   r�
weakref_cbz3_ExecutorManagerThread.__init__.<locals>.weakref_cb3s2��
�G�G�M�M�1�
2���$�$�&����s	�<�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�E���%�4�4���&*�%7�%7�%)�%7�%7�	'�#*�+�+�h�
�"C���"�,�,���#�.�.���%�2�2���'�0�0���$,�#@�#@�� �#+�">�">���
���rc���		|j�|j	�\}}}|r|j|�y|��|j|�|jdu}|r5|jj|j�}|j�~|j�x}rC|r&|j5|j�ddd�n|jj�~|j�r=|j!�|j�|j"s|j%�y��6#t$r&}t|�}|j|�Yd}~yd}~wwxYw#1swY��xYwr)�add_call_item_to_queuerzr�terminate_broken�wait_result_broken_or_wakeup�process_result_itemrRr�rcr)r�r\�_adjust_process_count�_idle_worker_semaphore�release�is_shutting_down�flag_executor_shutting_downr[�join_executor_internals)rr<�cause�result_item�	is_broken�process_exited�pr�s        r�runz_ExecutorManagerThread.runTsY���
��+�+�-�-1�,M�,M�,O�)�K��E���%�%�e�,���&��(�(��5�!,�!5�!5�T�!A��!����*�*�;�+?�+?�@�A��F�F�H� �#�6�6�8�8�8�8�%�!�/�/�$�:�:�<�0�/�!�7�7�?�?�A� ��$�$�&��0�0�2�
�+�+�-��.�.��0�0�2��_��
!�
�(��-���%�%�e�,���
��00�/�s#�D8�4E*�8	E'�E"�"E'�*E3c��	|jj�ry	|jjd��}|j|}|j
j
�rH|jjt||j|j|j�d��n|j|=����#tj$rYywxYw)NTFr)r��fullr�r�r[rF�set_running_or_notify_cancelryrUrGrHrI�queue�Empty)rrOrhs   rr�z-_ExecutorManagerThread.add_call_item_to_queue�s�������#�#�%��
��-�-�1�1��1�>��!�3�3�G�<�	��#�#�@�@�B��O�O�'�'�	�'�2;�,�,�2;�.�.�2;�2B�2B�)D�/3�	(�4��/�/��8��%��
�;�;�
��
�s�B:�:C�Cc���|jj}|jj}||g}t|jj��D�cgc]}|j��}}tjj||z�}d}d}d}	||vr	|j�}	d}n||vrd}|jj�|	||fScc}w#t$r}
t|
�}Yd}
~
�=d}
~
wwxYw�NTF)r{rr+r&r��values�sentinelr�
connection�wait�recvrzrr)r�
result_reader�
wakeup_reader�readersr��worker_sentinels�readyr�r�r�r<s           rr�z3_ExecutorManagerThread.wait_result_broken_or_wakeup�s����)�)�1�1�
��*�*�2�2�
� �-�0��04�T�^�^�5J�5J�5L�0M�N�0M�1�A�J�J�0M��N��
�
�"�"�7�-=�#=�>�����	����E�!�
.�+�0�0�2��!�	��e�
#��I�	
��� � �"��I�u�,�,��/O��!�
.�(��-���
.�s�C�C�	C3�C.�.C3c��t|t�rI|jj|�}|j	�|js|j�yy|jj|jd�}|�X|jr&|jj|j�y|jj|j�yyr)
ra�intr�rcr)r�r[rOrPrFrd�
set_resultrQ)rr�r�rhs    rr�z*_ExecutorManagerThread.process_result_item�s����k�3�'����"�"�;�/�A�
�F�F�H��>�>��,�,�.��"�
�/�/�3�3�K�4G�4G��N�I��$��(�(��$�$�2�2�;�3H�3H�I��$�$�/�/��0B�0B�C�	%rc�V�|j�}txs|duxs|jSr)r�r%�_shutdown_thread)rr�s  rr�z'_ExecutorManagerThread.is_shutting_down�s4���*�*�,��
!�-�H��$4�-��,�,�	.rc�B�|j�}|�d|_d|_d}td�}|�#t	ddj|��d��|_|jj�D]"\}}	|jj|�~�$|jj�|jj�D]}|j!��|j"j%�|j'd��y#tj$rY��wxYw)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''')�broken)r��_brokenr��BrokenProcessPoolr1r)rBr[r(rFrdr�InvalidStateErrorrr�r��	terminater��_terminate_broken�_join_executor_internals)rr�r��bperOrhr�s       rr�z(_ExecutorManagerThread._terminate_broken�s!���*�*�,����!1�H��)-�H�%��H� �!6�7����,��"�'�'�%�.�)��-�/�C�M�#'�"9�"9�"?�"?�"A��G�Y�
�� � �.�.�s�3��#B�	
���%�%�'����&�&�(�A�
�K�K�M�)�	
���)�)�+�	
�%�%�T�%�2��%�*�*�
�
�
�s�4D�D�Dc�h�|j5|j|�ddd�y#1swYyxYwr)r\r�)rr�s  rr�z'_ExecutorManagerThread.terminate_brokens%��
�
�
��"�"�5�)� �
�
�s�(�1c�d�|j�}|�}d|_|jrii}|jj	�D]%\}}|j
j
�r�!|||<�'||_		|jj��yyy#tj$rYnwxYwd|_�$r�)r�r��_cancel_pending_futuresr[r(rF�cancelr��
get_nowaitr�r�)rr��new_pending_work_itemsrOrhs     rr�z2_ExecutorManagerThread.flag_executor_shutting_downs����*�*�,����(,�H�%��/�/�*,�&�*.�*A�*A�*G�*G�*I�&�G�Y�$�+�+�2�2�4�:C�.�w�7�+J�+A��'����+�+�6�6�8���0� �� !�;�;�����49��0�s�3B�B'�&B'c�,�|j�}d}||krc|j�dkDrOt||z
�D]#}	|jjd�|dz
}�%||kr|j�dkDr�Myyyy#tj
$rY�3wxYw)Nrr.)�get_n_children_alive�ranger��
put_nowaitr��Full)r�n_children_to_stop�n_sentinels_sent�is    r�shutdown_workersz'_ExecutorManagerThread.shutdown_workers0s���!�6�6�8���� �"4�4��-�-�/�!�3��-�0@�@�A����O�O�.�.�t�4�$��)�$�B� �"4�4��-�-�/�!�3�5�3�5���z�z����s� A<�<B�Bc�f�|j5|j�ddd�y#1swYyxYwr)r\r�rs rr�z._ExecutorManagerThread.join_executor_internals>s#��
�
�
��)�)�+� �
�
�s�'�0c�F�|s|j�|jj�|jj�|jj�|j
j
�D]$}|r|j�|j��&yr)	r�r�r�join_threadr+r�r�r�r))rr�r�s   rr�z/_ExecutorManagerThread._join_executor_internalsBss����!�!�#�	
���������#�#�%���� � �"����&�&�(�A�����
�
�F�F�H�)rc�V�td�|jj�D��S)Nc3�<K�|]}|j����y�wr)�is_alive)�.0r�s  r�	<genexpr>z>_ExecutorManagerThread.get_n_children_alive.<locals>.<genexpr>Us����A�)@�A�1�:�:�<�)@�s�)�sumr�r�rs rr�z+_ExecutorManagerThread.get_n_children_aliveSs ���A����)>�)>�)@�A�A�Ar)F)r r!r"rr�r�r�r�r�r�r�r�r�r�r�r�rirjs@rr�r�sO���	�-�^2�h�.!-�FD�..�-3�^*�9�4�,��"Brr�c��trtrtt��da	ddl}	tjd�}|dk(ry|dk\ryd|zatt��#t$rdatt��wxYw#ttf$rYywxYw)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�\s�����%�o�6�6�!��3�*���J�J�1�2�	��B��	��C��	�4�6?�@�O�
�o�
.�.��+�3�
F�	�"�/�2�2�3��
�J�'����s�A�A7�A4�7B	�B	c#�lK�	|D]*}|j�|s�|j���|r��,y�wr)�reverserc)�iterable�elements  r�_chain_from_iterable_of_listsr�|s5�����
��������+�+�-����s�4�4�4c��eZdZy)r�N)r r!r"r#rrr�r��s��rr�c���eZdZ		ddd�d�Zd�Zd�Zd�Zd�Zd�Ze	jjje_dd	d
��fd�
Zddd
�d�Z
e	jjje
_�xZS)�ProcessPoolExecutorN)r�c��	t�|�Ptj�xsd|_tj
dk(ret
t|j�|_nE|dkrtd��tj
dk(r|tkDrtdt����||_|�,|�tjd�}ntj�}||_|jjd��d	k7|_
|�t|�std
��||_||_|�Ut%|t&�std��|dkrtd��|jjd��d	k(rtd
��||_d|_i|_d|_t1j2�|_t1j6d�|_d|_d|_i|_d|_ tC�|_"|jtFz}tI||j|j>|j4|jD��|_%d|jJ_&|jO�|_(tSjT�|_+y)Nr.�win32rz"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_workers�sys�platform�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__�sf��	�$	���� "���� 3�!�D���|�|�w�&�$'�(<�(,�(9�(9�%;��!��a�� �!E�F�F��,�,�'�)��2�2� �-�.B�-C�D�F�F�!,�D����"�.��^�^�G�4�
��^�^�-�
�%���� � �1�1�U�1�C�v�M�	
�0��"�8�K�+@��<�=�=�'���!����*��1�3�7�� H�I�I�$��)� �!C�D�D����0�0�E�0�B�f�L� �"C�D�D�%8��!�)-��%����!&���'�n�n�.���&/�&9�&9�!�&<��#�������#%�� �',��$�0=���,��&�&�);�;�
�%��T�%5�%5�#�7�7��-�-��>�>�	@���*.����&�'�3�3�5��������rc���|j�d|js|j�t|�|_|jj	�|j
t|j<yyr)rr�_launch_processesr��startr�r'rs r�_start_executor_manager_threadz2ProcessPoolExecutor._start_executor_manager_thread�s`���(�(�0��;�;��&�&�(�,B�4�,H�D�)��)�)�/�/�1��4�4�
�T�:�:�;�
1rc��|jjd��ryt|j�}||jkr|j�yy)NF)�blocking)r��acquire�lenr�r	�_spawn_process)r�
process_counts  rr�z)ProcessPoolExecutor._adjust_process_countsK���&�&�.�.��.�>���D�O�O�,�
��4�,�,�,�
���!�-rc��tt|j�|j�D]}|j	��yr)r�r(r�r	r))rr*s  rr"z%ProcessPoolExecutor._launch_processess1��
�s�4�?�?�+�T�->�->�?�A����!�@rc��|jjt|j|j|j
|j|jf��}|j�||j|j<y)N)�targetrH)r�Processr�r�r�rrr�r#r��pid)rr�s  rr)z"ProcessPoolExecutor._spawn_processsm�����$�$�"��"�"��$�$��#�#��.�.��+�+�	-�
%�
.��	
���	�!"�������rc�R�|j5|jrt|j��|jrt	d��t
rt	d��t
j�}t||||�}||j|j<|jj|j�|xjdz
c_
|jj�|jr|j!�|j#�|cddd�S#1swYyxYw)Nz*cannot schedule new futures after shutdownz6cannot schedule new futures after interpreter shutdownr.)r�r�r�r��RuntimeErrorr%r�FuturerDr�rr�ryr�rrr�r$)rrGrHrI�f�ws      r�submitzProcessPoolExecutor.submit*s���
�
 �
 ��|�|�'����5�5��$�$�"�#O�P�P��"�$:�;�;�����A��!�R��v�.�A�:;�D�$�$�T�%6�%6�7��N�N���t�0�0�1�����"���0�0�7�7�9��7�7��*�*�,��/�/�1��+	�	�
 �
 �s�DD�D&r.)�timeoutrpc���	|dkrtd��t�|�	tt|�t|d|i�|��}t
|�S)Nr.zchunksize must be >= 1.rp)r6)r�r]�maprrvrtr�)rrGr6rprq�resultsr_s      �rr8zProcessPoolExecutor.mapCsV���	�(�q�=��6�7�7��'�+�g�n�b�9�)�9�J�	�J�&-��/��-�W�5�5rF)�cancel_futuresc��|j5||_d|_|j�|jj	�ddd�|j
�|r|j
j
�d|_d|_|j�|r|jj�d|_d|_
d|_y#1swY�}xYwr)r�r�r�r�rrr)r�r�rr�)rr�r:s   r�shutdownzProcessPoolExecutor.shutdown`s���
�
 �
 �+9�D�(�$(�D�!��3�3�?��4�4�;�;�=�!��(�(�4���)�)�.�.�0�)-��%�������)�d����$�$�&�!������/3��,�#!�
 �s�5B>�>C)NNNr#)T)r r!r"rr$r�r"r)r5r�Executor�__doc__r8r<rirjs@rrr�s~���48�,.�l'�GK�l'�\5�
"�"�	#��.�^�^�*�*�2�2�F�N�*.�!�6�:4�E�4�(�~�~�.�.�6�6�H��rrrSr)1�
__author__r��concurrent.futuresrr�r�r�multiprocessing.connection�multiprocessing.queuesrrr��	functoolsrrnr
�	tracebackr�WeakKeyDictionaryr'r%rr-�_register_atexitrr
�	Exceptionr1r8r?�objectrDrMrUrXrtrvr|r��Threadr�r�r�r�r��BrokenExecutorr�r=rr#rr�<module>rKs?��(�T2�
�	�$���"�(�����
�&�-�7�,�,�.����*�*�4��	���<�(������y��	1�	1�����!�&�!����3��3�2�	)�DH�"�	9�3�l|B�Y�-�-�|B�~	����/�@	 ���,�,��e7�%�.�.�e7r

?>