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

0 downloads

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.

danq9 signup: the person chooses the password and name on the confirm page 83c7aa6 2 weeks, 5 days ago History
scheduler.py · 1.7 KB · 39 lines
1"""scheduler -- the daemon's task board.
2
3object_daemon.process_scheduler reads `task_*` keys out of THIS object's
4state on every poll. Each value is JSON:
5
6 {"id", "object_id", "method", "payload",
7 "schedule", "type": "cron"|"onetime", "status": "active"|"paused"}
8
9The daemon stamps next_run/last_run/run_count back onto the same key, and
10records every execution as a scheduler_runs row (system-dashboard) so a
11run's outcome is queryable rather than buried in a log.
12
13The object is deliberately inert: scheduling is DATA in its state, and the
14contract lives in object_daemon.process_scheduler, not here. It ships in a
15package rather than being hand-placed on a server because a trigger object
16that exists only on one box is a scheduler that dies silently the next
17time that box is rebuilt.
18
19The same argument applies to the tasks themselves, so DO NOT hand-write
20rows here. A package declares its recurring passes in its manifest's
21`schedules` section and the installer writes them onto this board (see
22docs/package-authoring.md); a schedule and the object it calls then travel
23together, survive a rebuild, and are reviewable as code. An install
24preserves run history and never un-pauses a task an operator stopped, so
25declaring one is safe to repeat. Hand-entered tasks still work -- and are
26adopted rather than duplicated when a package later declares the same id --
27but they are exactly the invisible state this whole board was meant to
28stop being.
29"""
30
31
32def GET(request):
33 return {"ok": True,
34 "note": "task_* entries in this object's state drive "
35 "object_daemon.process_scheduler; see /scheduler for the board"}
36
37
38def POST(request):
39 return {"ok": True}