-
Notifications
You must be signed in to change notification settings - Fork 2k
[None][chore] always try-catch when clear build folder in build_wheel.py #6748
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
Previously the build will stop if there is any mounted directory under `cpp/build/`. Signed-off-by: Zhenhua Wang <zhenhuaw@nvidia.com>
|
/bot run |
📝 WalkthroughWalkthroughThe Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Note 🔌 MCP (Model Context Protocol) integration is now available in Early Access!Pro users can now connect to remote MCP servers under the Integrations page to get reviews and chat conversations that understand additional development context. ✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
|
PR_Github #14599 [ run ] triggered by Bot |
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: 0
🧹 Nitpick comments (1)
scripts/build_wheel.py (1)
71-77: Goal achieved; tighten exception handling and skip mount points.This change prevents the build from stopping—good. To better align with our Python guidelines and handle mount points explicitly:
- Catch only OSError (IOError is redundant on Py3).
- Keep the try body to the mutating call.
- Skip mounted paths up-front.
- Use os.unlink to make symlink/file removal intent explicit.
- try: - if os.path.isdir(item_path) and not os.path.islink(item_path): - rmtree(item_path) - else: - os.remove(item_path) - except (OSError, IOError) as e: - print(f"Failed to remove {item_path}: {e}", file=sys.stderr) + # Skip mounted paths; do not attempt to remove them. + if os.path.ismount(item_path): + print(f"Skipping mounted path: {item_path}", file=sys.stderr) + continue + + if os.path.isdir(item_path) and not os.path.islink(item_path): + try: + rmtree(item_path) + except OSError as e: + print(f"Failed to remove {item_path}: {e}", file=sys.stderr) + else: + try: + os.unlink(item_path) + except OSError as e: + print(f"Failed to remove {item_path}: {e}", file=sys.stderr)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
scripts/build_wheel.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.py
📄 CodeRabbit Inference Engine (CODING_GUIDELINES.md)
**/*.py: Python code should conform to Python 3.8+.
Indent Python code with 4 spaces. Do not use tabs.
Always maintain the namespace when importing in Python, even if only one class or function from a module is used.
Python filenames should use snake_case (e.g., some_file.py).
Python classes should use PascalCase (e.g., class SomeClass).
Python functions and methods should use snake_case (e.g., def my_awesome_function():).
Python local variables should use snake_case. Prefix k for variable names that start with a number (e.g., k_99th_percentile).
Python global variables should use upper snake_case and prefix G (e.g., G_MY_GLOBAL).
Python constants should use upper snake_case (e.g., MY_CONSTANT).
Avoid shadowing variables declared in an outer scope in Python.
Initialize all externally visible members of a Python class in the constructor.
For interfaces that may be used outside a Python file, prefer docstrings over comments.
Comments in Python should be reserved for code within a function, or interfaces that are local to a file.
Use Google style docstrings for Python classes and functions, which can be parsed by Sphinx.
Attributes and variables in Python can be documented inline; attribute docstrings will be rendered under the class docstring.
Avoid using reflection in Python when functionality can be easily achieved without it.
When using try-except blocks in Python, limit the except to the smallest set of errors possible.
When using try-except blocks to handle multiple possible variable types in Python, keep the body of the try as small as possible, using the else block to implement the logic.
Files:
scripts/build_wheel.py
**/*.{cpp,h,hpp,cc,cxx,cu,py}
📄 CodeRabbit Inference Engine (CODING_GUIDELINES.md)
All TensorRT-LLM Open Source Software code should contain an NVIDIA copyright header that includes the current year. This includes .cpp, .h, .cu, .py, and any other source files which are compiled or interpreted.
Files:
scripts/build_wheel.py
🧠 Learnings (1)
📓 Common learnings
Learnt from: CR
PR: NVIDIA/TensorRT-LLM#0
File: CODING_GUIDELINES.md:0-0
Timestamp: 2025-08-06T21:22:55.018Z
Learning: Applies to **/*.py : When using try-except blocks in Python, limit the except to the smallest set of errors possible.
⏰ 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
|
PR_Github #14599 [ run ] completed with state |
…ld_wheel.py (NVIDIA#6748)" This reverts commit 7e33ed6.
Previously the build will stop if there is any mounted directory under
cpp/build/.Summary by CodeRabbit