
    &`i                         d dl mZmZ d dlmZmZmZmZmZm	Z	 d dl
mZ  G d de          Z G d d          Z e            ZdS )	    )Enumauto)AnyCallableDictListOptionalUnion)
cli_loggerc                       e Zd ZdZ e            Z e            Z e            Z e            Z e            Z	 e            Z
 e            Z e            Z e            Z e            Z e            ZdS )CreateClusterEventa  Events to track in ray.autoscaler.sdk.create_or_update_cluster.

    Attributes:
        up_started : Invoked at the beginning of create_or_update_cluster.
        ssh_keypair_downloaded : Invoked when the ssh keypair is downloaded.
        cluster_booting_started : Invoked when when the cluster booting starts.
        acquiring_new_head_node : Invoked before the head node is acquired.
        head_node_acquired : Invoked after the head node is acquired.
        ssh_control_acquired : Invoked when the node is being updated.
        run_initialization_cmd : Invoked before all initialization
            commands are called and again before each initialization command.
        run_setup_cmd : Invoked before all setup commands are
            called and again before each setup command.
        start_ray_runtime : Invoked before ray start commands are run.
        start_ray_runtime_completed : Invoked after ray start commands
            are run.
        cluster_booting_completed : Invoked after cluster booting
            is completed.
    N)__name__
__module____qualname____doc__r   
up_startedssh_keypair_downloadedcluster_booting_startedacquiring_new_head_nodehead_node_acquiredssh_control_acquiredrun_initialization_cmdrun_setup_cmdstart_ray_runtimestart_ray_runtime_completedcluster_booting_completed     x/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/ray/autoscaler/_private/event_system.pyr   r      s         ( J!TVV"dff"dff466!TVVDFFM"&$&& $r   r   c            	           e Zd ZdZd Zdedeeegdf         e	eegdf                  f         fdZ
	 d
dedeeeef                  fdZdefd	ZdS )_EventSystemzEvent system that handles storing and calling callbacks for events.

    Attributes:
        callback_map (Dict[str, List[Callable]]) : Stores list of callbacks
            for events when registered.
    c                     i | _         d S Ncallback_map)selfs    r   __init__z_EventSystem.__init__1   s    r   eventcallbackNc                    |t           j                                        vrt          j        | d           | j                            |g                               t          |          t          ur|gn|           dS )ag  Stores callback handler for event.

        Args:
            event: Event that callback should be called on. See
                CreateClusterEvent for details on the events available to be
                registered against.
            callback (Callable[[Dict], None]): Callable object that is invoked
                when specified event occurs.
        zA is not currently tracked, and this callback will not be invoked.N)
r   __members__valuesr   warningr%   
setdefaultextendtypelist)r&   r(   r)   s      r   add_callback_handlerz!_EventSystem.add_callback_handler4   s     *6==???? 1 1 1  
 	$$UB//66x..44XJJ(	
 	
 	
 	
 	
r   
event_datac                 d    |i }||d<   || j         v r| j         |         D ]} ||           dS dS )a:  Executes all callbacks for event.

        Args:
            event: Event that is invoked. See CreateClusterEvent
                for details on the available events.
            event_data (Dict[str, Any]): Argument that is passed to each
                callable object stored for this particular event.
        N
event_namer$   )r&   r(   r3   r)   s       r   execute_callbackz_EventSystem.execute_callbackL   sc     J#(
< D%%% -e4 % %$$$$ &%% %r   c                 ,    || j         v r
| j         |= dS dS )zClears stored callable objects for event.

        Args:
            event: Event that has callable objects stored in map.
                See CreateClusterEvent for details on the available events.
        Nr$   )r&   r(   s     r   clear_callbacks_for_eventz&_EventSystem.clear_callbacks_for_event_   s+     D%%%!%((( &%r   r#   )r   r   r   r   r'   strr
   r   r   r   r2   r   r	   r   r6   r8   r   r   r   r!   r!   )   s           

 $.Xtfdl5K0LLM
 
 
 
2 QU% %'%5=d38n5M% % % %&)s ) ) ) ) ) )r   r!   N)enumr   r   typingr   r   r   r   r	   r
   "ray.autoscaler._private.cli_loggerr   r   r!   global_event_systemr   r   r   <module>r>      s            = = = = = = = = = = = = = = = = 9 9 9 9 9 9' ' ' ' ' ' ' 'D>) >) >) >) >) >) >) >)B #lnn   r   