Skip to content

featherweight.results

results

The results that resuming a job reads back, behind an abstract class the user can implement.

featherweight keeps the state of the orchestration in the run log, and never the data that flowed through it. The one place where an output is kept is a ResultStore, because resuming a job needs the output of a step that already succeeded, and only for a job that opted in (resumable=True). The default is a sqlite store in the file of the run log, which is for local development; a deployment passes its own store, or none. See docs/specs/persistence.md.

ResultKey

Bases: BaseModel

What identifies one stored output: the job it was made in, the agent (the hash of its whole declaration) and the input (the hash of it). The same agent with the same input in another job is another key.

ResultStore

Bases: ABC

Where the outputs for resuming are kept. Subclass it and write the three methods; one that misses a method cannot be built.

An output is JSON: a dict. The contract (featherweight.testing.check_result_store runs it against any store): - get returns what put stored for the key, equal as JSON, or None when there is none; - put on a key that exists replaces it; - calls can be concurrent; - delete_job removes every result of a job, and does not fail when there are none.

put abstractmethod async

put(key: ResultKey, output: dict[str, Any]) -> None

Keep output under key, replacing what was there.

get abstractmethod async

get(key: ResultKey) -> dict[str, Any] | None

What was kept under key, or None.

delete_job abstractmethod async

delete_job(job_id: str) -> None

Forget every result of the job.

SqliteResultStore

SqliteResultStore(db: SqliteDatabase)

Bases: ResultStore

The default store: a results table in the file of the run log, through its connection. For local development.