Fix workflows scroll, add CPU/mem/disk sparklines during job runs

This commit is contained in:
zyphlar
2026-04-18 22:50:54 -07:00
parent 3e1b7aa089
commit 32cd6cba59
2 changed files with 148 additions and 0 deletions
+18
View File
@@ -9,6 +9,11 @@ import threading
import json
from datetime import datetime
import yaml
try:
import psutil
_has_psutil = True
except ImportError:
_has_psutil = False
app = Flask(__name__, static_folder='static', template_folder='templates')
@@ -251,6 +256,19 @@ def upload_file():
f.save(dest)
return jsonify({'success': True, 'path': dest})
@app.route('/api/system-stats')
def system_stats():
"""Return current CPU, memory, and disk usage percentages."""
if not _has_psutil:
return jsonify({'error': 'psutil not installed'}), 503
cpu = psutil.cpu_percent(interval=None)
mem = psutil.virtual_memory().percent
try:
disk = psutil.disk_usage('/data').percent
except Exception:
disk = psutil.disk_usage('/').percent
return jsonify({'cpu': cpu, 'mem': mem, 'disk': disk})
@app.route('/api/list-files')
def list_files():
"""List available GeoJSON files"""