
    קgq
                         d dl mZ d dlZd dlmZ ddlmZmZ ddlm	Z	 d Z
ej        d             Zd	 Z G d
 d          ZdS )    )partialN)Future   )	functions	rpc_async)UNSET_RPC_TIMEOUTc                 R     t          |                                 |          |i |S Ngetattrlocal_valuerref	func_nameargskwargss       \/var/www/html/ai-engine/env/lib/python3.11/site-packages/torch/distributed/rpc/rref_proxy.py_local_invoker      s-    174##%%y114B6BBB    c                 R     t          |                                 |          |i |S r
   r   r   s       r   _local_invoke_async_executionr      s-    174##%%y114B6BBBr   c                    	
  fd	                      d          }t          k    r|                                  	|          S t                      
	
fd}
fd|                    |           
S )Nc                 R   |                                  }t          }t          |t          j        j                  pt          |t          j        j                  }|s't          |          }t          |d          rt          } 	
                                |	f
          S )N_wrapped_async_rpc_function)r   timeout)valuer   
issubclasstorchjitScriptModule_Cr   hasattrr   owner)rref_fut	rref_type_invoke_funcbypass_typefuncr   r   r   rpc_apir   r   s        r   _rref_type_contz$_invoke_rpc.<locals>._rref_type_cont   s    NN$$	$ EI,BCC 
zux,H
 H
  	=9i00Dt:;; =<wJJLL	40	
 
 
 	
r   F)r   blockingc                     	  |                                           d S # t          $ r }                    |           Y d }~d S d }~ww xY wr
   )thenBaseExceptionset_exception)futex_complete_opr*   results     r   _wrap_rref_type_contz)_invoke_rpc.<locals>._wrap_rref_type_cont5   sq    )$$)),77777  ) ) )$$R((((((((()s   # 
AAAc                     	                      |                                            d S # t          $ r }                    |           Y d }~d S d }~ww xY wr
   )
set_resultr   r.   r/   )r0   r1   r3   s     r   r2   z!_invoke_rpc.<locals>._complete_op;   so    )!!#))++.....  ) ) )$$R((((((((()s   ', 
AAA)	_get_typer   waitr   r-   )r   r)   r   r   r   r   r$   r4   r2   r*   r3   s   ``````  @@@r   _invoke_rpcr9      s    
 
 
 
 
 
 
 
 
 
( ~~g~>>H)x(((  	) 	) 	) 	) 	) 	) 	)	) 	) 	) 	) 	) 	*+++r   c                       e Zd ZefdZd ZdS )	RRefProxyc                 0    || _         || _        || _        d S r
   )r   r)   rpc_timeout)selfr   r)   r   s       r   __init__zRRefProxy.__init__H   s    	"r   c                 P    t          t          | j        | j        || j                  S r
   )r   r9   r   r)   r=   )r>   r   s     r   __getattr__zRRefProxy.__getattr__M   s&    DL)T=M
 
 	
r   N)__name__
__module____qualname__r   r?   rA    r   r   r;   r;   G   s:        .? # # # #

 
 
 
 
r   r;   )	functoolsr   r   torch.futuresr    r   r   	constantsr   r   async_executionr   r9   r;   rE   r   r   <module>rK      s                       " " " " " " " " ( ( ( ( ( (C C C C C C. . .f	
 	
 	
 	
 	
 	
 	
 	
 	
 	
r   