mirror of
https://github.com/blw1138/cross-py-builder.git
synced 2026-09-07 21:41:09 -05:00
Manage workers from the web UI, persisted in SQLite
Replace the CROSS_PY_WORKERS env list with a DB-backed worker store so agents can be added/removed (and their online status verified) from the browser. - db.py: add workers table + list_workers/add_worker/remove_worker. - workers.py: configured_workers() reads the DB instead of settings. - app.py: POST /api/workers (add, probes reachability) and DELETE /api/workers/<port>/<host>; startup log uses DB worker count. - UI: Workers card with add form, per-worker live status + OS/CPU, remove. - settings.py: drop CROSS_PY_WORKERS/_get_json_list; DB is single source. - README/DESIGN updated to describe UI-managed workers.
This commit is contained in:
+9
-1
@@ -1,3 +1,4 @@
|
||||
import ctrl.db as db
|
||||
import ctrl.settings as settings
|
||||
import requests
|
||||
|
||||
@@ -11,7 +12,14 @@ def parse_worker(spec):
|
||||
|
||||
|
||||
def configured_workers():
|
||||
return [parse_worker(s) for s in settings.WORKERS]
|
||||
out = []
|
||||
for w in db.list_workers():
|
||||
out.append({
|
||||
"url": f"http://{w['host']}:{w['port']}",
|
||||
"host": w["host"],
|
||||
"port": w["port"],
|
||||
})
|
||||
return out
|
||||
|
||||
|
||||
def probe_worker(url, timeout=None):
|
||||
|
||||
Reference in New Issue
Block a user