Unverified Commit 301024aa authored by Wentao Ye's avatar Wentao Ye Committed by GitHub
Browse files

[Deprecation] Deprecate cprofile and cprofile_context (#39100)


Signed-off-by: default avataryewentao256 <zhyanwentao@126.com>
parent 8256833f
...@@ -206,8 +206,8 @@ Both the `vllm.utils.profiling.cprofile` and `vllm.utils.profiling.cprofile_cont ...@@ -206,8 +206,8 @@ Both the `vllm.utils.profiling.cprofile` and `vllm.utils.profiling.cprofile_cont
used to profile a section of code. used to profile a section of code.
!!! note !!! note
The legacy import paths `vllm.utils.cprofile` and `vllm.utils.cprofile_context` are deprecated. The `vllm.utils.profiling` helpers are deprecated and will be removed in
Please use `vllm.utils.profiling.cprofile` and `vllm.utils.profiling.cprofile_context` instead. `v0.21`. Please use Python's `cProfile` module directly instead.
### Example usage - decorator ### Example usage - decorator
......
...@@ -8,7 +8,13 @@ from collections.abc import Callable ...@@ -8,7 +8,13 @@ from collections.abc import Callable
from functools import wraps from functools import wraps
from typing import Any from typing import Any
from typing_extensions import deprecated
@deprecated(
"vllm.utils.profiling.cprofile_context() is deprecated and will be removed "
"in v0.21. Use Python's cProfile module directly instead."
)
@contextlib.contextmanager @contextlib.contextmanager
def cprofile_context(save_file: str | None = None): def cprofile_context(save_file: str | None = None):
"""Run a cprofile """Run a cprofile
...@@ -32,6 +38,10 @@ def cprofile_context(save_file: str | None = None): ...@@ -32,6 +38,10 @@ def cprofile_context(save_file: str | None = None):
prof.print_stats(sort="cumtime") prof.print_stats(sort="cumtime")
@deprecated(
"vllm.utils.profiling.cprofile() is deprecated and will be removed in "
"v0.21. Use Python's cProfile module directly instead."
)
def cprofile(save_file: str | None = None, enabled: bool = True): def cprofile(save_file: str | None = None, enabled: bool = True):
"""Decorator to profile a Python method using cProfile. """Decorator to profile a Python method using cProfile.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment