o
    <ºiÁ  ã                   @   s:   d Z ddlZddlmZmZ ddlmZ G dd„ dƒZdS )z<Concurrency concepts that support efficient multi-threading.é    N)ÚExecutorÚThreadPoolExecutor)ÚConfigc                   @   sV   e Zd ZU dZedB ed< dZedB ed< ededB fdd„ƒZ	edefdd„ƒZ
dS )	ÚExecutorFactoryNÚ	_instanceÚ_instance_pidÚreturnc                   C   s   t ƒ  d¡S )z,Return the max number of workers configured.zmax-workers)r   Úget_int© r
   r
   úW/home/ubuntu/veenaModal/venv/lib/python3.10/site-packages/pyiceberg/utils/concurrent.pyÚmax_workers   s   zExecutorFactory.max_workersc                  C   sB   t jt ¡ krt ¡ t _dt _t jdu rt  ¡ } t| dt _t jS )z&Return the same executor in each call.N©r   )r   r   ÚosÚgetpidr   r   r   r   r
   r
   r   Úget_or_create"   s   

zExecutorFactory.get_or_create)Ú__name__Ú
__module__Ú__qualname__r   r   Ú__annotations__r   ÚintÚstaticmethodr   r   r
   r
   r
   r   r      s   
 r   )Ú__doc__r   Úconcurrent.futuresr   r   Úpyiceberg.utils.configr   r   r
   r
   r
   r   Ú<module>   s
   