-
Notifications
You must be signed in to change notification settings - Fork 2k
[None][chore] replace print_colored_debug with logger_debug #8417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
/bot run |
📝 WalkthroughWalkthroughA systematic refactoring replaces direct colored debug printing via Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Nitpick comments (3)
tensorrt_llm/executor/base_worker.py (2)
639-640: Remove unnecessary f-string prefix.The f-string has no placeholders and should be a regular string.
Apply this diff:
- logger_debug(f"creating await_response helper for Worker\n", + logger_debug("creating await_response helper for Worker\n", color="yellow")
646-647: Remove unnecessary f-string prefix.The f-string has no placeholders and should be a regular string.
Apply this diff:
- logger_debug(f"creating await_response helper for IPC\n", + logger_debug("creating await_response helper for IPC\n", color="yellow")tensorrt_llm/llmapi/mpi_session.py (1)
444-445: Remove unnecessary f-string prefix.The f-string has no placeholders and should be a regular string.
Apply this diff:
- logger_debug(f"RemoteMpiCommSessionServer sent results to client\n", + logger_debug("RemoteMpiCommSessionServer sent results to client\n", "green")
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (13)
tensorrt_llm/_torch/models/modeling_bert.py(2 hunks)tensorrt_llm/executor/base_worker.py(2 hunks)tensorrt_llm/executor/executor.py(2 hunks)tensorrt_llm/executor/ipc.py(3 hunks)tensorrt_llm/executor/proxy.py(4 hunks)tensorrt_llm/executor/rpc_proxy.py(2 hunks)tensorrt_llm/executor/utils.py(2 hunks)tensorrt_llm/executor/worker.py(7 hunks)tensorrt_llm/llmapi/llm.py(4 hunks)tensorrt_llm/llmapi/llm_utils.py(3 hunks)tensorrt_llm/llmapi/mgmn_leader_node.py(2 hunks)tensorrt_llm/llmapi/mpi_session.py(8 hunks)tensorrt_llm/llmapi/utils.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{h,hpp,hh,hxx,cpp,cxx,cc,cu,cuh,py}
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
Use only spaces, no tabs; indent with 4 spaces.
Files:
tensorrt_llm/executor/utils.pytensorrt_llm/_torch/models/modeling_bert.pytensorrt_llm/executor/rpc_proxy.pytensorrt_llm/llmapi/mpi_session.pytensorrt_llm/llmapi/llm_utils.pytensorrt_llm/executor/proxy.pytensorrt_llm/executor/base_worker.pytensorrt_llm/executor/executor.pytensorrt_llm/llmapi/utils.pytensorrt_llm/executor/worker.pytensorrt_llm/llmapi/llm.pytensorrt_llm/llmapi/mgmn_leader_node.pytensorrt_llm/executor/ipc.py
**/*.py
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
**/*.py: Python code must target Python 3.8+.
Indent Python code with 4 spaces; do not use tabs.
Maintain module namespace when importing; prefer 'from package.subpackage import foo' then 'foo.SomeClass()' instead of importing the class directly.
Python filenames should be snake_case (e.g., some_file.py).
Python classes use PascalCase names.
Functions and methods use snake_case names.
Local variables use snake_case; prefix 'k' for variables that start with a number (e.g., k_99th_percentile).
Global variables use upper SNAKE_CASE prefixed with 'G' (e.g., G_MY_GLOBAL).
Constants use upper SNAKE_CASE (e.g., MY_CONSTANT).
Avoid shadowing variables from an outer scope.
Initialize all externally visible members of a class in the constructor.
Prefer docstrings for interfaces that may be used outside a file; comments for in-function or file-local interfaces.
Use Google-style docstrings for classes and functions (Sphinx-parsable).
Document attributes and variables inline so they render under the class/function docstring.
Avoid reflection when a simpler, explicit approach suffices (e.g., avoid dict(**locals()) patterns).
In try/except, catch the most specific exceptions possible.
For duck-typing try/except, keep the try body minimal and use else for the main logic.
Files:
tensorrt_llm/executor/utils.pytensorrt_llm/_torch/models/modeling_bert.pytensorrt_llm/executor/rpc_proxy.pytensorrt_llm/llmapi/mpi_session.pytensorrt_llm/llmapi/llm_utils.pytensorrt_llm/executor/proxy.pytensorrt_llm/executor/base_worker.pytensorrt_llm/executor/executor.pytensorrt_llm/llmapi/utils.pytensorrt_llm/executor/worker.pytensorrt_llm/llmapi/llm.pytensorrt_llm/llmapi/mgmn_leader_node.pytensorrt_llm/executor/ipc.py
**/*.{cpp,cxx,cc,h,hpp,hh,hxx,cu,cuh,py}
📄 CodeRabbit inference engine (CODING_GUIDELINES.md)
Prepend the NVIDIA Apache-2.0 copyright header with current year to the top of all source files (e.g., .cpp, .h, .cu, .py).
Files:
tensorrt_llm/executor/utils.pytensorrt_llm/_torch/models/modeling_bert.pytensorrt_llm/executor/rpc_proxy.pytensorrt_llm/llmapi/mpi_session.pytensorrt_llm/llmapi/llm_utils.pytensorrt_llm/executor/proxy.pytensorrt_llm/executor/base_worker.pytensorrt_llm/executor/executor.pytensorrt_llm/llmapi/utils.pytensorrt_llm/executor/worker.pytensorrt_llm/llmapi/llm.pytensorrt_llm/llmapi/mgmn_leader_node.pytensorrt_llm/executor/ipc.py
🧬 Code graph analysis (12)
tensorrt_llm/executor/utils.py (2)
tensorrt_llm/llmapi/utils.py (2)
enable_llm_debug(333-338)logger_debug(103-116)tensorrt_llm/llmapi/mpi_session.py (3)
MpiCommSession(179-254)MpiSession(84-129)RemoteMpiCommSessionClient(264-335)
tensorrt_llm/_torch/models/modeling_bert.py (2)
tensorrt_llm/llmapi/utils.py (1)
logger_debug(103-116)tensorrt_llm/_torch/models/modeling_utils.py (1)
load_weights(556-574)
tensorrt_llm/executor/rpc_proxy.py (2)
tensorrt_llm/llmapi/utils.py (3)
AsyncQueue(359-443)_SyncQueue(446-513)logger_debug(103-116)tensorrt_llm/executor/utils.py (1)
create_mpi_comm_session(48-65)
tensorrt_llm/llmapi/mpi_session.py (1)
tensorrt_llm/llmapi/utils.py (4)
logger_debug(103-116)print_colored(47-63)get(413-443)get(496-513)
tensorrt_llm/llmapi/llm_utils.py (2)
tensorrt_llm/llmapi/utils.py (5)
enable_llm_debug(333-338)get_directory_size_in_gb(265-274)logger_debug(103-116)print_colored(47-63)print_traceback_on_error(33-44)tensorrt_llm/_utils.py (1)
mpi_rank(527-534)
tensorrt_llm/executor/proxy.py (2)
tensorrt_llm/llmapi/utils.py (3)
enable_llm_debug(333-338)logger_debug(103-116)print_colored(47-63)tensorrt_llm/executor/utils.py (1)
create_mpi_comm_session(48-65)
tensorrt_llm/executor/base_worker.py (1)
tensorrt_llm/llmapi/utils.py (2)
_SyncQueue(446-513)logger_debug(103-116)
tensorrt_llm/executor/executor.py (1)
tensorrt_llm/llmapi/utils.py (2)
logger_debug(103-116)print_colored(47-63)
tensorrt_llm/executor/worker.py (2)
tensorrt_llm/llmapi/utils.py (1)
logger_debug(103-116)tensorrt_llm/_utils.py (1)
mpi_rank(527-534)
tensorrt_llm/llmapi/llm.py (1)
tensorrt_llm/llmapi/utils.py (2)
logger_debug(103-116)set_api_status(702-715)
tensorrt_llm/llmapi/mgmn_leader_node.py (3)
tensorrt_llm/llmapi/utils.py (1)
logger_debug(103-116)tensorrt_llm/_utils.py (2)
mpi_world_size(549-550)global_mpi_rank(537-542)tensorrt_llm/executor/utils.py (1)
get_spawn_proxy_process_ipc_addr_env(32-34)
tensorrt_llm/executor/ipc.py (1)
tensorrt_llm/llmapi/utils.py (4)
ManagedThread(277-327)enable_llm_debug(333-338)logger_debug(103-116)print_colored(47-63)
🪛 Ruff (0.14.0)
tensorrt_llm/executor/utils.py
18-18: Redefinition of unused logger_debug from line 14
(F811)
tensorrt_llm/llmapi/mpi_session.py
444-444: f-string without any placeholders
Remove extraneous f prefix
(F541)
tensorrt_llm/executor/base_worker.py
639-639: f-string without any placeholders
Remove extraneous f prefix
(F541)
646-646: f-string without any placeholders
Remove extraneous f prefix
(F541)
tensorrt_llm/executor/worker.py
335-335: f-string without any placeholders
Remove extraneous f prefix
(F541)
tensorrt_llm/llmapi/llm.py
201-201: f-string without any placeholders
Remove extraneous f prefix
(F541)
205-205: f-string without any placeholders
Remove extraneous f prefix
(F541)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Pre-commit Check
🔇 Additional comments (18)
tensorrt_llm/_torch/models/modeling_bert.py (1)
7-7: LGTM!The replacement of
print_colored_debugwithlogger_debugis correct and preserves the color parameter semantics. The import has been properly updated.Also applies to: 312-312, 318-318
tensorrt_llm/executor/ipc.py (1)
17-18: LGTM!The logging migration is correct. The
logger_debugcalls properly preserve the color parameter from the originalprint_colored_debugcalls.Also applies to: 84-86, 101-103
tensorrt_llm/executor/utils.py (1)
55-57: LGTM!The replacement of
print_colored_debugwithlogger_debugcorrectly preserves the color parameter.Also applies to: 62-64
tensorrt_llm/executor/base_worker.py (1)
22-22: LGTM!The import and usage of
logger_debugcorrectly replaceprint_colored_debug.tensorrt_llm/llmapi/utils.py (1)
40-40: LGTM!The replacement of
print_colored_debugwithlogger_debugin the exception handler is correct. This aligns with the project-wide migration to centralized logging.tensorrt_llm/executor/executor.py (1)
29-31: LGTM!The logging migration is correct. The import has been properly updated, and the
logger_debugcall preserves the color parameter.Also applies to: 414-416
tensorrt_llm/executor/rpc_proxy.py (1)
11-11: LGTM!The replacement of
print_colored_debugwithlogger_debugis correct across all three call sites, and the import has been properly updated.Also applies to: 362-362, 365-365, 368-368
tensorrt_llm/llmapi/mpi_session.py (1)
19-19: LGTM!The systematic replacement of
print_colored_debugwithlogger_debugthroughout the MPI session implementation is correct. All color parameters are preserved.Also applies to: 273-274, 288-293, 304-309, 369-390, 394-407, 418-434
tensorrt_llm/executor/worker.py (2)
21-23: LGTM!The import has been correctly updated to use
logger_debuginstead ofprint_colored_debug, maintaining all other required utilities.
183-183: LGTM!All
print_colored_debugcalls have been correctly replaced withlogger_debug, preserving the message content and color arguments.Also applies to: 218-218, 253-253, 366-366, 383-383
tensorrt_llm/llmapi/llm_utils.py (2)
44-46: LGTM!The import has been correctly updated to include
logger_debugand removeprint_colored_debugwhile maintaining all other utility imports.
543-543: LGTM!Both
print_colored_debugcalls have been correctly replaced withlogger_debug, preserving the rank information, messages, and color arguments.Also applies to: 560-560
tensorrt_llm/llmapi/mgmn_leader_node.py (2)
14-14: LGTM!The import has been correctly updated to use
logger_debuginstead ofprint_colored_debug.
20-21: LGTM!All
print_colored_debugcalls in server lifecycle methods have been correctly replaced withlogger_debug, preserving the message content and color arguments for startup, shutdown, and error handling paths.Also applies to: 27-28, 31-31, 41-43, 46-47
tensorrt_llm/executor/proxy.py (2)
19-20: LGTM!The import has been correctly updated to include
logger_debugwhile maintaining all other utility imports includingenable_llm_debugandprint_colored.
67-67: LGTM!All
print_colored_debugcalls in initialization and shutdown flows have been correctly replaced withlogger_debug, preserving the message content and color arguments for session creation and lifecycle logging.Also applies to: 70-70, 73-73, 356-356, 376-376
tensorrt_llm/llmapi/llm.py (2)
46-47: LGTM!The import has been correctly updated to include
logger_debugwhile removingprint_colored_debugand maintaining all other utility imports.
184-185: LGTM!The
print_colored_debugcalls have been correctly replaced withlogger_debug, preserving the message content and color arguments in MPI session initialization and engine file copying flows.Also applies to: 820-821
|
PR_Github #21542 [ run ] triggered by Bot |
|
PR_Github #21542 [ run ] completed with state |
ff4be4c to
13e7237
Compare
|
/bot run --disable-fail-fast |
|
PR_Github #21856 [ run ] triggered by Bot. Commit: |
|
PR_Github #21856 [ run ] completed with state |
|
/bot run |
|
PR_Github #21909 [ run ] triggered by Bot. Commit: |
|
PR_Github #21909 [ run ] completed with state |
Signed-off-by: Yan Chunwei <328693+Superjomn@users.noreply.github.com>
13e7237 to
5b5ba48
Compare
|
/bot run |
|
PR_Github #21969 [ run ] triggered by Bot. Commit: |
|
PR_Github #21969 [ run ] completed with state |
Summary
Unify the debugging printing to
logger_debug, which is used in the RPC code, and enhance logging in the following aspects:logger.debugrather thansys.stderr; the former one is unified with the existing logging in the system.TLLM_LLMAPI_ENABLE_DEBUG(new). The originalTLLM_LLM_ENABLE_DEBUGwill enable all thelogger.debug, which dumps too many debug logs, especially in the PyExecutor decoder step.TLLM_LLMAPI_ENABLE_DEBUGis off, it will fall back to a traditionallogger.debugSummary by CodeRabbit
Description
Test Coverage
PR Checklist
Please review the following before submitting your PR:
PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.
PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.
Test cases are provided for new code paths (see test instructions)
Any new dependencies have been scanned for license and vulnerabilities
CODEOWNERS updated if ownership changes
Documentation updated as needed
The reviewers assigned automatically/manually are appropriate for the PR.
Please check this after reviewing the above items as appropriate for this PR.
GitHub Bot Help
/bot [-h] ['run', 'kill', 'skip', 'reuse-pipeline'] ...Provide a user friendly way for developers to interact with a Jenkins server.
Run
/bot [-h|--help]to print this help message.See details below for each supported subcommand.
Details
run [--reuse-test (optional)pipeline-id --disable-fail-fast --skip-test --stage-list "A10-PyTorch-1, xxx" --gpu-type "A30, H100_PCIe" --test-backend "pytorch, cpp" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" --detailed-log --debug(experimental)]Launch build/test pipelines. All previously running jobs will be killed.
--reuse-test (optional)pipeline-id(OPTIONAL) : Allow the new pipeline to reuse build artifacts and skip successful test stages from a specified pipeline or the last pipeline if no pipeline-id is indicated. If the Git commit ID has changed, this option will be always ignored. The DEFAULT behavior of the bot is to reuse build artifacts and successful test results from the last pipeline.--disable-reuse-test(OPTIONAL) : Explicitly prevent the pipeline from reusing build artifacts and skipping successful test stages from a previous pipeline. Ensure that all builds and tests are run regardless of previous successes.--disable-fail-fast(OPTIONAL) : Disable fail fast on build/tests/infra failures.--skip-test(OPTIONAL) : Skip all test stages, but still run build stages, package stages and sanity check stages. Note: Does NOT update GitHub check status.--stage-list "A10-PyTorch-1, xxx"(OPTIONAL) : Only run the specified test stages. Examples: "A10-PyTorch-1, xxx". Note: Does NOT update GitHub check status.--gpu-type "A30, H100_PCIe"(OPTIONAL) : Only run the test stages on the specified GPU types. Examples: "A30, H100_PCIe". Note: Does NOT update GitHub check status.--test-backend "pytorch, cpp"(OPTIONAL) : Skip test stages which don't match the specified backends. Only support [pytorch, cpp, tensorrt, triton]. Examples: "pytorch, cpp" (does not run test stages with tensorrt or triton backend). Note: Does NOT update GitHub pipeline status.--only-multi-gpu-test(OPTIONAL) : Only run the multi-GPU tests. Note: Does NOT update GitHub check status.--disable-multi-gpu-test(OPTIONAL) : Disable the multi-GPU tests. Note: Does NOT update GitHub check status.--add-multi-gpu-test(OPTIONAL) : Force run the multi-GPU tests in addition to running L0 pre-merge pipeline.--post-merge(OPTIONAL) : Run the L0 post-merge pipeline instead of the ordinary L0 pre-merge pipeline.--extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx"(OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Examples: --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx".--detailed-log(OPTIONAL) : Enable flushing out all logs to the Jenkins console. This will significantly increase the log volume and may slow down the job.--debug(OPTIONAL) : Experimental feature. Enable access to the CI container for debugging purpose. Note: Specify exactly one stage in thestage-listparameter to access the appropriate container environment. Note: Does NOT update GitHub check status.For guidance on mapping tests to stage names, see
docs/source/reference/ci-overview.mdand the
scripts/test_to_stage_mapping.pyhelper.kill
killKill all running builds associated with pull request.
skip
skip --comment COMMENTSkip testing for latest commit on pull request.
--comment "Reason for skipping build/test"is required. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.reuse-pipeline
reuse-pipelineReuse a previous pipeline to validate current commit. This action will also kill all currently running builds associated with the pull request. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.