
    (ph                     b    S r SSKJr  SSKr\R                  " \5      rS r " S S\5      r	S r
g)zFA thread pool that logs exceptions raised by tasks executed within it.    )futuresNc                    ^  U 4S jnU$ )z:Wraps an arbitrary callable behavior in exception-logging.c                  `   >  T" U 0 UD6$ ! [          a    [        R                  ST5        e f = f)Nz6Unexpected exception from %s executed in logging pool!)	Exception_LOGGER	exception)argskwargsbehaviors     Y/var/www/html/venv/lib/python3.13/site-packages/grpc/framework/foundation/logging_pool.py	_wrapping_wrap.<locals>._wrapping   s@    	T,V,, 	H 	s    "- )r   r   s   ` r   _wrapr      s         c                   @    \ rS rSrSrS rS rS rS rS r	SS jr
S	rg
)_LoggingPool&   zGAn exception-logging futures.ThreadPoolExecutor-compatible thread pool.c                     Xl         g N_backing_pool)selfbacking_pools     r   __init___LoggingPool.__init__)   s    )r   c                     U $ r   r   )r   s    r   	__enter___LoggingPool.__enter__,   s    r   c                 6    U R                   R                  SS9  g )NTwaitr   shutdown)r   exc_typeexc_valexc_tbs       r   __exit___LoggingPool.__exit__/       ###.r   c                 T    U R                   R                  " [        U5      /UQ70 UD6$ r   )r   submitr   )r   fnr	   r
   s       r   r,   _LoggingPool.submit2   s'    !!((rDTDVDDr   c                 t    U R                   R                  " [        U5      /UQ7SUR                  SS 5      06$ )Ntimeout)r   mapr   get)r   func	iterablesr
   s       r   r1   _LoggingPool.map5   s=    !!%%$K
#
-3ZZ	4-H
 	
r   c                 6    U R                   R                  US9  g )Nr!   r#   )r   r"   s     r   r$   _LoggingPool.shutdown:   r*   r   r   N)T)__name__
__module____qualname____firstlineno____doc__r   r   r(   r,   r1   r$   __static_attributes__r   r   r   r   r   &   s$    Q*/E

/r   r   c                 @    [        [        R                  " U 5      5      $ )a  Creates a thread pool that logs exceptions raised by the tasks within it.

Args:
  max_workers: The maximum number of worker threads to allow the pool.

Returns:
  A futures.ThreadPoolExecutor-compatible thread pool that logs exceptions
    raised by the tasks executed within it.
)r   r   ThreadPoolExecutor)max_workerss    r   poolrA   >   s     22;?@@r   )r<   
concurrentr   logging	getLoggerr8   r   r   objectr   rA   r   r   r   <module>rF      s8    M  


H
% /6 /0
Ar   