Files
foxhunt/scripts/fetch_pod_logs_via_web.py
jgrusewski d746008e1f feat(runpod): Add self-termination wrapper for pod auto-shutdown
- 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>
2025-10-24 23:12:42 +02:00

51 lines
1.6 KiB
Python
Executable File

#!/usr/bin/env python3
"""
Simple script to guide user to fetch pod logs from RunPod Web UI
Since RunPod API doesn't expose container logs directly, this provides instructions.
"""
import sys
import webbrowser
def main():
if len(sys.argv) < 2:
print("Usage: ./fetch_pod_logs_via_web.py <pod_id>")
sys.exit(1)
pod_id = sys.argv[1]
url = f"https://www.runpod.io/console/pods/{pod_id}"
print("=" * 70)
print("RunPod Pod Logs - Access Instructions")
print("=" * 70)
print(f"\nPod ID: {pod_id}")
print(f"\n1. Opening Web UI in browser...")
print(f" URL: {url}")
print("\n2. Once the page loads:")
print(" a. Click on the pod name (foxhunt-training)")
print(" b. Navigate to the 'Logs' tab")
print(" c. Look for training output")
print("\n3. What to verify:")
print("'Using device: Cuda(...)' → GPU is active")
print("'Epoch 1/5' → Training started")
print(" ✓ GPU memory usage (should be ~12-13GB, NOT 15.9GB)")
print(" ✗ NO 'CUDA_ERROR_OUT_OF_MEMORY' messages")
print("\n4. Alternative: SSH access (once ready)")
print(f" ssh root@{pod_id}.ssh.runpod.io")
print(" docker logs $(docker ps -aq | head -1)")
print("\n" + "=" * 70)
print("\nOpening browser in 3 seconds...")
try:
import time
time.sleep(3)
webbrowser.open(url)
print("✓ Browser opened successfully")
except Exception as e:
print(f"✗ Failed to open browser: {e}")
print(f"\nManually open: {url}")
print("\n" + "=" * 70)
if __name__ == "__main__":
main()