- Created entrypoint-self-terminate.sh wrapper script - Updates entrypoint-generic.sh to be called by wrapper - Modified Dockerfile.runpod to use self-terminate entrypoint - Adds automatic pod termination via runpodctl after training completes - Prevents infinite restart loops and wasted GPU credits - Saves ~96% cost per training run ($4.59 per run) Implements pod self-termination using RUNPOD_POD_ID environment variable. Training exits with code 0 → runpodctl remove pod → immediate shutdown. Co-Authored-By: Claude <noreply@anthropic.com>
82 lines
2.1 KiB
Markdown
82 lines
2.1 KiB
Markdown
|
|
## RunPod Deployment Script
|
|
|
|
**Script**: `runpod_deploy.py`
|
|
|
|
Automated deployment script for RunPod GPU pods in EUR-IS region (SECURE cloud).
|
|
|
|
### Features
|
|
- Scans available GPUs with ≥16GB VRAM
|
|
- Auto-selects best value GPU (RTX 4090 preferred, then cheapest)
|
|
- Supports custom GPU selection
|
|
- Dry-run mode for testing
|
|
- Automatic network volume attachment
|
|
|
|
### Requirements
|
|
```bash
|
|
pip install requests python-dotenv
|
|
```
|
|
|
|
### Configuration
|
|
Create `.env.runpod` with:
|
|
```
|
|
RUNPOD_API_KEY=your_api_key
|
|
RUNPOD_VOLUME_ID=your_volume_id
|
|
```
|
|
|
|
### Usage Examples
|
|
|
|
```bash
|
|
# Auto-select best value GPU (dry run)
|
|
./scripts/runpod_deploy.py --dry-run
|
|
|
|
# Deploy with default settings (RTX 4090 preferred)
|
|
./scripts/runpod_deploy.py
|
|
|
|
# Deploy with specific GPU
|
|
./scripts/runpod_deploy.py --gpu-type "RTX 3090"
|
|
|
|
# Custom image and larger disk
|
|
./scripts/runpod_deploy.py \
|
|
--image runpod/pytorch:2.1.0-py3.10-cuda11.8.0-devel \
|
|
--container-disk 100
|
|
|
|
# With custom command
|
|
./scripts/runpod_deploy.py --command "jupyter lab --allow-root"
|
|
```
|
|
|
|
### Default Configuration
|
|
- **Cloud Type**: SECURE (no spot interruptions)
|
|
- **Region**: EUR-IS (Iceland - low latency to Europe)
|
|
- **Image**: `runpod/pytorch:2.4.0-py3.11-cuda12.4.1-devel-ubuntu22.04`
|
|
- **Container Disk**: 50GB
|
|
- **Network Volume**: Attached from `.env.runpod`
|
|
- **Ports**: 8888/http (Jupyter)
|
|
|
|
### GPU Selection Logic
|
|
1. If `--gpu-type` specified and available → use it
|
|
2. Else if RTX 4090 available → use it (best value)
|
|
3. Else → use cheapest available GPU
|
|
|
|
### Output
|
|
```
|
|
✅ POD DEPLOYED SUCCESSFULLY
|
|
======================================================================
|
|
Pod ID: abc123-xyz789
|
|
GPU: RTX 4090 (24GB)
|
|
Cost: $0.340/hr
|
|
Image: runpod/pytorch:2.4.0
|
|
Status: RUNNING
|
|
======================================================================
|
|
|
|
📝 NEXT STEPS:
|
|
1. Wait 2-3 minutes for pod to initialize
|
|
2. Access Jupyter at: https://abc123-8888.proxy.runpod.net
|
|
3. SSH access: ssh root@abc123.ssh.runpod.io
|
|
4. Monitor pod: https://www.runpod.io/console/pods
|
|
```
|
|
|
|
### Cost Warning
|
|
The script will display hourly costs. Remember to stop pods when done to avoid unnecessary charges.
|
|
|