
    &`i7                     H    d dl mZmZmZmZ d dlZi ZdedefdZd ZddZ	dS )	    )AnyDictHashableListNfnreturnc                     t          |          }t          |          }| |ft          vr>ddd}i ||}t          |            t	          j        di ||           t          | |f<   t          | |f         S )a  Lazily defines a ray.remote function.

    This is used in Datasets to avoid circular import issues with ray.remote.
    (ray imports ray.data in order to allow ``ray.data.read_foo()`` to work,
    which means ray.remote cannot be used top-level in ray.data).

    NOTE: Dynamic arguments should not be passed in directly,
    and should be set with ``options`` instead:
    ``cached_remote_fn(fn, **static_args).options(**dynamic_args)``.
    DEFAULT)scheduling_strategymax_retries )_make_hashablehashCACHED_FUNCTIONS%_add_system_error_to_retry_exceptionsrayremote)r   ray_remote_argshashable_args	args_hashdefault_ray_remote_argss        p/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/ray/data/_internal/remote_fn.pycached_remote_fnr      s    & #?33M]##I
I... $-#
 #
 I4HH-o>>>,ICJ,I,I,I,I",M,M"i)RO,,    c                 ~   t          | t          t          f          rt          d | D                       S t          | t                    r=d |                                 D             }t          t          |d                     S t          | t                    r| S t          dt          |            d          )Nc                 ,    g | ]}t          |          S r   r   ).0os     r   
<listcomp>z"_make_hashable.<locals>.<listcomp>1   s     555AnQ''555r   c                 P    g | ]#\  }}t          |          t          |          f$S r   r   )r   kvs      r   r!   z"_make_hashable.<locals>.<listcomp>3   s1    TTT1nQ''):):;TTTr   c                     | d         S )Nr   r   )ts    r   <lambda>z _make_hashable.<locals>.<lambda>4   s
    QqT r   )keyzType z is not hashable)	
isinstancer   tupler   itemssortedr   
ValueErrortype)obj	converteds     r   r   r   /   s    #e}%% >55555666	C		 >TT		TTT	VI>>:::;;;	C	"	" >
<c<<<===r   c                 :   |                      dd          }t          |t          t          f          sJ t          |t                    r8t          j        j        |vr%|                    t          j        j                   n|st          j        j        g}|| d<   dS )a  Modify the remote args so that Ray retries `RaySystemError`s.

    Ray typically automatically retries system errors. However, in some cases, Ray won't
    retry system errors if they're raised from task code. To ensure that Ray Data is
    fault tolerant to those errors, we need to add `RaySystemError` to the
    `retry_exceptions` list.

    TODO: Fix this in Ray Core. See https://github.com/ray-project/ray/pull/45079.
    retry_exceptionsFN)getr)   listboolr   
exceptionsRaySystemErrorappend)r   r2   s     r   r   r   ;   s     '**+=uEE&t55555 	#T**;N)1AAA =>>>> ;N9:*:O&'''r   )r   N)
typingr   r   r   r   r   r   r   r   r   r   r   r   <module>r:      s    , , , , , , , , , , , , 



 $- $-C $- $- $- $-N	> 	> 	>; ; ; ; ; ;r   