
    i	                         d dl mZ d dlZd dlmZmZ 	 d dlmZ n# e	$ r dZY nw xY w G d de          Z
 G d de
          Z G d	 d
e
          ZdS )    )abstractmethodN)BaseExecutorrun_job)BrokenProcessPoolc                   <     e Zd Ze fd            Zd ZddZ xZS )BasePoolExecutorc                 d    t          t          |                                            || _        d S N)superr   __init___pool)selfpool	__class__s     j/var/www/html/crypto-mining-system/backend/venv/lib/python3.11/site-packages/apscheduler/executors/pool.pyr   zBasePoolExecutor.__init__   s+    %%..000


    c                      fd}	  j                             t          j        | j        j                  }n# t          $ rx  j                            d            j                              j         j	                   _          j                             t          j        | j        j                  }Y nw xY w|
                    |           d S )Nc                 ^   t          | d          r|                                 n6|                                 t          |                                 dd           f\  }}|r                    j        ||           d S                     j        |                                            d S )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   s    -4Q8H-I-I Vq'')))wq{{}}ot'T'TU C :##CFC44444%%cfahhjj9999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0CYPTP\PabbAA  	c 	c 	cL  !_```--dj.EFFDJ
!!'30CYPTP\PabbAAA	c
 	
H%%%%%s   2= A?B?>B?Tc                 :    | j                             |           d S 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      se            ^& & &$" " " " " " " "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
    
   Nc                     |pi }t          j        j        t          |          fi |}t	          t          |                               |           d S r
   )
concurrentfuturesr5   intr   r   r   max_workerspool_kwargsr   r   s       r   r   zThreadPoolExecutor.__init__3   sU    !'R!4S5E5EUUUU $''0066666r   r6   Nr/   r0   r1   __doc__r   r2   r3   s   @r   r5   r5   (   sG         7 7 7 7 7 7 7 7 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
    r6   Nc                     |pi }t          j        j        t          |          fi |}t	          t          |                               |           d S r
   )r8   r9   rB   r:   r   r   r;   s       r   r   zProcessPoolExecutor.__init__D   sU    !'R!5c+6F6FVV+VV!4((11$77777r   r>   r?   r3   s   @r   rB   rB   9   sG         8 8 8 8 8 8 8 8 8 8r   rB   )abcr   concurrent.futuresr8   apscheduler.executors.baser   r   concurrent.futures.processr   ImportErrorr   r5   rB    r   r   <module>rJ      s             < < < < < < < <<<<<<<<   " " " " "| " " "87 7 7 7 7) 7 7 7"8 8 8 8 8* 8 8 8 8 8s    %%