Add pydocstyle to the ruff rules (#52136)
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Signed-off-by: Harry Mellor <hej.mellor@gmail.com> Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
804e5377aa
commit
8c1557a79c
+7
-17
@@ -14,8 +14,7 @@ logger = init_logger(__name__)
|
||||
|
||||
|
||||
class GCDebugConfig:
|
||||
"""
|
||||
Config for GC Debugger.
|
||||
"""Config for GC Debugger.
|
||||
- 0: disable GC debugger
|
||||
- 1: enable GC debugger with gc.collect elapsed times
|
||||
- '{"top_objects":5}': enable GC debugger with top 5 collected objects
|
||||
@@ -44,8 +43,7 @@ class GCDebugConfig:
|
||||
|
||||
|
||||
class GCDebugger:
|
||||
"""
|
||||
Debugger for GC which logs helpful information for GC understanding.
|
||||
"""Debugger for GC which logs helpful information for GC understanding.
|
||||
To enable, you should call maybe_attach_gc_debug_callback in the process.
|
||||
"""
|
||||
|
||||
@@ -59,9 +57,7 @@ class GCDebugger:
|
||||
self.gc_top_collected_objects: str = ""
|
||||
|
||||
def handle(self, phase: str, info: dict[str, int]) -> None:
|
||||
"""
|
||||
Handles a GC event (e.g. GC start or GC finish)
|
||||
"""
|
||||
"""Handles a GC event (e.g. GC start or GC finish)."""
|
||||
generation = info.get("generation")
|
||||
if generation is None:
|
||||
return
|
||||
@@ -122,8 +118,7 @@ def freeze_gc_for_cudagraph_capture():
|
||||
|
||||
|
||||
def freeze_gc_heap() -> None:
|
||||
"""
|
||||
Freeze all objects tracked by the garbage collector. It should be invoked
|
||||
"""Freeze all objects tracked by the garbage collector. It should be invoked
|
||||
after server init / warmup, to reduce GC overhead from static objects
|
||||
during serving time.
|
||||
"""
|
||||
@@ -137,9 +132,7 @@ def freeze_gc_heap() -> None:
|
||||
|
||||
|
||||
def maybe_attach_gc_debug_callback() -> None:
|
||||
"""
|
||||
Attached a callback for GC debug when VLLM_GC_DEBUG is enabled.
|
||||
"""
|
||||
"""Attached a callback for GC debug when VLLM_GC_DEBUG is enabled."""
|
||||
config = GCDebugConfig(envs.VLLM_GC_DEBUG)
|
||||
if config.enabled:
|
||||
debugger: GCDebugger = GCDebugger(config)
|
||||
@@ -151,8 +144,7 @@ def maybe_attach_gc_debug_callback() -> None:
|
||||
|
||||
|
||||
def _compute_detailed_type(o: Any) -> str:
|
||||
"""
|
||||
Detailed object type.
|
||||
"""Detailed object type.
|
||||
|
||||
TODO(Jialin): Further enhance the detailed type with element types for
|
||||
easier debugging. We tried but occasionally it would run into signals
|
||||
@@ -167,9 +159,7 @@ def _compute_detailed_type(o: Any) -> str:
|
||||
|
||||
|
||||
def _compute_top_gc_collected_objects(objects: list[Any], top: int) -> str:
|
||||
"""
|
||||
Group collected objects by types.
|
||||
"""
|
||||
"""Group collected objects by types."""
|
||||
if top <= 0:
|
||||
return ""
|
||||
object_types = [_compute_detailed_type(o) for o in objects]
|
||||
|
||||
Reference in New Issue
Block a user