o
    
۾i
                  
   @   s   d dl Z d dlZd dlmZ d dlmZ eeZejZ	ej
e	dZz'ej
erEeeZee eZW d   n1 s?w   Y  ne ZW n e jy\   ede e ZY nw 			ddee dB dee dB dedB dee fd	d
ZdS )    N)init_loggerz ray_non_carry_over_env_vars.jsonzCFailed to parse %s. Using an empty set for non-carry-over env vars.exclude_varsadditional_varsdestinationreturnc                    sz    pt   |p	t  } fddt tj|D }|dur!d| nd}tdt td|dd	 |D  td
t |S )a  
    Get the environment variables to copy to downstream Ray actors.

    Example use cases:
    - Copy environment variables from RayDistributedExecutor to Ray workers.
    - Copy environment variables from RayDPClient to Ray DPEngineCoreActor.

    Args:
        exclude_vars: A set of vllm defined environment variables to exclude
            from copying.
        additional_vars: A set of additional environment variables to copy.
            If a variable is in both exclude_vars and additional_vars, it will
            be excluded.
        destination: The destination of the environment variables.
    Returns:
        A set of environment variables to copy.
    c                    s    h | ]}| vr|t vr|qS  )RAY_NON_CARRY_OVER_ENV_VARS.0vr   r   D/home/ubuntu/.local/lib/python3.10/site-packages/vllm/ray/ray_env.py	<setcomp>:   s
    z'get_env_vars_to_copy.<locals>.<setcomp>Nz to  z+RAY_NON_CARRY_OVER_ENV_VARS from config: %sz1Copying the following environment variables%s: %sc                 S   s   g | ]	}|t jv r|qS r   )osenvironr	   r   r   r   
<listcomp>H   s    z(get_env_vars_to_copy.<locals>.<listcomp>z=If certain env vars should NOT be copied, add them to %s file)setenvsenvironment_variablesunionloggerinfor    RAY_NON_CARRY_OVER_ENV_VARS_FILE)r   r   r   env_vars_to_copyto_destinationr   r   r   get_env_vars_to_copy!   s&   


r   )NNN)jsonr   	vllm.envsr   vllm.loggerr   __name__r   VLLM_CONFIG_ROOTCONFIG_HOMEpathjoinr   existsopenfr   loadr   JSONDecodeErrorwarningstrr   r   r   r   r   <module>   sH   

	

