Skip to content

Commit

Permalink
[Misc] small fixes to function tracing file path (#9543)
Browse files Browse the repository at this point in the history
Signed-off-by: Shawn Du <[email protected]>
Signed-off-by: youkaichao <[email protected]>
Co-authored-by: youkaichao <[email protected]>
  • Loading branch information
ShawnD200 and youkaichao authored Nov 10, 2024
1 parent bfb7d61 commit 20cf2f5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,11 @@ Documentation
design/multimodal/multimodal_index
design/huggingface_integration

.. Contributing: contributing to the vLLM project
.. For Developers: contributing to the vLLM project
.. toctree::
:maxdepth: 2
:caption: Contributing
:caption: For Developers

contributing/overview
contributing/profiling/profiling_index
Expand Down
5 changes: 3 additions & 2 deletions vllm/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,14 @@ def _trace_calls(log_path, root_dir, frame, event, arg=None):
last_lineno = 0
last_func_name = ""
with open(log_path, 'a') as f:
ts = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S.%f")
if event == 'call':
f.write(f"{datetime.datetime.now()} Call to"
f.write(f"{ts} Call to"
f" {func_name} in {filename}:{lineno}"
f" from {last_func_name} in {last_filename}:"
f"{last_lineno}\n")
else:
f.write(f"{datetime.datetime.now()} Return from"
f.write(f"{ts} Return from"
f" {func_name} in {filename}:{lineno}"
f" to {last_func_name} in {last_filename}:"
f"{last_lineno}\n")
Expand Down
3 changes: 3 additions & 0 deletions vllm/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import datetime
import enum
import gc
import getpass
import inspect
import ipaddress
import os
Expand Down Expand Up @@ -967,6 +968,8 @@ def enable_trace_function_call_for_thread() -> None:

if envs.VLLM_TRACE_FUNCTION:
tmp_dir = tempfile.gettempdir()
# add username to tmp_dir to avoid permission issues
tmp_dir = os.path.join(tmp_dir, getpass.getuser())
filename = (f"VLLM_TRACE_FUNCTION_for_process_{os.getpid()}"
f"_thread_{threading.get_ident()}_"
f"at_{datetime.datetime.now()}.log").replace(" ", "_")
Expand Down

0 comments on commit 20cf2f5

Please sign in to comment.