Skip to content

Commit 14303d0

Browse files
committed
fix orchestrator_type and llm async example
Signed-off-by: Superjomn <[email protected]>
1 parent 33a5513 commit 14303d0

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

tensorrt_llm/executor/rpc_proxy.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def __init__(
6868

6969
self.main_loop_task_obj = None
7070
self.main_loop = None
71+
self.main_loop_thread = None
7172

7273
self.launch_workers()
7374

@@ -337,7 +338,11 @@ def shutdown(self):
337338
logger_debug(f"Error cancelling main loop task: {e}",
338339
color="yellow")
339340

340-
self.main_loop_thread.join()
341+
# Only join if we're not calling from the main_loop_thread itself
342+
# (e.g., during garbage collection in that thread)
343+
if self.main_loop_thread and threading.current_thread(
344+
) != self.main_loop_thread:
345+
self.main_loop_thread.join()
341346

342347
# 3. shutdown the mpi session, this should wait until all the PyExecutor
343348
# processes are shutdown

tensorrt_llm/llmapi/llm_args.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from strenum import StrEnum
2222
from transformers import PreTrainedTokenizerBase
2323

24-
from tensorrt_llm.llmapi.utils import orchestrator_type_env
24+
from tensorrt_llm.llmapi.utils import logger_debug, orchestrator_type_env
2525
from tensorrt_llm.lora_helper import (LoraConfig,
2626
get_default_trtllm_modules_to_hf_modules)
2727

@@ -2095,19 +2095,21 @@ def validate_peft_cache_config(self):
20952095
"while LoRA prefetch is not supported")
20962096
return self
20972097

2098-
@field_validator('orchestrator_type', mode='before')
2099-
def validate_orchestrator_config(v):
2098+
@model_validator(mode='before')
2099+
def validate_orchestrator_config(cls, values):
21002100
# The environment variable will override the orchestrator_type field.
21012101
# TODO: remove the environment variable after RPC path is stable, then
21022102
# there will be only two stable options: None(RPC) and 'ray'.
21032103
if (ev := orchestrator_type_env()) is not None:
2104+
logger_debug(
2105+
f"changing orchestrator_type to {ev} from environment variable")
21042106
if ev not in ['rpc', 'ray']:
21052107
raise ValueError(
21062108
f"Invalid orchestrator type: {ev}. Please set orchestrator_type to 'rpc' or 'ray'."
21072109
)
2108-
v = ev
2110+
values['orchestrator_type'] = ev
21092111

2110-
return v
2112+
return values
21112113

21122114
def _update_plugin_config(self, key: str, value: Any):
21132115
setattr(self.build_config.plugin_config, key, value)

0 commit comments

Comments
 (0)