
    %`i                     H   d dl Z d dlmZ d dlmZ d dlmZmZ d dlm	Z	m
Z
mZmZmZmZmZmZmZmZmZmZmZmZmZmZmZ  e j        e          Zg dZd ZdZdZ d	Z!d	Z"g ej#        d
e fde fde!fde"fZ$dde%fdZ& G d d          Z'	 dde%de(de%de)de%dee%         fdZ*dS )    N)Optional)ray_constants)	ErrorType	JobConfig)ActorTableDataAvailableResourcesErrorTableDataGcsEntryGcsNodeInfoJobTableDataPlacementGroupTableDataPubSubMessageResourceDemandResourceLoadResourcesDataResourceUsageBatchDataTablePrefixTablePubsub
TaskEventsTotalResourcesWorkerTableData)r   r   r   r   r   r   r	   r   r
   r   r   r   r   r   r   r   r   r   r      i    i`  zgrpc.max_send_message_lengthzgrpc.max_receive_message_lengthzgrpc.keepalive_time_mszgrpc.keepalive_timeout_msFaddressc                 4    ddl m}  || t          |          S )zReturns a GRPC channel to GCS.

    Args:
        address: GCS address string, e.g. ip:port
        aio: Whether using grpc.aio
    Returns:
        grpc.Channel or grpc.aio.Channel to GCS
    r   )init_grpc_channel)optionsasynchronous)ray._private.grpc_utilsr   _GRPC_OPTIONS)r   aior   s      j/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/ray/_private/gcs_utils.pycreate_gcs_channelr"   I   s.     :99999Wm#NNNN    c                   N    e Zd Zd	dee         defdZed             Zd Z	d Z
dS )

GcsChannelNFgcs_addressr    c                 "    || _         || _        d S N)_gcs_address_aio)selfr&   r    s      r!   __init__zGcsChannel.__init__X   s    '			r#   c                     | j         S r(   )r)   r+   s    r!   r   zGcsChannel.address\   s      r#   c                 D    t          | j        | j                  | _        d S r(   )r"   r)   r*   _channelr.   s    r!   connectzGcsChannel.connect`   s     +4+<diHHr#   c                     | j         S r(   )r0   r.   s    r!   channelzGcsChannel.channelf   s
    }r#   )NF)__name__
__module____qualname__r   strboolr,   propertyr   r1   r3    r#   r!   r%   r%   W   s{         HSM t     ! ! X!I I I    r#   r%   hostportpassworduse_sslstorage_namespaceusernamec                    ddl m} t          | t                    st	          d          |d}t          |t                    st	          d          t          |t                    st	          d          |dk     rt	          d|           t          |t
                    st          d	          t          |t                    st	          d
           || |||||          S )a  This function is used to cleanup the GCS storage in Redis.
    It supports Redis in cluster and non-cluster modes.

    Args:
       host: The Redis host address.
       port: The Redis port.
       username: The Redis username.
       password: The Redis password.
       use_ssl: Whether to encrypt the connection.
       storage_namespace: The namespace of the storage to be deleted.
    r   )del_key_prefix_from_storagezHost must be a stringN zUsername must be a stringzPassword must be a stringzInvalid port: zuse_ssl must be a booleanz"storage namespace must be a string)ray._rayletrB   
isinstancer7   
ValueErrorr8   	TypeError)r;   r<   r=   r>   r?   r@   rB   s          r!   cleanup_redis_storagerH   j   s   ( 877777dC   20111h$$ 64555h$$ 64555axx0$00111gt$$ 53444'-- ?=>>> '&dHh1B  r#   )Fr(   )+loggingtypingr   ray._privater   ray.core.generated.common_pb2r   r   ray.core.generated.gcs_pb2r   r   r	   r
   r   r   r   r   r   r   r   r   r   r   r   r   r   	getLoggerr4   logger__all__WORKERDRIVER_MAX_MESSAGE_LENGTH_GRPC_KEEPALIVE_TIME_MS_GRPC_KEEPALIVE_TIMEOUT_MSGLOBAL_GRPC_OPTIONSr   r7   r"   r%   intr8   rH   r:   r#   r!   <module>rX      sO          & & & & & & > > > > > > > >                                     ( 
	8	$	$  . 
	
 ( # & 
&#%89 '(;< 67	
 !"<=O O O O O O       2 #1 1
1
1 1 	1
 1 sm1 1 1 1 1 1r#   