
    df	                         d dl mZ d dlZd dlmZmZ 	 d dlmZ  G d de      Z
 G d de
      Z G d	 d
e
      Zy# e	$ r dZY +w xY w)    )abstractmethodN)BaseExecutorrun_job)BrokenProcessPoolc                   6     e Zd Ze fd       Zd ZddZ xZS )BasePoolExecutorc                 8    t         t        |           || _        y N)superr   __init___pool)selfpool	__class__s     S/home/api-vastappli/venv/lib/python3.12/site-packages/apscheduler/executors/pool.pyr   zBasePoolExecutor.__init__   s    .0
    c                      fd}	  j                   j                  t        j                  | j                  j
                        }|j                  |       y # t        $ r  j                  j                  d        j                   j                   j                   j                         _          j                   j                  t        j                  | j                  j
                        }Y w xY w)Nc                 .   t        | d      r| j                         n*| j                         t        | j                         dd       f\  }}|rj	                  j
                  ||       y j                  j
                  | j                                y )Nexception_info__traceback__)hasattrr   	exceptiongetattr_run_job_errorid_run_job_successresult)fexctbjobr   s      r   callbackz1BasePoolExecutor._do_submit_job.<locals>.callback   sr    -4Q8H-Iq'')wq{{}ot'TU C##CFFC4%%cffahhj9r   z<Process pool is broken; replacing pool with a fresh instance)r   submitr   _jobstore_alias_loggernamer   warningr   _max_workersadd_done_callback)r   r!   	run_timesr"   r   s   ``   r   _do_submit_jobzBasePoolExecutor._do_submit_job   s    	:	c

!!'30C0CYPTP\P\PaPabA 	
H% ! 	cLL  !_`--djj.E.EFDJ

!!'30C0CYPTP\P\PaPabA	cs   AA BC98C9c                 :    | j                   j                  |       y r
   )r   shutdown)r   waits     r   r-   zBasePoolExecutor.shutdown$   s    

D!r   )T)__name__
__module____qualname__r   r   r+   r-   __classcell__r   s   @r   r   r      s     &$"r   r   c                   $     e Zd ZdZd fd	Z xZS )ThreadPoolExecutora  
    An executor that runs jobs in a concurrent.futures thread pool.

    Plugin alias: ``threadpool``

    :param max_workers: the maximum number of spawned threads.
    :param pool_kwargs: dict of keyword arguments to pass to the underlying
        ThreadPoolExecutor constructor
    c                     |xs i }t        j                  j                  t        |      fi |}t        t        |   |       y r
   )
concurrentfuturesr5   intr   r   r   max_workerspool_kwargsr   r   s       r   r   zThreadPoolExecutor.__init__3   s=    !'R!!44S5EUU $06r   
   Nr/   r0   r1   __doc__r   r2   r3   s   @r   r5   r5   (   s    7 7r   r5   c                   $     e Zd ZdZd fd	Z xZS )ProcessPoolExecutora#  
    An executor that runs jobs in a concurrent.futures process pool.

    Plugin alias: ``processpool``

    :param max_workers: the maximum number of spawned processes.
    :param pool_kwargs: dict of keyword arguments to pass to the underlying
        ProcessPoolExecutor constructor
    c                     |xs i }t        j                  j                  t        |      fi |}t        t        |   |       y r
   )r7   r8   rB   r9   r   r   r:   s       r   r   zProcessPoolExecutor.__init__D   s=    !'R!!55c+6FV+V!41$7r   r=   r?   r3   s   @r   rB   rB   9   s    8 8r   rB   )abcr   concurrent.futuresr7   apscheduler.executors.baser   r   concurrent.futures.processr   ImportErrorr   r5   rB    r   r   <module>rJ      sT      <<
"| "87) 7"8* 8c  s   < AA