Skip to content

Commit

Permalink
monitor debug
Browse files Browse the repository at this point in the history
  • Loading branch information
DanRunfola committed Feb 24, 2025
1 parent ce597be commit 473b36e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
2 changes: 1 addition & 1 deletion geoBoundaryBuilder/monitor/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def get_worker_grid():
# Get all worker statuses
cur.execute("""
SELECT "STATUS_TYPE", "STATUS", "TIME"
FROM status
FROM worker_status
WHERE "STATUS_TYPE" LIKE '%_WORKER'
""")
rows = cur.fetchall()
Expand Down
28 changes: 21 additions & 7 deletions geoBoundaryBuilder/monitor/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -280,14 +280,28 @@ <h2>Worker Status Grid</h2>
}

function getStatusColor(status, timestamp) {
const ageInHours = (new Date() - new Date(timestamp)) / (1000 * 60 * 60);
const baseColor = status.includes('COMPLETE') ? [46, 204, 113] : // Green
status.includes('ERROR') ? [231, 76, 60] : // Red
[241, 196, 15]; // Yellow
const ageInDays = (new Date() - new Date(timestamp)) / (1000 * 60 * 60 * 24);

// Darken based on age (up to 72 hours)
const darkening = Math.min(ageInHours / 72, 1) * 0.7; // Max 70% darker
return `rgb(${baseColor.map(c => Math.round(c * (1 - darkening))).join(',')})`;
if (status.includes('ERROR')) {
// Red colors for ERROR: Brighter red for older (up to 1 month), darker red for newer
const brightness = Math.min(ageInDays / 30, 1); // Scale over 30 days
const red = 200 + Math.round(55 * brightness); // 200-255
const other = 30 + Math.round(30 * brightness); // 30-60
return `rgb(${red},${other},${other})`;
} else if (status.includes('COMPLETE')) {
// Green colors: Dark green for older (1+ month), bright green for newer
const brightness = Math.max(0, 1 - (ageInDays / 30)); // Scale over 30 days
const green = 100 + Math.round(155 * brightness); // 100-255
const other = 30 + Math.round(40 * brightness); // 30-70
return `rgb(${other},${green},${other})`;
} else {
// Yellow turning to bright red if more than 1 day old
if (ageInDays > 1) {
return 'rgb(255,50,50)'; // Bright red
}
return 'rgb(241,196,15)'; // Yellow
}
}
}

function updateWorkerGrid() {
Expand Down

0 comments on commit 473b36e

Please sign in to comment.