spdl.autoresearch.core.load_or_init

load_or_init(workdir: Path, initial_factory: Callable[[], list[TaskSpec]]) list[TaskSpec][source]

Resume from checkpoint, or seed initial specs on a fresh run.

A drop-in body for a workflow’s load() method:

def load(self) -> list[TaskSpec]:
    return load_or_init(self.workdir, self._initial_specs)
Parameters:
  • workdir – Directory previously passed to write_engine_state().

  • initial_factory – Zero-argument callable that builds the starting specs for a fresh run. Only invoked when no engine-state file is present.

Returns:

Queued specs concatenated with running specs (the running specs re-enter the queue on resume so the orchestrator can re-launch them), or whatever initial_factory() returns.