o
    پi                     @   s^   d dl Z d dlZd dlZd dlmZ d dlmZmZmZm	Z	 e 
eZdZG dd deZdS )    N)kill_process_tree)!DEFAULT_TIMEOUT_FOR_SERVER_LAUNCHDEFAULT_URL_FOR_TESTCustomTestCasepopen_launch_serverg?c                   @   sR   e Zd ZU dZdZeZeZg Z	e
e ed< eZeed< edd Zedd ZdS )	MMMUServerBasezServer fixture for MMMU VLM tests.

    This fixture handles server lifecycle for single-model MMMU tests.
    For multi-model tests that need to start/stop servers within test methods,
    use MMMUMultiModelTestBase instead.
    N
other_argsmem_fraction_staticc                 C   sb   | j d us	J dtj }d|d< dddddt| jg| j}t| j | j| j	| j
||d	| _d S )
Nz Please set cls.model in subclass1SGLANG_USE_CUDA_IPC_TRANSPORTz--trust-remote-codez--cuda-graph-max-bs64z--enable-multimodalz--mem-fraction-static)timeoutapi_keyr   env)modelosenvironcopystrr	   r   r   base_urlr   r   process)clsprocess_envserver_args r   \/home/ubuntu/.local/lib/python3.10/site-packages/sglang/test/server_fixtures/mmmu_fixture.py
setUpClass!   s(   

zMMMUServerBase.setUpClassc              
   C   sl   | j d ur/| j  d u r/zt| j j W n ty. } ztd|  W Y d }~nd }~ww td d S )NzError killing process:    )	r   pollr   pid	Exceptionloggererrortimesleep)r   er   r   r   tearDownClass=   s   zMMMUServerBase.tearDownClass)__name__
__module____qualname____doc__r   r   r   r   r   r   listr   __annotations__DEFAULT_MEM_FRACTION_STATICr	   floatclassmethodr   r&   r   r   r   r   r      s   
 
r   )loggingr   r#   sglang.srt.utilsr   sglang.test.test_utilsr   r   r   r   	getLoggerr'   r!   r-   r   r   r   r   r   <module>   s    
