
    &`i                        U d dl Z d dlZd dlmZ d dlmZ d dlmZ dade	d<    ej
                    Z ee j                            dd                    Z ee j                            d	d                    Z ee j                            d
d                    Z ee j                            dd                    Z ee j                            dd                    Z ee j                            dd                    Z ee j                            dd                    Z ee j                            dd                     Zee G d d                                  ZdS )    N)	dataclass)Optional)DeveloperAPIzOptional[DAGContext]_default_contextRAY_CGRAPH_submit_timeout
   RAY_CGRAPH_get_timeoutRAY_CGRAPH_teardown_timeout   #RAY_CGRAPH_read_iteration_timeout_sg?RAY_CGRAPH_buffer_size_bytesg    .A"RAY_CGRAPH_max_inflight_executionsRAY_CGRAPH_max_buffered_resultsi  $RAY_CGRAPH_overlap_gpu_communicationc                       e Zd ZU dZeZeed<   eZ	eed<   e
Zeed<   eZeed<   eZeed<   eZeed<   eZeed<   eZeed	<   d
 Zedd            ZdS )
DAGContexta  Global settings for Ray DAG.

    You can configure parameters in the DAGContext by setting the environment
    variables, `RAY_CGRAPH_<param>` (e.g., `RAY_CGRAPH_buffer_size_bytes`) or Python.

    Examples:
        >>> from ray.dag import DAGContext
        >>> DAGContext.get_current().buffer_size_bytes
        1000000
        >>> DAGContext.get_current().buffer_size_bytes = 500
        >>> DAGContext.get_current().buffer_size_bytes
        500

    Args:
        submit_timeout: The maximum time in seconds to wait for execute()
            calls.
        get_timeout: The maximum time in seconds to wait when retrieving
            a result from the DAG during `ray.get`. This should be set to a
            value higher than the expected time to execute the entire DAG.
        teardown_timeout: The maximum time in seconds to wait for the DAG to
            cleanly shut down.
        read_iteration_timeout: The timeout in seconds for each read iteration
            that reads one of the input channels. If the timeout is reached, the
            read operation will be interrupted and will try to read the next
            input channel. It must be less than or equal to `get_timeout`.
        buffer_size_bytes: The initial buffer size in bytes for messages
            that can be passed between tasks in the DAG. The buffers will
            be automatically resized if larger messages are written to the
            channel.
        max_inflight_executions: The maximum number of in-flight executions that
            can be submitted via `execute` or `execute_async` before consuming
            the output using `ray.get()`. If the caller submits more executions,
            `RayCgraphCapacityExceeded` is raised.
        overlap_gpu_communication: (experimental) Whether to overlap GPU
            communication with computation during DAG execution. If True, the
            communication and computation can be overlapped, which can improve
            the performance of the DAG execution.
    submit_timeoutget_timeoutteardown_timeoutread_iteration_timeoutbuffer_size_bytesmax_inflight_executionsmax_buffered_resultsoverlap_gpu_communicationc                 f    | j         | j        k    r t          d| j          d| j         d          d S )Nz%RAY_CGRAPH_read_iteration_timeout_s (z8) must be less than or equal to RAY_CGRAPH_get_timeout ())r   r   
ValueError)selfs    c/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/ray/dag/context.py__post_init__zDAGContext.__post_init__W   sW    &)999?/? ?+/+;? ? ?   :9    returnc                  |    t           5  t          t                      at          cddd           S # 1 swxY w Y   dS )zGet or create a singleton context.

        If the context has not yet been created in this process, it will be
        initialized with default settings.
        N)_context_lockr   r    r!   r   get_currentzDAGContext.get_current_   s      	$ 	$'#-<< #		$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$s   155N)r"   r   )__name__
__module____qualname____doc__DEFAULT_SUBMIT_TIMEOUT_Sr   int__annotations__DEFAULT_GET_TIMEOUT_Sr   DEFAULT_TEARDOWN_TIMEOUT_Sr    DEFAULT_READ_ITERATION_TIMEOUT_Sr   floatDEFAULT_BUFFER_SIZE_BYTESr   DEFAULT_MAX_INFLIGHT_EXECUTIONSr   DEFAULT_MAX_BUFFERED_RESULTSr   !DEFAULT_OVERLAP_GPU_COMMUNICATIONr   boolr    staticmethodr&   r%   r!   r   r   r   $   s         % %N 3NC222,K,,,6c666$DEDDD6s666#BSBBB <#<<<&GtGGG   $ $ $ \$ $ $r!   r   )os	threadingdataclassesr   typingr   ray.util.annotationsr   r   r-   Lockr$   r,   environgetr+   r.   r/   r1   r0   r2   r3   r4   r6   r5   r   r%   r!   r   <module>r@      s   					     ! ! ! ! ! !       - - - - - - ,0 ( / / /	  3rz~~.I2NNOO BJNN+CRHHII  S0Mr!R!RSS #(5JNN8#>>$ $    C
/Ms S STT  #&#JNN7<<# # 
  #sJNN4d;;     %)DJNN91==% % !
 
F$ F$ F$ F$ F$ F$ F$  F$ F$ F$r!   