Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

muelle.state

Source: src/muelle/state.py.

Files under stateDir: status, jobs, spool, logs and locks.

utc_now

def utc_now() -> str

write_atomic

def write_atomic(dest: Path, content: str, mode: int = 0o644) -> None
Replaces DEST so readers (nginx) never see a partial file.

write_json_atomic

def write_json_atomic(dest: Path, data: Any) -> None

StateDir

class StateDir

StateDir.status_path

def status_path(self, id: str) -> Path

StateDir.spool_path

def spool_path(self, id: str) -> Path

StateDir.log_path

def log_path(self, id: str) -> Path

StateDir.job_path

def job_path(self, id: str) -> Path

StateDir.write_job

def write_job(self, id: str, **fields: str) -> None
Records what job ID is about (site, action, env, branch, ...). Kept apart from
the status file, which /status/ serves publicly: branch names stay off it.

StateDir.read_job

def read_job(self, id: str) -> dict[str, Any]

StateDir.jobs

def jobs(self) -> list[dict[str, Any]]
Every job that has a status file, its job file merged in; newest update first.

StateDir.write_status

def write_status(self, id: str, state: State, message: str, url: str = "") -> None

StateDir.lock

def lock(self, name: str) -> Generator[None]
Holds an exclusive flock on locks/NAME.lock, blocking until it is free.