Runs live, versioned Python application objects on one VM, with a suite of apps: projects, notes, tasks, files and more.

9 downloads

Install on DigitalOcean Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/dbbasic-object-server.git
HTTPS
https://gitstable.com/git/askrobots/dbbasic-object-server.git
SSH
ssh://git@gitstable.com:2222/askrobots/dbbasic-object-server.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

Daniel Quellhorst Changelog for this batch. 65ef78d 3 hours, 49 minutes ago History
backup_attention.py · 1.8 KB · 46 lines
1"""system_backup_attention -- scheduled backups that failed or went stale.
2
3COUNT {} -> {count, detail}
4
5`urgent`, beside scheduler_failures and for the same reason: this is the
6machine reporting that it stopped doing its own work, and of all its work
7this is the one whose silent failure cannot be apologised for. A backup
8that stopped running looks exactly like a backup that is running until the
9day somebody needs it.
10
11The count is the number of PROBLEMS object_backup_schedule.status names
12(the last backup failed, no good backup within two intervals, the last
13restore test failed, no passing restore test within two intervals, the
14destination is refused, the after-command failed), and the detail is the
15first one in words. Zero when everything is fine -- and zero when backups
16are off, because turning them on is the operator's decision and an alarm
17on every fresh install would teach everyone to ignore the band; the
18dashboard and /admin/status say "off" in words instead.
19
20No `reads` in the manifest, deliberately: the attention layer shows a
21provider that names no collections to admins only, and what a backup
22destination is and whether it works is an admin's business.
23
24COUNT rather than GET or POST: the verb is the contract with the daemon's
25attention pass. A status that cannot be read raises, so the rollup keeps
26the last count and records the error rather than reporting a calm box.
27"""
28
29import os
30
31import object_backup_schedule
32
33
34def _base_dir():
35 return os.environ.get("DBBASIC_DATA_DIR", "data")
36
37
38def COUNT(request):
39 payload = object_backup_schedule.status(_base_dir())
40 problems = payload.get("problems") or []
41 if not problems:
42 return {"count": 0}
43 detail = str(problems[0].get("message") or "")
44 if len(problems) > 1:
45 detail += f" (+{len(problems) - 1} more)"
46 return {"count": len(problems), "detail": detail}