@@ -57,7 +57,8 @@ def signal_handler(sig, frame):
5757 signal .signal (signal .SIGINT , signal_handler )
5858
5959 logger .info (f"start process pid { os .getpid ()} " )
60- logger .info (f"http server pid { http_server_process .pid } " )
60+ if http_server_process :
61+ logger .info (f"http server pid { http_server_process .pid } " )
6162 return
6263
6364
@@ -72,7 +73,7 @@ def check_and_set_args(args):
7273
7374 enable_mps ()
7475
75- if args .run_mode not in ["normal" , "prefill" , "decode" , "llm_only" , "visual_only " ]:
76+ if args .run_mode not in ["normal" , "prefill" , "decode" , "llm_only" , "visual " ]:
7677 return
7778
7879 assert args .zmq_mode in ["tcp://" , "ipc:///tmp/" ]
@@ -420,11 +421,9 @@ def pd_master_start(args):
420421 http_server_process .wait ()
421422
422423
423- def visual_only_start (args ):
424+ def visual_start (args ):
424425 check_and_set_args (args )
425- if args .run_mode != "visual_only" :
426- return
427- already_uesd_ports = args .visual_nccl_ports + [args .nccl_port , args .port ]
426+ already_uesd_ports = args .visual_nccl_ports + [args .nccl_port , args .remote_vit_port ]
428427 can_use_ports = alloc_can_use_network_port (
429428 num = 5 + args .visual_dp * args .visual_tp , used_nccl_ports = already_uesd_ports
430429 )
@@ -437,6 +436,7 @@ def visual_only_start(args):
437436 metric_port ,
438437 ) = can_use_ports [0 :5 ]
439438 can_use_ports = can_use_ports [5 :]
439+ print (cache_port )
440440
441441 visual_model_tp_ports = []
442442 for _ in range (args .visual_dp ):
@@ -456,13 +456,6 @@ def visual_only_start(args):
456456
457457 set_env_start_args (args )
458458
459- process_manager .start_submodule_processes (
460- start_funcs = [
461- start_metric_manager ,
462- ],
463- start_args = [(metric_port , args )],
464- )
465-
466459 from .visualserver .manager import start_visual_process
467460
468461 process_manager .start_submodule_processes (
@@ -476,58 +469,18 @@ def visual_only_start(args):
476469 start_visual_process ,
477470 ],
478471 start_args = [
479- (args , audio_port , visual_port , cache_port , visual_model_tp_ports ),
472+ (args , router_port , visual_port , cache_port , visual_model_tp_ports ),
480473 ],
481474 )
482- if args .enable_multimodal_audio :
483- from .audioserver .manager import start_audio_process
484-
485- process_manager .start_submodule_processes (
486- start_funcs = [
487- start_audio_process ,
488- ],
489- start_args = [
490- (args , router_port , audio_port , cache_port ),
491- ],
492- )
493-
494- # 启动 gunicorn
495- command = [
496- "gunicorn" ,
497- "--workers" ,
498- f"{ args .httpserver_workers } " ,
499- "--worker-class" ,
500- "uvicorn.workers.UvicornWorker" ,
501- "--bind" ,
502- f"{ args .host } :{ args .port } " ,
503- "--log-level" ,
504- "info" ,
505- "--access-logfile" ,
506- "-" ,
507- "--error-logfile" ,
508- "-" ,
509- "lightllm.server.api_http:app" ,
510- "--timeout" ,
511- f"{ get_lightllm_gunicorn_time_out_seconds ()} " ,
512- "--keep-alive" ,
513- f"{ get_lightllm_gunicorn_keep_alive ()} " ,
514- ]
515-
516- # 启动子进程
517- http_server_process = subprocess .Popen (command )
518-
519- if "s3://" in args .model_dir :
520- from lightllm .utils .petrel_helper import s3_model_clear
521-
522- s3_model_clear (args .model_dir )
523-
524- if args .health_monitor :
525- from lightllm .server .health_monitor .manager import start_health_check_process
526-
527- process_manager .start_submodule_processes (start_funcs = [start_health_check_process ], start_args = [(args ,)])
528- setup_signal_handlers (http_server_process , process_manager )
529- http_server_process .wait ()
530- return
475+ setup_signal_handlers (None , process_manager )
476+ try :
477+ while True :
478+ time .sleep (1 )
479+ except KeyboardInterrupt :
480+ logger .info ("Received keyboard interrupt, shutting down..." )
481+ process_manager .terminate_all_processes ()
482+ logger .info ("All processes have been terminated gracefully." )
483+ sys .exit (0 )
531484
532485
533486def config_server_start (args ):
0 commit comments