data input audit, cleanup
This commit is contained in:
@ -1,38 +0,0 @@
|
||||
# Kill stale Python dashboard processes
|
||||
# Enhanced version with better error handling and logging
|
||||
|
||||
Write-Host "Checking for stale Python dashboard processes..."
|
||||
|
||||
try {
|
||||
# Get all Python processes
|
||||
$pythonProcesses = Get-Process python -ErrorAction SilentlyContinue
|
||||
|
||||
if ($pythonProcesses) {
|
||||
# Filter for dashboard processes
|
||||
$dashboardProcesses = $pythonProcesses | Where-Object {
|
||||
$_.ProcessName -eq 'python' -and
|
||||
$_.MainWindowTitle -like '*dashboard*'
|
||||
}
|
||||
|
||||
if ($dashboardProcesses) {
|
||||
Write-Host "Found $($dashboardProcesses.Count) dashboard process(es) to kill:"
|
||||
foreach ($process in $dashboardProcesses) {
|
||||
Write-Host " - PID: $($process.Id), Title: $($process.MainWindowTitle)"
|
||||
}
|
||||
|
||||
# Kill the processes
|
||||
$dashboardProcesses | Stop-Process -Force -ErrorAction SilentlyContinue
|
||||
Write-Host "Successfully killed $($dashboardProcesses.Count) dashboard process(es)"
|
||||
} else {
|
||||
Write-Host "No dashboard processes found to kill"
|
||||
}
|
||||
} else {
|
||||
Write-Host "No Python processes found"
|
||||
}
|
||||
} catch {
|
||||
Write-Host "Error checking for processes: $($_.Exception.Message)"
|
||||
}
|
||||
|
||||
# Wait a moment for processes to fully terminate
|
||||
Start-Sleep -Seconds 1
|
||||
Write-Host "Process cleanup completed"
|
@ -1,90 +0,0 @@
|
||||
# Overnight Training Restart Script (PowerShell)
|
||||
# Keeps main.py running continuously, restarting it if it crashes.
|
||||
# Usage: .\restart_main_overnight.ps1
|
||||
|
||||
Write-Host "=" * 60
|
||||
Write-Host "OVERNIGHT TRAINING RESTART SCRIPT (PowerShell)"
|
||||
Write-Host "=" * 60
|
||||
Write-Host "Press Ctrl+C to stop the restart loop"
|
||||
Write-Host "Main script: main.py"
|
||||
Write-Host "Restart delay on crash: 10 seconds"
|
||||
Write-Host "=" * 60
|
||||
|
||||
$restartCount = 0
|
||||
$startTime = Get-Date
|
||||
|
||||
# Create logs directory if it doesn't exist
|
||||
if (!(Test-Path "logs")) {
|
||||
New-Item -ItemType Directory -Path "logs"
|
||||
}
|
||||
|
||||
# Setup log file
|
||||
$timestamp = Get-Date -Format "yyyyMMdd_HHmmss"
|
||||
$logFile = "logs\restart_main_ps_$timestamp.log"
|
||||
|
||||
function Write-Log {
|
||||
param($Message)
|
||||
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
|
||||
$logMessage = "$timestamp - $Message"
|
||||
Write-Host $logMessage
|
||||
Add-Content -Path $logFile -Value $logMessage
|
||||
}
|
||||
|
||||
Write-Log "Restart script started, logging to: $logFile"
|
||||
|
||||
# Kill any existing Python processes
|
||||
try {
|
||||
Get-Process python* -ErrorAction SilentlyContinue | Stop-Process -Force -ErrorAction SilentlyContinue
|
||||
Start-Sleep -Seconds 2
|
||||
Write-Log "Killed existing Python processes"
|
||||
} catch {
|
||||
Write-Log "Could not kill existing processes: $_"
|
||||
}
|
||||
|
||||
try {
|
||||
while ($true) {
|
||||
$restartCount++
|
||||
$runStartTime = Get-Date
|
||||
|
||||
Write-Log "[RESTART #$restartCount] Starting main.py at $(Get-Date -Format 'HH:mm:ss')"
|
||||
|
||||
# Start main.py
|
||||
try {
|
||||
$process = Start-Process -FilePath "python" -ArgumentList "main.py" -PassThru -Wait
|
||||
$exitCode = $process.ExitCode
|
||||
$runEndTime = Get-Date
|
||||
$runDuration = ($runEndTime - $runStartTime).TotalSeconds
|
||||
|
||||
Write-Log "[EXIT] main.py exited with code $exitCode"
|
||||
Write-Log "[DURATION] Process ran for $([math]::Round($runDuration, 1)) seconds"
|
||||
|
||||
# Check for fast exits
|
||||
if ($runDuration -lt 30) {
|
||||
Write-Log "[FAST EXIT] Process exited quickly, waiting 30 seconds..."
|
||||
Start-Sleep -Seconds 30
|
||||
} else {
|
||||
Write-Log "[DELAY] Waiting 10 seconds before restart..."
|
||||
Start-Sleep -Seconds 10
|
||||
}
|
||||
|
||||
# Log stats every 10 restarts
|
||||
if ($restartCount % 10 -eq 0) {
|
||||
$totalDuration = (Get-Date) - $startTime
|
||||
Write-Log "[STATS] Session: $restartCount restarts in $([math]::Round($totalDuration.TotalHours, 1)) hours"
|
||||
}
|
||||
|
||||
} catch {
|
||||
Write-Log "[ERROR] Error starting main.py: $_"
|
||||
Start-Sleep -Seconds 10
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
Write-Log "[INTERRUPT] Restart loop interrupted: $_"
|
||||
} finally {
|
||||
$totalDuration = (Get-Date) - $startTime
|
||||
Write-Log "=" * 60
|
||||
Write-Log "OVERNIGHT TRAINING SESSION COMPLETE"
|
||||
Write-Log "Total restarts: $restartCount"
|
||||
Write-Log "Total session time: $([math]::Round($totalDuration.TotalHours, 1)) hours"
|
||||
Write-Log "=" * 60
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
# PowerShell script to start live trading demo and TensorBoard
|
||||
|
||||
Write-Host "Starting Trading Bot Live Demo..." -ForegroundColor Green
|
||||
|
||||
# Create a new PowerShell window for TensorBoard
|
||||
Start-Process powershell -ArgumentList "-Command python run_tensorboard.py" -WindowStyle Normal
|
||||
|
||||
# Wait a moment for TensorBoard to start
|
||||
Write-Host "Starting TensorBoard... Please wait" -ForegroundColor Yellow
|
||||
Start-Sleep -Seconds 5
|
||||
|
||||
# Start the live trading demo in the current window
|
||||
Write-Host "Starting Live Trading Demo with mock data..." -ForegroundColor Green
|
||||
python run_live_demo.py --symbol ETH/USDT --timeframe 1m --model models/trading_agent_best_pnl.pt --mock
|
Reference in New Issue
Block a user