
    &`i*              	       p
   d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlmZm	Z	 d dl
Z
d dlmc mZ d dlmc mZ d dlmc mZ d dlmc mZ d dlmZmZ d dlmZ d dlmZ d dlm Z  d dl!m"Z"m#Z#  ej$        e%          Z& G d d	          Z'e%d
k    r e j(        d          Z)e)*                    dde+d           e)*                    dde,d           e)*                    dde,d d           e)*                    dde+d           e)*                    dde+d           e)*                    dde+d           e)*                    ddd ej-        ej.        ej/                   e)*                    d de+ej0        ej1                   e)*                    d!de+ej2        d"3                    ej2                             e)*                    d#de,ed$3                    e                     e)*                    d%de,ed&3                    e                     e)*                    d'de+dd(           e)*                    d)de+dd*           e)*                    d+de+dd,           e)*                    d-d.d/0           e)*                    d1ddd23           e)*                    d4d.d50           e)*                    d6de+d7d8           e)*                    d9de+d7d:           e)4                                Z5	 ej        d;k    re5j6        nd Z7ej        d;k    re5j8        nd<Z9 e e5j:        e5j;        e5j<        e5j=        e7e9=            ej>        e5j?        e5j@        e7e9           e5jA        r7 eBe5jA        C                    d>          D                    d?                    ZAndZA e            ZE e'dVi d@e5jF        dAe5jG        dBe5jH        dCe5jI        dDe5jJ        dEe5jK        dFe5j<        dGe5j:        dHe5j;        dIe5j=        dJe7dKe9dLe5jL        dMe5jM        dNe5jN        dOe5jO         dPeAZdQ ZPej        d;k    reEQ                    ejR        eP           eES                    eT                                           dS # eU$ rZV e" ejW                              ZXdR ejY                    d<          dSeX ZZ e[eVej\                  re&]                    eZ           ne&^                    eZ           eV e#ej_        eZe
j`        a                    e5jI        T          U           Y dZV[VdS dZV[Vww xY wdS )W    N)OptionalSet)LOGGING_ROTATE_BACKUP_COUNTLOGGING_ROTATE_BYTES)get_or_create_event_loop)logging_utils)setup_component_logger)format_error_messagepublish_error_to_driverc            %           e Zd ZdZ	 	 	 	 	 ddedededed	ed
edededededededededededeee                  f"dZ	d Z
dS )	Dashboarda5  A dashboard process for monitoring Ray nodes.

    This dashboard is made up of a REST API which collates data published by
        Reporter processes on nodes into a json structure, and a webserver
        which polls said API for display purposes.

    Args:
        host: Host address of dashboard aiohttp server.
        port: Port number of dashboard aiohttp server.
        port_retries: The retry times to select a valid port.
        gcs_address: GCS address of the cluster.
        cluster_id_hex: Cluster ID hex string.
        node_ip_address: The IP address of the dashboard.
        serve_frontend: If configured, frontend HTML
            is not served from the dashboard.
        log_dir: Log directory of dashboard.
        logging_level: The logging level (e.g. logging.INFO, logging.DEBUG)
        logging_format: The format string for log messages
        logging_filename: The name of the log file
        logging_rotate_bytes: Max size in bytes before rotating log file
        logging_rotate_backup_count: Number of backup files to keep when rotating
    NFThostportport_retriesgcs_addresscluster_id_hexnode_ip_addresslog_dirlogging_levellogging_formatlogging_filenamelogging_rotate_byteslogging_rotate_backup_counttemp_dirsession_dirminimalserve_frontendmodules_to_loadc                     t          j        di d|d|d|d|d|d|d|d|d	|	d
