o
    ci,
                     @   s  d dl mZmZmZmZmZ d dlZd dlmZm	Z	 d dl
mZ d dlmZ d dlmZ d dlmZ eeZedd	e  d
d					d dddddededeeeef  dededededed deeeef  deeef fddZedd	e  dddd ZdS )!    )AnyDictListOptionalTupleN)_explicitly_enable_client_mode_set_client_hook_status)	JobConfig)
Deprecated)ray)get_ray_doc_versionzfUse ray.init(ray://<head_node_ip_address>:<ray_client_server_port>) instead. See detailed usage at {}.zhttps://docs.ray.io/en/z#/ray-core/package-ref.html#ray-init)messageF   )ignore_version_credentialsray_init_kwargsconn_strsecuremetadataconnection_retries
job_config	namespacer   r   zgrpc.ChannelCredentialsr   returnc                C   sf   t  r|dd}	|	rtd t  j S tdt	d t
  t j| ||||||||d	}
|
S )Nignore_reinit_errorFzfCalling ray.init() again after it has already been called. Reusing the existing Ray client connection.z`Ray Client is already connected. Maybe you called ray.init("ray://<address>") twice by accident?T)r   r   r   r   r   r   r   r   )r   is_connectedgetloggerinfoget_contextclient_workerconnection_infoRuntimeErrorr   r   connect)r   r   r   r   r   r   r   r   r   r   conn r$   K/home/ubuntu/.local/lib/python3.10/site-packages/ray/util/client_connect.pyr"      s0   r"   z5Use ray.shutdown() instead. See detailed usage at {}.z'/ray-core/package-ref.html#ray-shutdownc                   C   s   t  S )z'Disconnects from server; is idempotent.)r   
disconnectr$   r$   r$   r%   r&   E   s   r&   )FNr   NN)typingr   r   r   r   r   loggingray._private.client_mode_hookr   r   ray.job_configr	   ray.util.annotationsr
   ray.util.clientr   ray._private.utilsr   	getLogger__name__r   formatstrboolintr"   r&   r$   r$   r$   r%   <module>   sd    
	

/