|
| 1 | +# Weather Data Collector - Dashboard Integration |
| 2 | + |
| 3 | +## Overview |
| 4 | + |
| 5 | +The weather-data-collector-spain project is now fully integrated with the mosquito-alert-model-monitor dashboard for real-time job monitoring and status tracking. |
| 6 | + |
| 7 | +## Monitored Jobs |
| 8 | + |
| 9 | +The dashboard tracks four critical weather data collection jobs: |
| 10 | + |
| 11 | +### 🌦️ **weather-forecast** (CRITICAL PRIORITY) |
| 12 | +- **Purpose**: Municipal forecast collection for 8,129 Spanish municipalities |
| 13 | +- **Frequency**: Every 6 hours |
| 14 | +- **Script**: `priority_municipal_forecast.sh` |
| 15 | +- **Data Output**: 7-day municipal forecasts |
| 16 | +- **Critical for**: Model predictions requiring immediate forecast data |
| 17 | + |
| 18 | +### ⏰ **weather-hourly** (MEDIUM PRIORITY) |
| 19 | +- **Purpose**: Hourly station observations from all AEMET stations |
| 20 | +- **Frequency**: Every 2 hours |
| 21 | +- **Script**: `update_weather.sh` |
| 22 | +- **Data Output**: Real-time weather observations |
| 23 | +- **Critical for**: Current conditions and short-term analysis |
| 24 | + |
| 25 | +### 📊 **weather-historical** (LOW PRIORITY) |
| 26 | +- **Purpose**: Daily historical weather data backfill |
| 27 | +- **Frequency**: Daily (typically overnight) |
| 28 | +- **Script**: `update_historical_weather.sh` |
| 29 | +- **Data Output**: Historical daily climatology |
| 30 | +- **Critical for**: Long-term trend analysis and model training |
| 31 | + |
| 32 | +### 🚀 **municipal-forecast-priority** (CRITICAL PRIORITY) |
| 33 | +- **Purpose**: Immediate municipal data generation for model deployment |
| 34 | +- **Frequency**: On-demand/immediate needs |
| 35 | +- **Script**: `priority_municipal_data.sh` |
| 36 | +- **Data Output**: Complete municipal dataset with forecasts |
| 37 | +- **Critical for**: Urgent model deployment needs |
| 38 | + |
| 39 | +## How It Works |
| 40 | + |
| 41 | +### 1. **Status Reporting** |
| 42 | +Each weather collection script uses `scripts/update_weather_status.sh` to report: |
| 43 | +- Job status (running, completed, failed, waiting) |
| 44 | +- Execution duration and progress percentage |
| 45 | +- Resource usage (CPU, memory) |
| 46 | +- Next scheduled run time |
| 47 | +- Detailed configuration and metadata |
| 48 | + |
| 49 | +### 2. **Automatic Dashboard Updates** |
| 50 | +When jobs update their status: |
| 51 | +1. Status JSON file is updated in the monitor repository |
| 52 | +2. Changes are automatically committed to git |
| 53 | +3. Git push triggers GitHub Actions workflow |
| 54 | +4. Dashboard is rebuilt and deployed within 2-3 minutes |
| 55 | +5. Live dashboard shows updated job statuses |
| 56 | + |
| 57 | +### 3. **Status File Format** |
| 58 | +Each job creates a JSON status file with this structure: |
| 59 | +```json |
| 60 | +{ |
| 61 | + "job_name": "weather-forecast", |
| 62 | + "status": "completed", |
| 63 | + "last_updated": "2025-08-22T14:30:00Z", |
| 64 | + "start_time": "2025-08-22T14:25:00Z", |
| 65 | + "duration": 300, |
| 66 | + "progress": 100, |
| 67 | + "cpu_usage": 45.2, |
| 68 | + "memory_usage": 1024, |
| 69 | + "next_scheduled_run": "2025-08-22T20:30:00Z", |
| 70 | + "config": { |
| 71 | + "project_type": "weather_data_collection", |
| 72 | + "data_source": "AEMET OpenData API", |
| 73 | + "collection_scope": "Municipal forecasts", |
| 74 | + "frequency": "Every 6 hours", |
| 75 | + "priority": "CRITICAL" |
| 76 | + } |
| 77 | +} |
| 78 | +``` |
| 79 | + |
| 80 | +## Testing Integration |
| 81 | + |
| 82 | +### Run Integration Test |
| 83 | +```bash |
| 84 | +cd ~/research/weather-data-collector-spain |
| 85 | +./test_integration.sh |
| 86 | +``` |
| 87 | + |
| 88 | +### Manual Status Update |
| 89 | +```bash |
| 90 | +./scripts/update_weather_status.sh "weather-forecast" "running" 120 75 |
| 91 | +``` |
| 92 | + |
| 93 | +### View Dashboard |
| 94 | +- **Local**: `~/research/mosquito-alert-model-monitor/docs/index.html` |
| 95 | +- **Live**: [GitHub Pages URL when deployed] |
| 96 | + |
| 97 | +## HPC Cluster Usage |
| 98 | + |
| 99 | +### SLURM Job Examples |
| 100 | +```bash |
| 101 | +# Submit priority municipal forecast job |
| 102 | +sbatch priority_municipal_forecast.sh |
| 103 | + |
| 104 | +# Submit regular weather update job |
| 105 | +sbatch update_weather.sh |
| 106 | + |
| 107 | +# Submit historical data update |
| 108 | +sbatch update_historical_weather.sh |
| 109 | +``` |
| 110 | + |
| 111 | +### Cron Job Examples |
| 112 | +```bash |
| 113 | +# Every 6 hours: Municipal forecasts (critical) |
| 114 | +0 */6 * * * cd ~/research/weather-data-collector-spain && sbatch priority_municipal_forecast.sh |
| 115 | + |
| 116 | +# Every 2 hours: Station observations |
| 117 | +0 */2 * * * cd ~/research/weather-data-collector-spain && sbatch update_weather.sh |
| 118 | + |
| 119 | +# Daily: Historical data update |
| 120 | +0 6 * * * cd ~/research/weather-data-collector-spain && sbatch update_historical_weather.sh |
| 121 | +``` |
| 122 | + |
| 123 | +## Dashboard Benefits |
| 124 | + |
| 125 | +1. **Real-time Monitoring**: See job status, progress, and performance metrics |
| 126 | +2. **Failure Detection**: Immediate notification when jobs fail |
| 127 | +3. **Resource Tracking**: Monitor CPU, memory usage across jobs |
| 128 | +4. **Schedule Visibility**: Know when jobs are due to run next |
| 129 | +5. **Historical Trends**: Track job performance over time |
| 130 | +6. **Remote Access**: Monitor jobs from anywhere via GitHub Pages |
| 131 | + |
| 132 | +## Troubleshooting |
| 133 | + |
| 134 | +### Common Issues |
| 135 | + |
| 136 | +**Status not updating:** |
| 137 | +- Check git push permissions from HPC cluster |
| 138 | +- Verify monitor repository path in scripts |
| 139 | +- Ensure conda environment is activated |
| 140 | + |
| 141 | +**Dashboard not rendering:** |
| 142 | +- Check GitHub Actions workflow status |
| 143 | +- Verify Quarto and R dependencies |
| 144 | +- Check for JSON syntax errors in status files |
| 145 | + |
| 146 | +**Jobs not appearing:** |
| 147 | +- Ensure status files are created in correct directory |
| 148 | +- Check file permissions |
| 149 | +- Verify JSON structure matches expected format |
| 150 | + |
| 151 | +### Debug Commands |
| 152 | +```bash |
| 153 | +# Check if status files exist |
| 154 | +ls -la ~/research/mosquito-alert-model-monitor/data/status/ |
| 155 | + |
| 156 | +# Validate JSON syntax |
| 157 | +jq . ~/research/mosquito-alert-model-monitor/data/status/weather-forecast.json |
| 158 | + |
| 159 | +# Test git operations |
| 160 | +cd ~/research/mosquito-alert-model-monitor |
| 161 | +git status |
| 162 | +git log --oneline -5 |
| 163 | +``` |
| 164 | + |
| 165 | +## Integration Maintenance |
| 166 | + |
| 167 | +- **Status scripts** are automatically updated with each job run |
| 168 | +- **Dashboard rebuilds** happen automatically via GitHub Actions |
| 169 | +- **No manual intervention** required for normal operations |
| 170 | +- **Monitor git repository** should be kept up to date with latest changes |
| 171 | + |
| 172 | +This integration provides comprehensive monitoring for all weather data collection activities, ensuring reliable operation and immediate visibility into job status and performance. |
0 commit comments