|
d|d|d|d|d|d|d|| _         d S )N	http_host	http_porthttp_port_retriesr   r   r   r   r   r   r   r   r   r   r   r   r   r    )dashboard_headDashboardHead)selfr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   s                     k/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/ray/dashboard/dashboard.py__init__zDashboard.__init__9   s    ( -: 
 
 
d
d
 +l
 $	

 *>
 ,O
 G
 (-
 *>
 .-
 "6!5
 )D(C
 X
 $
 G
  *>!
" ,O#
    c                 H   K   | j                                          d {V  d S N)r$   run)r&   s    r'   r,   zDashboard.runa   s3      !%%'''''''''''r)   )NNFTN)__name__
__module____qualname____doc__strintboolr   r   r(   r,   r#   r)   r'   r   r   !   s
        J #.2%&
 &
&
 &
 	&

 &
 &
 &
 &
 &
 &
 &
 "&
 &)&
 &
 &
  !&
" #&
$ "#c(+%&
 &
 &
 &
P( ( ( ( (r)   r   __main__zRay dashboard.)descriptionz--hostTz$The host to use for the HTTP server.)requiredtypehelpz--portz$The port to use for the HTTP server.z--port-retriesFz'The retry times to select a valid port.)r6   r7   defaultr8   z--gcs-addresszThe address (ip:port) of GCS.z--cluster-id-hexzThe cluster ID in hex.z--node-ip-addressz1The IP address of the node where this is running.z--logging-levelc                 N    t          j        |                                           S r+   )logginggetLevelNameupper)ss    r'   <lambda>r?      s    w+AGGII66 r)   )r6   r7   r9   choicesr8   z--logging-formatz--logging-filenamezISpecify the name of log file, log to stdout if set empty, default is "{}"z--logging-rotate-byteszASpecify the max bytes for rotating log file, default is {} bytes.z--logging-rotate-backup-countz<Specify the backup count of rotated log file, default is {}.z	--log-dirz"Specify the path of log directory.z
--temp-dirz?Specify the path of the temporary directory use by Ray process.z--session-dirz9Specify the path of the session directory of the cluster.z	--minimal
store_truezMinimal dashboard only contains a subset of features that don't require additional dependencies installed when ray is installed by `pip install ray[default]`.)actionr8   z--modules-to-loadzSpecify the list of module names in [module_1],[module_2] format.E.g., JobHead,StateHead... If nothing is specified, all modules are loaded.)r6   r9   r8   z--disable-frontendz;If configured, frontend html is not served from the server.z--stdout-filepath z&The filepath to dump dashboard stdout.z--stderr-filepathz&The filepath to dump dashboard stderr.win32   )r   r   r   filename	max_bytesbackup_countz ,,r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   c                  v    t                               d           t          j        t          j                   d S )Nz#Exiting with SIGTERM immediately...)loggerwarningos_exitsignalSIGTERMr#   r)   r'   sigterm_handlerrQ     s-    NN@AAAHV^$$$$$r)   zThe dashboard on node z" failed with the following error:
)address)
gcs_clientr#   )bargparser;   rM   platformrO   sys	tracebacktypingr   r   rayray._private.ray_constants_privateray_constantsray.dashboard.consts	dashboardconstsdashboard_constsray.dashboard.headheadr$   ray.dashboard.utilsutilsdashboard_utilsray._common.ray_constantsr   r   ray._common.utilsr   ray._privater   ray._private.ray_loggingr	   ray._private.utilsr
   r   	getLoggerr-   rK   r   ArgumentParserparseradd_argumentr1   r2   LOGGER_LEVELLOGGER_LEVEL_CHOICESLOGGER_LEVEL_HELPLOGGER_FORMATLOGGER_FORMAT_HELPDASHBOARD_LOG_FILENAMEformat
parse_argsargsr   logging_rotation_bytesr   logging_rotation_backup_countr   r   r   r    redirect_stdout_stderr_if_neededstdout_filepathstderr_filepathr   setstripsplitloopr   r   r   r   r   r   r   r   r   disable_frontendrQ   add_signal_handlerrP   run_until_completer,   	Exceptione
format_exctraceback_strunamemessage
isinstanceFrontendNotFoundErrorrL   errorDASHBOARD_DIED_ERROR_raylet	GcsClientr#   r)   r'   <module>r      s     				   



                     



 2 2 2 2 2 2 2 2 2 / / / / / / / / / + + + + + + + + + - - - - - - - - -        7 6 6 6 6 6 & & & & & & ; ; ; ; ; ;        
	8	$	$A( A( A( A( A( A( A( A(H z$X$1ABBBF
4c0V     4c0V     6     $S7V     T:R     @	     66*2,     +-      766<f37
 7
  	 	 	  $))/0D)E)E     '+KRR'
 
     1     N     H     -	     ?  	 	 	 K    
 5     5     DT
 *-)@)@D%%a 	 140G0GD,,Q 	& 	,.L*,6	
 	
 	
 	
 	76  ")		
 	
 	
  	#!c$"6"<"<T"B"B"H"H"M"MNNOO #O''))I 
 
 


 **
 ((	

  ..
 !00
 LL
 ,,
  ..
 "22
 "8!7
 )F(E
 ]]
 ((
 LL
  !% 555!
" ,O#
	(	% 	% 	% <7"" ##FNODDD	00000 
 
 
,,-AY-A-C-CDD'^X^%5%5a%8 ' '$' ' 	
 :a>?? 	NN7####LL!!!G 	 .{,,T5E,FF	
 	
 	
 	
 	
 	
 	
 	
 	
 	

K s   ;FR T3B"T..T3