U
    Jc                     @   sB   d dl mZ d dlm  mZ dd Zdd Zejdee dS )    Nc                 K   s    ddl m} ||| ||||dS )N   !FaultyTensorPipeRpcBackendOptions)num_worker_threadsrpc_timeoutinit_methodmessages_to_failmessages_to_delaynum_fail_sends) r   )r   r   r   r   r	   r
   kwargsr    r   `/tmp/pip-unpacked-wheel-gikjz4vx/torch/distributed/rpc/_testing/faulty_agent_backend_registry.py8_faulty_tensorpipe_construct_rpc_backend_options_handler   s    	r   c           	      C   sx   ddl m} ddl m} ddlm} t| tjs>td	| t||sVtd	||| ||||i g }|
| |S )Nr   )FaultyTensorPipeAgentr   r   )apiz!`store` must be a c10d::Store. {}zG`rpc_backend_options` must be a `FaultyTensorPipeRpcBackendOptions`. {})r   r   r   torch.distributed.rpcr   
isinstancedistZStore	TypeErrorformatZ_init_rpc_states)	storenameZrankZ
world_sizeZrpc_backend_optionsr   r   r   Zagentr   r   r   '_faulty_tensorpipe_init_backend_handler   s2     	
r   ZFAULTY_TENSORPIPE)	Ztorch.distributedZdistributedr   r   Zrpcr   r   Zbackend_registryZregister_backendr   r   r   r   <module>   s   !