a
    h                     @   sp   d dl Z d dlmZ d dlmZmZ d dlmZ dgZdZ	ee
ed dd	d
Zeeed dddZdS )    N)	Generator)contextmanager	ExitStack)recordworker_mainTORCH_WORKER_SERVER_SOCKET)NNN)socket_pathreturnc                 c   s6   ddl m} || }zd V  W |  n
|  0 d S )Nr   )_WorkerServer)Ztorch._C._distributed_c10dr
   shutdown)r   r
   server r   U/var/www/auris/lib/python3.9/site-packages/torch/distributed/elastic/control_plane.py_worker_server   s
    r   )r	   c                  c   sR   t  8} tjt}|dur*| t| dV  W d   n1 sD0    Y  dS )a{  
    This is a context manager that wraps your main entry function. This combines
    the existing ``errors.record`` logic as well as a new ``_WorkerServer`` that
    exposes handlers via a unix socket specified by
    ``Torch_WORKER_SERVER_SOCKET``.

    Example

    ::

     @worker_main()
     def main():
         pass


     if __name__ == "__main__":
         main()

    N)r   osenvirongetr   enter_contextr   )stackr   r   r   r   r      s
    )r   collections.abcr   
contextlibr   r   Z0torch.distributed.elastic.multiprocessing.errorsr   __all__r   strr   r   r   r   r   r   <module>   s   
