o
    $i                     @   sD   d dl mZ d dlmZmZmZmZmZmZm	Z	 G dd de
ZdS )    )Dict)ClassMethodNode	ClassNodeDAGNodeFunctionNodeInputAttributeNode	InputNodeMultiOutputNodec                   @   s>   e Zd ZdZdd ZdefddZdd Zd	d
 Zdd Z	dS )_DAGNodeNameGeneratorz
    Generate unique suffix for each given Node in the DAG.
    Apply monotonic increasing id suffix for duplicated names.
    c                 C      t  | _d S Ndictname_to_suffixself r   J/home/ubuntu/veenaModal/venv/lib/python3.10/site-packages/ray/dag/utils.py__init__      z_DAGNodeNameGenerator.__init__nodec                 C   s   t |trdS t |trdS t |trd|j S t |tr*| dd p(|j}n0t |t	t
fr>| dd p<|jj}nt|jdv rJ| }nt|jdkrV|jj}ntd|| jvrfd| j|< |S | j|  d	7  < | j| }| d
| S )N
INPUT_NODEr	   INPUT_ATTRIBUTE_NODE_name)DeploymentNodeDeploymentFunctionNodeDeploymentFunctionExecutorNodez;get_node_name() should only be called on DAGNode instances.r      _)
isinstancer   r	   r   _keyr   get_optionsget_method_namer   r   _body__name__typeget_deployment_name_deployment_function_handledeployment_name
ValueErrorr   )r   r   	node_name
suffix_numr   r   r   get_node_name   s.   








z#_DAGNodeNameGenerator.get_node_namec                 C   r   r   r   r   r   r   r   reset;   r   z_DAGNodeNameGenerator.resetc                 C   s   | S r   r   r   r   r   r   	__enter__>   s   z_DAGNodeNameGenerator.__enter__c                 G   s   |    d S r   )r.   )r   argsr   r   r   __exit__A   r   z_DAGNodeNameGenerator.__exit__N)
r%   
__module____qualname____doc__r   r   r-   r.   r/   r1   r   r   r   r   r
      s    $r
   N)typingr   ray.dagr   r   r   r   r   r   r	   objectr
   r   r   r   r   <module>   s    $