muelle.worker
Source: src/muelle/worker.py.
Deploy worker.
Forked by muelle-receive (receive.detach_worker). Reads the already-validated payload from the
spool dir, deploys or tears down, and keeps the status file updated.
DeployError
class DeployError(Exception)
Terminated
class Terminated(BaseException)
Raised on SIGTERM (e.g. service restart) so the failure gets recorded.
Job
class Job
Job.from_payload
def from_payload(cls, id: str, payload: dict[str, Any]) -> Job
log
def log(message: str) -> None
subdirs
def subdirs(directory: Path) -> list[Path]
prune
def prune(dirs: list[Path], keep: int, key: Callable[[Path], float], protect: str = "") -> None
Removes DIRS beyond the newest KEEP (ranked by KEY), never PROTECT.
mtime
def mtime(path: Path) -> float
preview_slots
def preview_slots(site_dir: Path) -> list[Path]
deploy
def deploy(config: Config, job: Job, state: StateDir, fetch: Downloader = download) -> str
Installs the artifact as the slot's current release; returns the slot URL.
current_release
def current_release(slot_dir: Path) -> str
Name of the release `current` points to, "" if none.
teardown
def teardown(config: Config, site: str, branch: str) -> int
Removes every preview of BRANCH; returns how many.
refresh_index
def refresh_index(config: Config) -> None
Best effort: a listing that fails to render must not fail the job.
process
def process(config: Config, job: Job, fetch: Downloader = download) -> None
run
def run(config: Config, id: str, fetch: Downloader = download) -> int
Entry point of the detached worker process: a kill is recorded as a failure.
process_spooled
def process_spooled(config: Config, id: str, fetch: Downloader = download) -> int
Processes spooled job ID, recording any failure in its status file.