feat: Extend 1-minute data retention from 4 weeks to 1 year
- Updated lib/maintenance/data-cleanup.ts retention period: 28 days → 365 days - Storage requirements validated: 251 MB/year (negligible) - Rationale: 13× more historical data for better pattern analysis - Benefits: 260-390 blocked signals/year vs 20-30/month - Cleanup cutoff: Now Dec 2, 2024 (vs Nov 4, 2025 previously) - Deployment verified: Container restarted, cleanup scheduled for 3 AM daily
This commit is contained in:
59
cluster/check_sweep_status.sh
Executable file
59
cluster/check_sweep_status.sh
Executable file
@@ -0,0 +1,59 @@
|
||||
#!/bin/bash
|
||||
# Quick status checker for v9 parameter sweep
|
||||
|
||||
echo "=========================================="
|
||||
echo "V9 Parameter Sweep Status"
|
||||
echo "=========================================="
|
||||
echo ""
|
||||
|
||||
# Get chunk status from database
|
||||
echo "📊 Chunk Progress:"
|
||||
sqlite3 exploration.db "SELECT status, COUNT(*) as count FROM v9_advanced_chunks GROUP BY status;" | while IFS='|' read status count; do
|
||||
echo " $status: $count"
|
||||
done
|
||||
echo ""
|
||||
|
||||
# Calculate progress
|
||||
completed=$(sqlite3 exploration.db "SELECT COUNT(*) FROM v9_advanced_chunks WHERE status='completed';")
|
||||
total=1693
|
||||
percentage=$(awk "BEGIN {printf \"%.2f\", ($completed/$total)*100}")
|
||||
echo " Progress: $completed / $total chunks ($percentage%)"
|
||||
echo ""
|
||||
|
||||
# Get latest coordinator log
|
||||
echo "📋 Latest Coordinator Activity:"
|
||||
tail -3 /home/icke/traderv4/cluster/v9_advanced_coordinator.log | grep "Iteration" | tail -1
|
||||
echo ""
|
||||
|
||||
# Check worker processes
|
||||
echo "🖥️ Worker Status:"
|
||||
worker1_procs=$(ssh root@10.10.254.106 "ps aux | grep v9_advanced_worker | grep -v grep | wc -l")
|
||||
worker2_procs=$(ssh root@10.10.254.106 "ssh root@10.20.254.100 'ps aux | grep v9_advanced_worker | grep -v grep | wc -l'" 2>/dev/null)
|
||||
echo " Worker1: $worker1_procs processes"
|
||||
echo " Worker2: $worker2_procs processes"
|
||||
echo ""
|
||||
|
||||
# Estimate completion time
|
||||
if [ $completed -gt 0 ]; then
|
||||
# Get time of first completion
|
||||
first_completed=$(sqlite3 exploration.db "SELECT MIN(completed_at) FROM v9_advanced_chunks WHERE status='completed';")
|
||||
if [ ! -z "$first_completed" ]; then
|
||||
current_time=$(date +%s)
|
||||
elapsed=$((current_time - first_completed))
|
||||
chunks_done=$completed
|
||||
time_per_chunk=$((elapsed / chunks_done))
|
||||
remaining=$((total - completed))
|
||||
eta_seconds=$((remaining * time_per_chunk / 2)) # Divide by 2 for parallel workers
|
||||
|
||||
eta_hours=$((eta_seconds / 3600))
|
||||
eta_days=$((eta_hours / 24))
|
||||
eta_hours_remainder=$((eta_hours % 24))
|
||||
|
||||
Estimated Time:"echo "
|
||||
echo " Time per chunk: $((time_per_chunk / 60)) min"
|
||||
echo " Remaining: ${eta_days}d ${eta_hours_remainder}h"
|
||||
echo " ETA: $(date -d "+${eta_seconds} seconds" "+%Y-%m-%d %H:%M")"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "=========================================="
|
||||
Binary file not shown.
@@ -9,8 +9,13 @@ Uses existing worker infrastructure but with v9-specific worker script.
|
||||
import sqlite3
|
||||
import subprocess
|
||||
import time
|
||||
import signal
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from datetime import datetime
|
||||
import urllib.request
|
||||
import urllib.parse
|
||||
import json
|
||||
|
||||
# Worker configuration (reuse existing SSH setup)
|
||||
WORKERS = {
|
||||
@@ -28,6 +33,45 @@ WORKERS = {
|
||||
DATA_FILE = 'data/solusdt_5m.csv'
|
||||
DB_PATH = 'exploration.db'
|
||||
|
||||
# Telegram configuration
|
||||
TELEGRAM_BOT_TOKEN = '8240234365:AAEm6hg_XOm54x8ctnwpNYreFKRAEvWU3uY'
|
||||
TELEGRAM_CHAT_ID = '579304651'
|
||||
|
||||
def send_telegram_message(message: str):
|
||||
"""Send notification to Telegram"""
|
||||
try:
|
||||
url = f"https://api.telegram.org/bot{TELEGRAM_BOT_TOKEN}/sendMessage"
|
||||
data = {
|
||||
'chat_id': TELEGRAM_CHAT_ID,
|
||||
'text': message,
|
||||
'parse_mode': 'HTML'
|
||||
}
|
||||
|
||||
req = urllib.request.Request(
|
||||
url,
|
||||
data=json.dumps(data).encode('utf-8'),
|
||||
headers={'Content-Type': 'application/json'}
|
||||
)
|
||||
|
||||
with urllib.request.urlopen(req, timeout=10) as response:
|
||||
if response.status == 200:
|
||||
print(f"✓ Telegram notification sent")
|
||||
else:
|
||||
print(f"⚠️ Telegram notification failed: {response.status}")
|
||||
except Exception as e:
|
||||
print(f"⚠️ Error sending Telegram notification: {e}")
|
||||
|
||||
def signal_handler(sig, frame):
|
||||
"""Handle termination signals"""
|
||||
message = (
|
||||
"⚠️ <b>V9 Parameter Sweep STOPPED</b>\n\n"
|
||||
"Coordinator received termination signal.\n"
|
||||
"Sweep stopped prematurely.\n\n"
|
||||
f"Time: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}"
|
||||
)
|
||||
send_telegram_message(message)
|
||||
sys.exit(0)
|
||||
|
||||
def get_next_chunk():
|
||||
"""Get next pending chunk from database"""
|
||||
conn = sqlite3.connect(DB_PATH)
|
||||
@@ -171,6 +215,10 @@ def check_completions():
|
||||
|
||||
def main():
|
||||
"""Main coordinator loop"""
|
||||
# Register signal handlers for graceful shutdown
|
||||
signal.signal(signal.SIGINT, signal_handler)
|
||||
signal.signal(signal.SIGTERM, signal_handler)
|
||||
|
||||
print("="*60)
|
||||
print("V9 ADVANCED PARAMETER SWEEP - COORDINATOR")
|
||||
print("="*60)
|
||||
@@ -178,6 +226,17 @@ def main():
|
||||
print(f"Workers: {len(WORKERS)}")
|
||||
print("="*60)
|
||||
|
||||
# Send startup notification
|
||||
start_time = datetime.now()
|
||||
startup_message = (
|
||||
"🚀 <b>V9 Parameter Sweep STARTED</b>\n\n"
|
||||
f"Workers: {len(WORKERS)}\n"
|
||||
f"Total combinations: 1,693,000\n"
|
||||
f"Chunks: 1,693\n"
|
||||
f"Started: {start_time.strftime('%Y-%m-%d %H:%M:%S')}"
|
||||
)
|
||||
send_telegram_message(startup_message)
|
||||
|
||||
# Create results directory
|
||||
Path("distributed_results").mkdir(exist_ok=True)
|
||||
|
||||
@@ -208,6 +267,24 @@ def main():
|
||||
|
||||
if pending == 0 and running == 0:
|
||||
print("\n✓ All chunks completed!")
|
||||
|
||||
# Send completion notification
|
||||
end_time = datetime.now()
|
||||
duration = end_time - start_time
|
||||
days = duration.days
|
||||
hours = duration.seconds // 3600
|
||||
minutes = (duration.seconds % 3600) // 60
|
||||
|
||||
completion_message = (
|
||||
"✅ <b>V9 Parameter Sweep COMPLETED</b>\n\n"
|
||||
f"Total chunks: {completed}\n"
|
||||
f"Total combinations: 1,693,000\n\n"
|
||||
f"Duration: {days}d {hours}h {minutes}m\n"
|
||||
f"Started: {start_time.strftime('%Y-%m-%d %H:%M')}\n"
|
||||
f"Finished: {end_time.strftime('%Y-%m-%d %H:%M')}\n\n"
|
||||
"Results ready for analysis! 🎉"
|
||||
)
|
||||
send_telegram_message(completion_message)
|
||||
break
|
||||
|
||||
# Assign work to idle workers
|
||||
|
||||
Reference in New Issue
Block a user