UN-2609 [FEAT] Added dumb-init wrapper to forward SIGTERM to Python processes in tool containers #1466
Conversation
Summary by CodeRabbit
WalkthroughThe changes introduce the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Runner
participant Container
User->>Runner: Request to run container with command
Runner->>Container: Start with ["dumb-init", "/bin/sh", "-c", container_command]
Container->>dumb-init: Launch process
dumb-init->>/bin/sh: Execute container_command
Estimated code review effort🎯 2 (Simple) | ⏱️ ~7 minutes Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
✨ 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
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (3)
runner/tests/signal-handling-demo/README.md (2)
16-16: Fix markdown formatting: Remove trailing punctuation from heading.-# Results: +# Results
20-42: Add language specification to fenced code blocks.The code blocks should specify the language for better syntax highlighting and markdown compliance.
-``` +```consoleApply this change to both code blocks (lines 20-42 and 47-71) that contain console output.
Also applies to: 47-71
runner/tests/signal-handling-demo/shell-signal-test.py (1)
24-62: Excellent signal handler implementation with one minor inconsistency.The signal handler properly captures both SIGTERM and SIGINT, provides detailed logging, and simulates realistic cleanup work. The use of
sys.stdout.flush()ensures immediate output visibility.However, there's a minor inconsistency:
- time.sleep(10) # Each cleanup task takes 1 second + time.sleep(10) # Each cleanup task takes 10 seconds
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to Reviews > Disable Cache setting
Knowledge Base: Disabled due to Reviews > Disable Knowledge Base setting
📒 Files selected for processing (4)
.gitignore(1 hunks)runner/tests/signal-handling-demo/Dockerfile(1 hunks)runner/tests/signal-handling-demo/README.md(1 hunks)runner/tests/signal-handling-demo/shell-signal-test.py(1 hunks)
✅ Files skipped from review due to trivial changes (2)
- .gitignore
- runner/tests/signal-handling-demo/Dockerfile
🧰 Additional context used
🪛 markdownlint-cli2 (0.17.2)
runner/tests/signal-handling-demo/README.md
16-16: Trailing punctuation in heading
Punctuation: ':'
(MD026, no-trailing-punctuation)
20-20: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
47-47: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
⏰ 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: build
🔇 Additional comments (5)
runner/tests/signal-handling-demo/README.md (2)
1-74: Excellent documentation for signal handling testing.This README provides comprehensive manual testing instructions that clearly demonstrate the signal forwarding problem and solution. The detailed output logs effectively show the difference between broken (shell wrapper) and working (dumb-init) scenarios.
4-14: Docker commands look correct for testing signal handling.The build and run commands properly demonstrate both scenarios - broken shell wrapper and working dumb-init wrapper.
runner/tests/signal-handling-demo/shell-signal-test.py (3)
19-23: Clean class initialization.The initialization properly sets up the necessary instance variables for tracking program state and timing.
63-123: Well-structured main program loop with comprehensive logging.The implementation includes:
- Proper signal handler registration
- Clear startup instructions and PID display
- Safety timeout mechanism (60 seconds max)
- Detailed status logging every 2 seconds
- Graceful handling of both signals and KeyboardInterrupt
- Appropriate exit handling
1-17: Excellent overall script structure and documentation.The script follows Python best practices with:
- Proper shebang and comprehensive docstring
- Clean imports and module structure
- Clear main entry point with
if __name__ == "__main__"This is a well-designed testing tool for demonstrating signal handling behavior.
Also applies to: 125-128
hari-kuriakose
left a comment
There was a problem hiding this comment.
@kirtimanmishrazipstack LGTM overall
|
|
…rocesses in tool containers (#1466) * added tool invocation with dumb-init * adding demo folder (to be removed) * adding demo folder to runner/tests * adding demo folder to runner/tests * removing test folder * small change --------- Co-authored-by: vishnuszipstack <117254672+vishnuszipstack@users.noreply.github.com>



What
dumb-init.Why
dumb-initHow
Can this PR break any existing features. If yes, please list possible items. If no, please explain why. (PS: Admins do not merge the PR without this section filled)
Database Migrations
Env Config
Relevant Docs
Related Issues or PRs
Dependencies Versions
Notes on Testing
runner/tests/signal-handling-demo. I will remove this folder once PR is approved.Screenshots
dumb-initChecklist
I have read and understood the Contribution Guidelines.