[Core] add an option to log every function call to for debugging hang/crash in distributed inference (#4079)
Co-authored-by: Simon Mo <simon.mo@hey.com>
This commit is contained in:
27
tests/test_logger.py
Normal file
27
tests/test_logger.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import os
|
||||
import sys
|
||||
import tempfile
|
||||
|
||||
from vllm.logger import enable_trace_function_call
|
||||
|
||||
|
||||
def f1(x):
|
||||
return f2(x)
|
||||
|
||||
|
||||
def f2(x):
|
||||
return x
|
||||
|
||||
|
||||
def test_trace_function_call():
|
||||
fd, path = tempfile.mkstemp()
|
||||
cur_dir = os.path.dirname(__file__)
|
||||
enable_trace_function_call(path, cur_dir)
|
||||
f1(1)
|
||||
with open(path, 'r') as f:
|
||||
content = f.read()
|
||||
|
||||
assert "f1" in content
|
||||
assert "f2" in content
|
||||
sys.settrace(None)
|
||||
os.remove(path)
|
||||
Reference in New Issue
Block a user