- Docker: Delete 23 deprecated Dockerfiles, fix CI/CD to use Dockerfile.foxhunt-build - Config: Remove 36 .env files, keep 4 essential, delete config/environments/ - Docs: Archive 614 Wave D files to docs/archive/wave_d/, 95% reduction in root - Scripts: Delete 56 deprecated scripts, keep 58 production-critical (49% reduction) - Python: Organize 37 scripts into scripts/python/ subdirectories, delete ml/python/ - Build: Remove 1GB artifacts, delete old venvs, clean Python cache from git - Migrations: Delete deprecated directory (4,432 lines), remove duplicate database/migrations/ - Infrastructure: Delete deployment/ (61 files), docs/scripts/ (8 files) Total impact: ~2,500 files cleaned, 750MB+ space freed, zero production impact All deleted scripts backed up to archives. runpod/ and tests/runpod/ preserved. data_acquisition_service retained per user request.
149 lines
4.5 KiB
Bash
Executable File
149 lines
4.5 KiB
Bash
Executable File
#!/bin/bash
|
|
# Cleanup deprecated scripts from scripts/ directory
|
|
# Created: 2025-10-30
|
|
|
|
set -uo pipefail
|
|
|
|
SCRIPT_DIR="/home/jgrusewski/Work/foxhunt/scripts"
|
|
BACKUP_DIR="/home/jgrusewski/Work/foxhunt/scripts/archive/cleanup_2025_10_30"
|
|
|
|
# Create backup directory
|
|
mkdir -p "$BACKUP_DIR"
|
|
|
|
echo "=== Foxhunt Scripts Cleanup ==="
|
|
echo "Backup location: $BACKUP_DIR"
|
|
echo ""
|
|
|
|
# Counter
|
|
DELETED=0
|
|
KEPT=0
|
|
|
|
# Function to delete and track
|
|
delete_script() {
|
|
local file="$1"
|
|
if [ -f "$SCRIPT_DIR/$file" ]; then
|
|
mv "$SCRIPT_DIR/$file" "$BACKUP_DIR/" || true
|
|
echo "✓ Deleted: $file"
|
|
((DELETED++)) || true
|
|
else
|
|
echo "⊗ Not found: $file"
|
|
fi
|
|
}
|
|
|
|
echo "=== Category 1: One-time fix scripts (10 files) ==="
|
|
delete_script "fix_all_audit_tests.py"
|
|
delete_script "fix_async_audit_queue_tests.py"
|
|
delete_script "fix_async_audit_queue_tests_v2.py"
|
|
delete_script "fix_audit_compliance.py"
|
|
delete_script "fix_services_unwrap.sh"
|
|
delete_script "fix_services_unwrap2.sh"
|
|
delete_script "fix_services_unwrap3.sh"
|
|
delete_script "fix_services_unwrap4.sh"
|
|
delete_script "fix_services_unwrap5.sh"
|
|
delete_script "fix_mamba2_lr.sh"
|
|
echo ""
|
|
|
|
echo "=== Category 2: Duplicate scripts (6 files) ==="
|
|
delete_script "run_coverage.sh"
|
|
delete_script "run-coverage-llvm.sh"
|
|
delete_script "compare_checkpoints.sh"
|
|
delete_script "train_all_models_full.sh"
|
|
delete_script "auto_fix_safe.sh"
|
|
delete_script "activate_venv.sh"
|
|
echo ""
|
|
|
|
echo "=== Category 3: Unused test scripts (19 files) ==="
|
|
delete_script "test_alerting.sh"
|
|
delete_script "test_alert_resolution.sh"
|
|
delete_script "test_coverage_edge_cases.sh"
|
|
delete_script "test_coverage_enforcement.sh"
|
|
delete_script "test_cuda_fix.sh"
|
|
delete_script "test_direct_training.sh"
|
|
delete_script "test_dqn_training.sh"
|
|
delete_script "test_ensemble_alerts.sh"
|
|
delete_script "test_full_3month_training.sh"
|
|
delete_script "test_grafana_dashboard.sh"
|
|
delete_script "test_optimized_dockerfile.sh"
|
|
delete_script "test_regime_endpoints.sh"
|
|
delete_script "test_service_integration.sh"
|
|
delete_script "test_service_startup.sh"
|
|
delete_script "test_tli_commands.sh"
|
|
delete_script "test_tli_tuning.sh"
|
|
delete_script "test_tuning_small.sh"
|
|
delete_script "test_vault_integration.sh"
|
|
delete_script "test_wave_d_alerts.sh"
|
|
echo ""
|
|
|
|
echo "=== Category 4: Legacy utilities (12 files) ==="
|
|
delete_script "auto_launch_ppo.sh"
|
|
delete_script "auto_monitor_and_launch.sh"
|
|
delete_script "check_dependencies.sh"
|
|
delete_script "check-warnings.sh"
|
|
delete_script "dashboard_monitor.sh"
|
|
delete_script "databento_minimal_download.sh"
|
|
delete_script "deploy_tuning.sh"
|
|
delete_script "download_mbp10.sh"
|
|
delete_script "implement_pgo.sh"
|
|
delete_script "ppo_tuning_prep.sh"
|
|
delete_script "sequential_tuning_launcher.sh"
|
|
delete_script "upload_checkpoints.sh"
|
|
echo ""
|
|
|
|
echo "=== Category 5: Redundant monitoring (6 files) ==="
|
|
delete_script "monitor_all_training.sh"
|
|
delete_script "monitor_paper_trading.sh"
|
|
delete_script "monitor_tuning.sh"
|
|
delete_script "monitor_system.sh"
|
|
delete_script "monitor_training.sh"
|
|
delete_script "monitor_training_basic.sh"
|
|
echo ""
|
|
|
|
echo "=== Category 6: Performance scripts (7 files) ==="
|
|
delete_script "e2e_latency_benchmark.sh"
|
|
delete_script "profile_trading_cycle.sh"
|
|
delete_script "generate_flame_graphs.sh"
|
|
delete_script "record_baseline_metrics.sh"
|
|
delete_script "grpc_load_test.sh"
|
|
delete_script "grpc_load_test_wave78.sh"
|
|
delete_script "load_test_wave79.sh"
|
|
echo ""
|
|
|
|
echo "=== Cleanup Complete ==="
|
|
echo "Deleted: $DELETED files"
|
|
echo "Backup: $BACKUP_DIR"
|
|
echo ""
|
|
|
|
# Count remaining scripts
|
|
REMAINING=$(find "$SCRIPT_DIR" -maxdepth 1 -type f \( -name "*.sh" -o -name "*.py" \) | wc -l)
|
|
echo "Remaining scripts: $REMAINING"
|
|
echo ""
|
|
|
|
# List remaining scripts by category
|
|
echo "=== Remaining Active Scripts ==="
|
|
echo ""
|
|
echo "Deployment (3):"
|
|
ls -1 "$SCRIPT_DIR"/runpod_deploy.py "$SCRIPT_DIR"/upload_binary.py "$SCRIPT_DIR"/monitor_logs.py 2>/dev/null || true
|
|
echo ""
|
|
|
|
echo "Build (3):"
|
|
ls -1 "$SCRIPT_DIR"/build_docker_images.sh "$SCRIPT_DIR"/build_hyperopt_docker.sh "$SCRIPT_DIR"/local_ci_pipeline.sh 2>/dev/null || true
|
|
echo ""
|
|
|
|
echo "Validation (all validate_* files):"
|
|
ls -1 "$SCRIPT_DIR"/validate*.sh "$SCRIPT_DIR"/validate*.py 2>/dev/null | wc -l
|
|
echo ""
|
|
|
|
echo "Health/Smoke (2):"
|
|
ls -1 "$SCRIPT_DIR"/health_check.sh "$SCRIPT_DIR"/smoke_test.sh 2>/dev/null || true
|
|
echo ""
|
|
|
|
echo "Training (all train_* files):"
|
|
ls -1 "$SCRIPT_DIR"/train*.sh "$SCRIPT_DIR"/train*.py 2>/dev/null | wc -l
|
|
echo ""
|
|
|
|
echo "=== Summary ==="
|
|
echo "Before cleanup: 114 scripts"
|
|
echo "After cleanup: $REMAINING scripts"
|
|
echo "Deleted: $DELETED scripts"
|
|
echo "Success! ✅"
|