49 lines
1.5 KiB
Markdown
49 lines
1.5 KiB
Markdown
# Utility Scripts
|
|
|
|
This directory contains utility scripts for managing the trading bot development environment.
|
|
|
|
## Port Management Utility
|
|
|
|
The `port_manager.py` script provides utilities for managing ports and killing stale processes:
|
|
|
|
```bash
|
|
# Kill all stale debug instances
|
|
python utils/port_manager.py --kill-stale
|
|
|
|
# Free a specific port
|
|
python utils/port_manager.py --free-port 6007
|
|
|
|
# Find an available port in a range
|
|
python utils/port_manager.py --find-port --min-port 6000 --max-port 7000
|
|
|
|
# Try to use a preferred port with fallback
|
|
python utils/port_manager.py --preferred-port 6007 --min-port 6000 --max-port 7000
|
|
```
|
|
|
|
## TensorBoard Launcher
|
|
|
|
The `launch_tensorboard.py` script launches TensorBoard with automatic port management:
|
|
|
|
```bash
|
|
# Launch TensorBoard with default settings
|
|
python utils/launch_tensorboard.py
|
|
|
|
# Launch with custom log directory and port range
|
|
python utils/launch_tensorboard.py --logdir=path/to/logs --preferred-port=6007 --port-range=6000-7000
|
|
|
|
# Launch and kill stale processes first
|
|
python utils/launch_tensorboard.py --kill-stale
|
|
```
|
|
|
|
## Integration with VSCode Tasks
|
|
|
|
These utilities are integrated with VSCode tasks in `.vscode/tasks.json`:
|
|
|
|
1. **Start TensorBoard**: Launches TensorBoard with automatic port management
|
|
2. **Kill Stale Processes**: Kills all stale debug instances
|
|
|
|
You can run these tasks from the VSCode command palette (Ctrl+Shift+P) by typing "Tasks: Run Task" and selecting the task.
|
|
|
|
## Requirements
|
|
|
|
These utilities require the `psutil` package, which is included in the project's `requirements.txt` file. |