The hot reload feature allows the Oculus VR Server to automatically restart when code changes are detected, making development and debugging much faster.
./run_server.sh --hot-reloadThis will:
- Kill any existing servers
- Start the server with hot reload, performance mode, and data verification
- Automatically restart when Python files or configs change
python oculus_vr_server.py --hot-reload --performance --verify-data./run_server.sh --hot-reload --debug --left-controller-
File Watching: The hot reload wrapper monitors:
*.pyfiles (all Python code)configs/*.yaml(configuration files)frankateach/*.py(package files)simulation/*.py(simulation files)
-
Automatic Restart: When changes are detected:
- Current server process is gracefully stopped
- Brief pause (0.5s) to ensure clean shutdown
- Server restarts with the same arguments
-
Ignored Files: The following are ignored:
__pycache__directories.pyc,.pyofiles- Swap files (
.swp,.swo,~) - Git directories
- Log and output directories
- Preserves Arguments: All command-line arguments are passed to the restarted server
- Graceful Shutdown: Uses SIGTERM for clean shutdown, SIGKILL as fallback
- Process Monitoring: Automatically restarts if server crashes
- Cooldown Period: 1-second minimum between restarts to prevent rapid cycling
-
Start the server with hot reload:
./run_server.sh --hot-reload
-
Make changes to any Python file
-
Save the file - server automatically restarts
-
Test your changes immediately
- Check if the file type is monitored (Python or YAML)
- Ensure the file is not in an ignored directory
- Look for error messages in the console
- The 1-second cooldown prevents rapid restarts
- Check if multiple files are being saved simultaneously
Requires the watchdog library:
pip install watchdogrun_server.sh
↓
oculus_vr_server.py --hot-reload
↓
oculus_vr_server_hotreload.py (wrapper)
├── File watcher (watchdog)
└── Server process (oculus_vr_server.py)
The hot reload wrapper runs as a parent process that:
- Monitors file system changes
- Manages the actual server as a subprocess
- Handles signals and cleanup
-
Use with Debug Mode: Great for testing without robot
./run_server.sh --hot-reload --debug
-
Disable for Production: Don't use hot reload in production
./run_server.sh # No --hot-reload -
Save Frequently: The server only restarts on file save
-
Check Console: Always check for startup errors after reload