Skip to main content

Module standalone

Module standalone 

Source
Expand description

schedr standalone: every role in one process, on localhost, with SQLite by default (see archive/PROJECT.md, Master–worker protocol: standalone uses the same gRPC protocol).

The master’s gRPC service, the REST API, the master’s loop and one worker agent with its log endpoint run side by side; the agent talks to the master over gRPC on localhost like any worker, and the API reads logs from the endpoint (no TLS: neither listens beyond localhost, whatever [tls] says). --migrate migrates the database at start (a laptop); without it, a schema that isn’t up to date is refused (production migrates as a step of its own, schedr db migrate). When the master fails (another took the lease over), the whole process ends, its tasks interrupted: restarted, it waits as a standby.

In one pod (for testing on a cluster, see archive/PROJECT.md): --listen 0.0.0.0 opens the REST API to a Service, SIGTERM stops it cleanly, and a lock in the data directory refuses a second standalone on the same data (two pods on one volume would schedule every run twice).

Structs§

Listening
The addresses standalone listens on, once it does.
Standalone
Everything schedr standalone runs, read from the configuration.

Constants§

LOCK_FILE
The name of the lock file in the data directory.

Functions§

banner
The line standalone prints once it listens.
command
Runs schedr standalone until Ctrl-C or SIGTERM, the REST API on listen (127.0.0.1 when not given); the banner goes to the log once it listens.
ended_within
Runs work to its end, or until bound after failed turned true: whether it ended. failed closing without turning true bounds nothing.
lock_data_dir
Takes the data directory’s lock for as long as the returned file is open: one standalone per data directory (and its SQLite database).
plan
Reads the standalone setup from the configuration and the environment (env gives the data directory’s default, the host name and what tasks may inherit).
run
Runs standalone until asked to stop (shutdown counts the requests): its worker drains first (a second request interrupts its tasks at once), then the master and the API stop, so interrupted tasks are recorded; listening gets the addresses once bound. A failing master ends it too, its worker’s tasks interrupted at once (nothing can record them).
sqlite_file
Standalone’s SQLite file in the data directory, without [database] url.