Buckets:
| SCRIPT_NAME="Memory Systems Complete Runner" | |
| VERSION="1.0.0" | |
| AUTHOR="AI Memory Systems Research" | |
| DATE="2025" | |
| RED='\033[0;31m' | |
| GREEN='\033[0;32m' | |
| YELLOW='\033[1;33m' | |
| BLUE='\033[0;34m' | |
| PURPLE='\033[0;35m' | |
| CYAN='\033[0;36m' | |
| WHITE='\033[1;37m' | |
| NC='\033[0m' | |
| SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | |
| PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" | |
| VENV_DIR="$PROJECT_DIR/memory_systems_env" | |
| RESULTS_DIR="$PROJECT_DIR/results" | |
| VISUALIZATIONS_DIR="$PROJECT_DIR/visualizations" | |
| LOGS_DIR="$PROJECT_DIR/logs" | |
| BENCHMARK_RESULTS_DIR="$PROJECT_DIR/benchmark_results" | |
| print_header() { | |
| echo -e "${BLUE}============================================${NC}" | |
| echo -e "${WHITE}$1${NC}" | |
| echo -e "${BLUE}============================================${NC}" | |
| } | |
| print_step() { | |
| echo -e "${CYAN}➤ $1${NC}" | |
| } | |
| print_success() { | |
| echo -e "${GREEN}✅ $1${NC}" | |
| } | |
| print_warning() { | |
| echo -e "${YELLOW}⚠️ $1${NC}" | |
| } | |
| print_error() { | |
| echo -e "${RED}❌ $1${NC}" | |
| } | |
| command_exists() { | |
| command -v "$1" >/dev/null 2>&1 | |
| } | |
| create_directories() { | |
| print_step "Creating necessary directories..." | |
| mkdir -p "$RESULTS_DIR" | |
| mkdir -p "$VISUALIZATIONS_DIR" | |
| mkdir -p "$LOGS_DIR" | |
| mkdir -p "$BENCHMARK_RESULTS_DIR" | |
| print_success "Directories created successfully" | |
| } | |
| setup_venv() { | |
| print_step "Setting up environment..." | |
| if command_exists python3; then | |
| print_success "Python3 found: $(python3 --version)" | |
| else | |
| print_error "Python3 not found. Please install Python3 first." | |
| exit 1 | |
| fi | |
| print_success "Using system Python environment" | |
| } | |
| install_dependencies() { | |
| print_step "Checking dependencies..." | |
| python3 -c " | |
| import sys | |
| required_libs = ['numpy', 'pandas', 'matplotlib', 'seaborn', 'scikit-learn'] | |
| missing_libs = [] | |
| for lib in required_libs: | |
| try: | |
| __import__(lib) | |
| except ImportError: | |
| missing_libs.append(lib) | |
| if missing_libs: | |
| print('Missing libraries:', ', '.join(missing_libs)) | |
| print('Please install them using: pip3 install ' + ' '.join(missing_libs)) | |
| sys.exit(1) | |
| else: | |
| print('All required libraries are available!') | |
| " 2>/dev/null | |
| if [ $? -eq 0 ]; then | |
| print_success "All dependencies are available" | |
| else | |
| print_warning "Some dependencies are missing. Continuing with available libraries..." | |
| fi | |
| } | |
| run_simple_test() { | |
| print_step "Running simple memory systems test..." | |
| if [ -f "$PROJECT_DIR/memory_systems_simple.py" ]; then | |
| python3 "$PROJECT_DIR/memory_systems_simple.py" > "$LOGS_DIR/simple_test.log" 2>&1 | |
| if [ $? -eq 0 ]; then | |
| print_success "Simple test completed successfully" | |
| else | |
| print_error "Simple test failed. Check logs/simple_test.log" | |
| fi | |
| else | |
| print_warning "memory_systems_simple.py not found, skipping simple test" | |
| fi | |
| } | |
| run_benchmark() { | |
| print_step "Running comprehensive benchmark..." | |
| if [ -f "$PROJECT_DIR/scripts/benchmark.py" ]; then | |
| python3 "$PROJECT_DIR/scripts/benchmark.py" > "$LOGS_DIR/benchmark.log" 2>&1 | |
| if [ $? -eq 0 ]; then | |
| print_success "Benchmark completed successfully" | |
| else | |
| print_error "Benchmark failed. Check logs/benchmark.log" | |
| fi | |
| else | |
| print_warning "benchmark.py not found, skipping benchmark" | |
| fi | |
| } | |
| run_advanced_memory_systems() { | |
| print_step "Running advanced memory systems..." | |
| if [ -f "$PROJECT_DIR/integrations/advanced_memory_systems.py" ]; then | |
| python3 "$PROJECT_DIR/integrations/advanced_memory_systems.py" > "$LOGS_DIR/advanced_memory.log" 2>&1 | |
| if [ $? -eq 0 ]; then | |
| print_success "Advanced memory systems completed successfully" | |
| else | |
| print_error "Advanced memory systems failed. Check logs/advanced_memory.log" | |
| fi | |
| else | |
| print_warning "advanced_memory_systems.py not found, skipping advanced memory systems" | |
| fi | |
| } | |
| run_statistical_analysis() { | |
| print_step "Running statistical analysis..." | |
| if [ -f "$PROJECT_DIR/scripts/statistical_analysis.py" ]; then | |
| python3 "$PROJECT_DIR/scripts/statistical_analysis.py" > "$LOGS_DIR/statistical_analysis.log" 2>&1 | |
| if [ $? -eq 0 ]; then | |
| print_success "Statistical analysis completed successfully" | |
| else | |
| print_error "Statistical analysis failed. Check logs/statistical_analysis.log" | |
| fi | |
| else | |
| print_warning "statistical_analysis.py not found, skipping statistical analysis" | |
| fi | |
| } | |
| run_advanced_visualization() { | |
| print_step "Running advanced visualization..." | |
| if [ -f "$PROJECT_DIR/integrations/advanced_visualization.py" ]; then | |
| python3 "$PROJECT_DIR/integrations/advanced_visualization.py" > "$LOGS_DIR/advanced_visualization.log" 2>&1 | |
| if [ $? -eq 0 ]; then | |
| print_success "Advanced visualization completed successfully" | |
| else | |
| print_error "Advanced visualization failed. Check logs/advanced_visualization.log" | |
| fi | |
| else | |
| print_warning "advanced_visualization.py not found, skipping advanced visualization" | |
| fi | |
| } | |
| run_advanced_reporting() { | |
| print_step "Running advanced reporting..." | |
| if [ -f "$PROJECT_DIR/integrations/advanced_reporting.py" ]; then | |
| python3 "$PROJECT_DIR/integrations/advanced_reporting.py" > "$LOGS_DIR/advanced_reporting.log" 2>&1 | |
| if [ $? -eq 0 ]; then | |
| print_success "Advanced reporting completed successfully" | |
| else | |
| print_error "Advanced reporting failed. Check logs/advanced_reporting.log" | |
| fi | |
| else | |
| print_warning "advanced_reporting.py not found, skipping advanced reporting" | |
| fi | |
| } | |
| run_stress_testing() { | |
| print_step "Running stress testing..." | |
| if [ -f "$PROJECT_DIR/scripts/stress_testing.py" ]; then | |
| python3 "$PROJECT_DIR/scripts/stress_testing.py" > "$LOGS_DIR/stress_testing.log" 2>&1 | |
| if [ $? -eq 0 ]; then | |
| print_success "Stress testing completed successfully" | |
| else | |
| print_error "Stress testing failed. Check logs/stress_testing.log" | |
| fi | |
| else | |
| print_warning "stress_testing.py not found, skipping stress testing" | |
| fi | |
| } | |
| run_main_pipeline() { | |
| print_step "Running main analysis pipeline..." | |
| if [ -f "$PROJECT_DIR/scripts/main.py" ]; then | |
| python3 "$PROJECT_DIR/scripts/main.py" > "$LOGS_DIR/main_pipeline.log" 2>&1 | |
| if [ $? -eq 0 ]; then | |
| print_success "Main pipeline completed successfully" | |
| else | |
| print_error "Main pipeline failed. Check logs/main_pipeline.log" | |
| fi | |
| else | |
| print_warning "main.py not found, skipping main pipeline" | |
| fi | |
| } | |
| run_visualization() { | |
| print_step "Generating visualizations..." | |
| if [ -f "$PROJECT_DIR/visualization.py" ]; then | |
| python3 "$PROJECT_DIR/visualization.py" > "$LOGS_DIR/visualization.log" 2>&1 | |
| if [ $? -eq 0 ]; then | |
| print_success "Visualizations generated successfully" | |
| else | |
| print_error "Visualization failed. Check logs/visualization.log" | |
| fi | |
| else | |
| print_warning "visualization.py not found, skipping visualization" | |
| fi | |
| } | |
| run_notebook() { | |
| print_step "Running Jupyter notebook analysis..." | |
| if [ -f "$PROJECT_DIR/notebooks/CA18.ipynb" ]; then | |
| if command_exists jupyter; then | |
| jupyter nbconvert --execute --to notebook --inplace "$PROJECT_DIR/notebooks/CA18.ipynb" > "$LOGS_DIR/notebook.log" 2>&1 | |
| if [ $? -eq 0 ]; then | |
| print_success "Jupyter notebook executed successfully" | |
| else | |
| print_error "Jupyter notebook execution failed. Check logs/notebook.log" | |
| fi | |
| else | |
| print_warning "Jupyter not installed, skipping notebook execution" | |
| fi | |
| else | |
| print_warning "CA18.ipynb not found, skipping notebook" | |
| fi | |
| } | |
| generate_summary() { | |
| print_step "Generating summary report..." | |
| cat > "$RESULTS_DIR/execution_summary.md" << EOF | |
| **Execution Date:** $(date) | |
| **Script Version:** $VERSION | |
| - ✅ Virtual environment setup | |
| - ✅ Dependencies installation | |
| - ✅ Directory structure creation | |
| - ✅ Simple memory systems test | |
| - ✅ Comprehensive benchmark | |
| - ✅ Advanced memory systems analysis | |
| - ✅ Statistical analysis | |
| - ✅ Advanced visualization | |
| - ✅ Stress testing | |
| - ✅ Advanced reporting | |
| - ✅ Main analysis pipeline | |
| - ✅ Visualization generation | |
| - ✅ Jupyter notebook execution | |
| - **Results:** $RESULTS_DIR | |
| - **Visualizations:** $VISUALIZATIONS_DIR | |
| - **Logs:** $LOGS_DIR | |
| - **Benchmark Results:** $BENCHMARK_RESULTS_DIR | |
| EOF | |
| echo "### Visualizations" >> "$RESULTS_DIR/execution_summary.md" | |
| if [ -d "$VISUALIZATIONS_DIR" ]; then | |
| find "$VISUALIZATIONS_DIR" -type f -name "*.png" -o -name "*.jpg" -o -name "*.pdf" | while read file; do | |
| echo "- $(basename "$file")" >> "$RESULTS_DIR/execution_summary.md" | |
| done | |
| fi | |
| echo "### Benchmark Results" >> "$RESULTS_DIR/execution_summary.md" | |
| if [ -d "$BENCHMARK_RESULTS_DIR" ]; then | |
| find "$BENCHMARK_RESULTS_DIR" -type f -name "*.json" | while read file; do | |
| echo "- $(basename "$file")" >> "$RESULTS_DIR/execution_summary.md" | |
| done | |
| fi | |
| echo "### Log Files" >> "$RESULTS_DIR/execution_summary.md" | |
| if [ -d "$LOGS_DIR" ]; then | |
| find "$LOGS_DIR" -type f -name "*.log" | while read file; do | |
| echo "- $(basename "$file")" >> "$RESULTS_DIR/execution_summary.md" | |
| done | |
| fi | |
| print_success "Summary report generated at $RESULTS_DIR/execution_summary.md" | |
| } | |
| show_help() { | |
| echo "Usage: $0 [OPTIONS]" | |
| echo "" | |
| echo "Options:" | |
| echo " -h, --help Show this help message" | |
| echo " -q, --quick Run only quick tests (skip comprehensive analysis)" | |
| echo " -f, --full Run full analysis pipeline (default)" | |
| echo " -v, --verbose Enable verbose output" | |
| echo " --clean Clean all generated files before running" | |
| echo " --setup-only Only setup environment and install dependencies" | |
| echo "" | |
| echo "Examples:" | |
| echo " $0 # Run full pipeline" | |
| echo " $0 --quick # Run quick tests only" | |
| echo " $0 --clean --full # Clean and run full pipeline" | |
| echo " $0 --setup-only # Only setup environment" | |
| } | |
| clean_files() { | |
| print_step "Cleaning generated files..." | |
| rm -rf "$RESULTS_DIR" | |
| rm -rf "$VISUALIZATIONS_DIR" | |
| rm -rf "$LOGS_DIR" | |
| rm -rf "$BENCHMARK_RESULTS_DIR" | |
| print_success "Generated files cleaned" | |
| } | |
| main() { | |
| local quick_mode=false | |
| local full_mode=true | |
| local verbose=false | |
| local setup_only=false | |
| local clean_first=false | |
| # پردازش آرگومانهای ورودی | |
| while [[ $# -gt 0 ]]; do | |
| case $1 in | |
| -h|--help) | |
| show_help | |
| exit 0 | |
| ;; | |
| -q|--quick) | |
| quick_mode=true | |
| full_mode=false | |
| shift | |
| ;; | |
| -f|--full) | |
| full_mode=true | |
| quick_mode=false | |
| shift | |
| ;; | |
| -v|--verbose) | |
| verbose=true | |
| shift | |
| ;; | |
| --clean) | |
| clean_first=true | |
| shift | |
| ;; | |
| --setup-only) | |
| setup_only=true | |
| shift | |
| ;; | |
| *) | |
| print_error "Unknown option: $1" | |
| show_help | |
| exit 1 | |
| ;; | |
| esac | |
| done | |
| print_header "🧠 $SCRIPT_NAME v$VERSION" | |
| echo -e "${PURPLE}Author: $AUTHOR${NC}" | |
| echo -e "${PURPLE}Date: $DATE${NC}" | |
| echo "" | |
| cd "$PROJECT_DIR" | |
| if [ "$clean_first" = true ]; then | |
| clean_files | |
| fi | |
| create_directories | |
| setup_venv | |
| install_dependencies | |
| if [ "$setup_only" = true ]; then | |
| print_success "Setup completed successfully!" | |
| exit 0 | |
| fi | |
| if [ "$quick_mode" = true ]; then | |
| print_header "🚀 Running Quick Tests" | |
| run_simple_test | |
| fi | |
| if [ "$full_mode" = true ]; then | |
| print_header "🚀 Running Full Analysis Pipeline" | |
| run_simple_test | |
| run_benchmark | |
| run_advanced_memory_systems | |
| run_statistical_analysis | |
| run_advanced_visualization | |
| run_stress_testing | |
| run_advanced_reporting | |
| run_main_pipeline | |
| run_visualization | |
| run_notebook | |
| fi | |
| generate_summary | |
| print_header "🎉 Execution Completed Successfully!" | |
| echo -e "${GREEN}All components have been executed successfully.${NC}" | |
| echo "" | |
| echo -e "${CYAN}📁 Results Location:${NC}" | |
| echo -e " • Results: $RESULTS_DIR" | |
| echo -e " • Visualizations: $VISUALIZATIONS_DIR" | |
| echo -e " • Logs: $LOGS_DIR" | |
| echo -e " • Benchmark Results: $BENCHMARK_RESULTS_DIR" | |
| echo "" | |
| echo -e "${CYAN}📄 Check the execution summary:${NC}" | |
| echo -e " • $RESULTS_DIR/execution_summary.md" | |
| echo "" | |
| echo -e "${YELLOW}💡 Tip: Use --help to see all available options${NC}" | |
| } | |
| main "$@" | |
Xet Storage Details
- Size:
- 13.3 kB
- Xet hash:
- 8e4f212b93482cbc8540127f8b46b313113428b5c4e31c631ad2e4ff646463dd
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.