Expand description
The watcher hosts: a worker’s wait steps, as coroutines in one long-lived process per code set (decision 320; see archive/PROJECT.md, Sensors and triggers).
A host is started for the first wait step of an interpreter and set of root copies, and stopped when its last one ends, so new code gets a new host while the old one finishes. All a host’s watchers share its socket: one task reads it and passes each message to its attempt, one writes, so no attempt being dropped can leave half a message in it.
Structs§
- Event
Sink - Takes what a trigger says.
- Found
Event - What a trigger found, on its way to the master.
- Watcher
Hosts - The hosts of a worker, by code set (cheap to clone; clones share them).
Constants§
- ROUTE_
MESSAGES - The messages of a watcher waiting for its attempt: past them its host’s socket waits too, so a
wait step printing faster than its log is written slows down, and the agent’s memory holds at
most this many (each up to
_LOG_CHUNK, 4 MiB, for text).
Functions§
- run_
watcher - Runs a wait step in its code set’s host:
spawnedgets the host’s process ID. Cancelling, a timeout and a drain cancel its coroutine; one that doesn’t end in its grace time has its whole host killed, as Python can’t cancel what doesn’t yield.