class openfe.Worker(warehouse: FileSystemWarehouse, task_db_path: Path)#

Execute protocol units from a task database.

Warning

Task-based execution is an experimental feature and subject to change in future releases of openfe

Parameters:
  • warehouse (FileSystemWarehouse) – FileSystemWarehouse used to load queued tasks and store execution results.

  • task_db_path (pathlib.Path, default=Path("./warehouse/tasks.db")) – Path to the Exorcist SQLite task database.

warehouse: FileSystemWarehouse#
task_db_path: Path#
execute_unit(scratch: Path | str) → tuple[str, ProtocolUnitResult] | None#

Execute one checked-out ProtocolUnit and persist its result.

Parameters:

scratch (pathlib.Path | str) – Scratch directory passed to the protocol execution context.

Returns:

The task ID and execution result for the processed task, or None if no task is currently available.

Return type:

tuple[str, ProtocolUnitResult] | None

Raises:

Exception – Re-raises any exception thrown during protocol unit execution after marking the task as failed.