Skip to content

Commit 7ded014

Browse files
committed
Add weather integration documentation and local test script for dashboard monitoring
1 parent 6372c2a commit 7ded014

File tree

2 files changed

+145
-0
lines changed

2 files changed

+145
-0
lines changed

docs/weather-integration.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Weather Data Collector - Dashboard Integration
2+
3+
## ✅ Integration Complete
4+
5+
The weather-data-collector-spain project is now fully integrated with the mosquito-alert-model-monitor dashboard.
6+
7+
## 🎯 What's Monitored
8+
9+
The dashboard now tracks these weather collection jobs:
10+
11+
| Job Name | Purpose | Frequency | Priority |
12+
|----------|---------|-----------|----------|
13+
| `weather-forecast` | Municipal forecasts (8,129 municipalities) | Every 6 hours | CRITICAL |
14+
| `weather-hourly` | Station observations (all AEMET stations) | Every 2 hours | MEDIUM |
15+
| `weather-historical` | Historical data backfill | Daily | LOW |
16+
| `municipal-forecast-priority` | Immediate municipal data | Every 6 hours | CRITICAL |
17+
18+
## 🔧 Key Changes Made
19+
20+
### 1. Enhanced Status Reporting
21+
- **Updated**: `scripts/update_weather_status.sh` now includes git push functionality
22+
- **Result**: Job status changes automatically trigger dashboard rebuilds
23+
24+
### 2. Job Script Integration
25+
- **Modified**: `update_weather.sh` with proper status reporting
26+
- **Modified**: `priority_municipal_data.sh` with status integration
27+
- **Result**: All weather jobs report progress, duration, and completion status
28+
29+
### 3. Initial Status Files
30+
- **Created**: Status files for all 4 weather jobs in the dashboard
31+
- **Result**: Dashboard shows weather jobs even when not actively running
32+
33+
## 🚀 Testing on Cluster
34+
35+
When you're ready to test on the HPC cluster:
36+
37+
### 1. Quick Integration Test
38+
```bash
39+
cd ~/research/weather-data-collector-spain
40+
./scripts/test_dashboard_integration.sh
41+
```
42+
43+
### 2. Run a Real Weather Job
44+
```bash
45+
# Test the priority municipal forecast (short runtime)
46+
sbatch priority_municipal_data.sh
47+
48+
# Monitor dashboard for live updates
49+
```
50+
51+
### 3. Check Dashboard
52+
- **Local**: `~/research/mosquito-alert-model-monitor/docs/index.html`
53+
- **GitHub Pages**: Will auto-update within 2-3 minutes of job status changes
54+
55+
## 📊 Dashboard Features for Weather Jobs
56+
57+
- **Real-time Status**: Running, completed, failed, waiting
58+
- **Progress Tracking**: 0-100% completion
59+
- **Duration Monitoring**: Job execution time
60+
- **Resource Usage**: CPU and memory utilization
61+
- **Next Run Schedule**: Automatic calculation based on job type
62+
- **Error Alerts**: Failed jobs highlighted in dashboard
63+
64+
## 🔄 How It Works
65+
66+
1. **Job starts** → Updates status to "running"
67+
2. **Job progresses** → Periodic status updates with progress %
68+
3. **Job completes/fails** → Final status update
69+
4. **Status script** → Automatically commits and pushes to git
70+
5. **GitHub Actions** → Rebuilds and deploys dashboard
71+
6. **Dashboard** → Shows updated status within 2-3 minutes
72+
73+
## ⚠️ Requirements on Cluster
74+
75+
- SSH keys configured for git push
76+
- `mosquito-alert-monitor` conda environment activated
77+
- Access to `~/research/mosquito-alert-model-monitor` directory
78+
79+
## 🎉 Benefits
80+
81+
- **Real-time Monitoring**: See job status without logging into cluster
82+
- **Historical Tracking**: Dashboard maintains job history
83+
- **Automated Alerts**: Failed jobs are highlighted
84+
- **Resource Monitoring**: Track cluster resource usage
85+
- **Schedule Awareness**: See when jobs are expected to run next
86+
87+
Your weather data collection pipeline is now fully visible and monitored through the dashboard!
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/bin/bash
2+
3+
# test_weather_integration_local.sh
4+
# --------------------------------
5+
# Local test to verify weather project integration with dashboard
6+
# This simulates the weather job status updates without running actual collection
7+
8+
echo "=== Testing Weather Data Collector Integration (Local) ==="
9+
10+
# Configuration
11+
MONITOR_REPO="/Users/palmer/research/mosquito-alert-model-monitor"
12+
STATUS_SCRIPT="$MONITOR_REPO/scripts/update_job_status_and_push.sh"
13+
14+
cd "$MONITOR_REPO"
15+
16+
echo "✅ Testing weather job status updates..."
17+
18+
# Simulate different weather job statuses
19+
echo "📡 Simulating weather-forecast job..."
20+
$STATUS_SCRIPT "weather-forecast" "running" 120 45
21+
22+
sleep 2
23+
24+
echo "🌡️ Simulating weather-hourly job..."
25+
$STATUS_SCRIPT "weather-hourly" "completed" 300 100
26+
27+
sleep 2
28+
29+
echo "📚 Simulating weather-historical job..."
30+
$STATUS_SCRIPT "weather-historical" "running" 180 75
31+
32+
sleep 2
33+
34+
echo "🏘️ Simulating municipal-forecast-priority job..."
35+
$STATUS_SCRIPT "municipal-forecast-priority" "completed" 90 100
36+
37+
echo ""
38+
echo "✅ Weather job status files created:"
39+
ls -la data/status/weather-*.json data/status/municipal-*.json 2>/dev/null || echo "No weather status files found"
40+
41+
echo ""
42+
echo "📊 Sample status file content:"
43+
if [ -f "data/status/weather-forecast.json" ]; then
44+
echo "--- weather-forecast.json ---"
45+
cat data/status/weather-forecast.json | head -10
46+
else
47+
echo "⚠️ weather-forecast.json not found"
48+
fi
49+
50+
echo ""
51+
echo "🎯 Integration test complete!"
52+
echo "📈 Check your dashboard at: file://$MONITOR_REPO/docs/index.html"
53+
echo "🔄 If GitHub Actions is set up, the dashboard will rebuild automatically"
54+
echo ""
55+
echo "🚀 When you test on the cluster:"
56+
echo " 1. Run: cd ~/research/weather-data-collector-spain"
57+
echo " 2. Test: ./scripts/test_dashboard_integration.sh"
58+
echo " 3. Monitor: Check dashboard for live updates"

0 commit comments

Comments
 (0)