
    &`iV                         d dl Z d dlmZ d dlmZ d dlmZ d dlmZ d dl	m
Z
 d dlmZ d dlmZ  e j        e          Ze G d	 d
e                      Ze G d de                      Zededefd            ZdS )    N)Callable)get_log_directory)DataContext)UserCodeException)log_once)DeveloperAPI)$_is_ray_debugger_post_mortem_enabledc                       e Zd ZdZdS )RayDataUserCodeExceptiona  Represents an Exception originating from user code, e.g.
    user-specified UDF used in a Ray Data transformation.

    By default, the frames corresponding to Ray Data internal files are
    omitted from the stack trace logged to stdout, but will still be
    emitted to the Ray Data specific log file. To emit all stack frames to stdout,
    set `DataContext.log_internal_stack_trace_to_stdout` to True.N__name__
__module____qualname____doc__     g/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/ray/data/exceptions.pyr   r      s        E E 	Dr   r   c                       e Zd ZdZdS )SystemExceptionzRepresents an Exception originating from Ray Data internal code
    or Ray Core private code paths, as opposed to user code. When
    Exceptions of this form are raised, it likely indicates a bug
    in Ray Data or Ray Core.Nr   r   r   r   r   r      s           
 	Dr   r   fnreturnc                       fd}|S )a  Decorator which runs the function, and if there is an exception raised,
    drops the stack trace before re-raising the exception. The original exception,
    including the full unmodified stack trace, is always written to the Ray Data
    log file at `data_exception_logger._log_path`.

    This is useful for stripping long stack traces of internal Ray Data code,
    which can otherwise obfuscate user code errors.c                  T   	  | i |S # t           $ r}t          j                    j        }t	                      rt
                              d           |t          |t                    }|r<|s9t          d          r*t
          
                    dt                       d           nt
          
                    d           |o| }t
                              ddd|i           |r|                    d           |                    d           t                      d }~ww xY w)	NzFull stack trace:"ray_data_exception_internal_hiddenzException occurred in user code, with the abbreviated stack trace below. By default, the Ray Data internal stack trace is omitted from stdout, and only written to the Ray Data log files at `zj`. To output the full stack trace to stdout, set `DataContext.log_internal_stack_trace_to_stdout` to True.zException occurred in Ray Data or Ray Core internal code. If you continue to see this error, please open an issue on the Ray project GitHub page with the full stack trace below: https://github.com/ray-project/ray/issues/new/chooseThide)exc_infoextra)	Exceptionr   get_current"log_internal_stack_trace_to_stdoutr	   logger	exception
isinstancer   r   errorr   with_tracebackr   )argskwargselog_to_stdoutis_user_code_exceptionshould_hide_tracebackr   s         r   handle_tracez+omit_traceback_stdout.<locals>.handle_trace/   s}   )	D2t&v&&& '	D '	D '	D (355XM355   !4555%/3D%E%E"% $ 2V)W)W LLT &7%8%8T T T   K   %;$P=?P!#45    
 & D&&t,,,&&t,,/2C2CCO'	Ds    D'DD""D'r   )r   r,   s   ` r   omit_traceback_stdoutr-   %   s*    *D *D *D *D *DX r   )loggingtypingr   ray.data._internal.loggingr   ray.data.contextr   ray.exceptionsr   ray.utilr   ray.util.annotationsr   ray.util.rpdbr	   	getLoggerr   r!   r   r   r   r-   r   r   r   <module>r7      sC          8 8 8 8 8 8 ( ( ( ( ( ( , , , , , ,       - - - - - - > > > > > >		8	$	$ 		 		 		 		 		0 		 		 		 	 	 	 	 	i 	 	 	 5h 58 5 5 5 5 5 5r   