backend
Persistence backend protocol and auto-detection.
Classes¶
IncompleteJob
dataclass
¶
A job marked as incomplete/in-progress.
Attributes:
| Name | Type | Description |
|---|---|---|
start_time |
float | None
|
Approximate start time (mtime for FS, starttime for DB). |
output_file |
Path | None
|
Output file path if known. |
rule |
str | None
|
Rule name if known (DB backend provides this; FS does not). |
external_jobid |
str | None
|
External executor job ID if known. |
Source code in snakesee/persistence/backend.py
PersistenceBackend ¶
Bases: Protocol
Protocol for reading Snakemake workflow metadata.
Implementations provide access to job metadata, incomplete markers, and lock state from either the filesystem or SQLite backends.
Source code in snakesee/persistence/backend.py
Functions¶
has_incomplete_jobs ¶
has_locks ¶
iterate_incomplete_jobs ¶
iterate_incomplete_jobs(min_start_time: float | None = None) -> Iterator[IncompleteJob]
Iterate over incomplete (in-progress) job markers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
min_start_time
|
float | None
|
If set, only yield jobs started at or after this time. |
None
|
Yields:
| Type | Description |
|---|---|
IncompleteJob
|
IncompleteJob for each in-progress job. |
Source code in snakesee/persistence/backend.py
iterate_metadata ¶
iterate_metadata(progress_callback: ProgressCallback | None = None) -> Iterator[MetadataRecord]
Iterate over all job metadata records.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
progress_callback
|
ProgressCallback | None
|
Optional callback(current, total) for progress. |
None
|
Yields:
| Type | Description |
|---|---|
MetadataRecord
|
MetadataRecord for each completed job. |
Source code in snakesee/persistence/backend.py
Functions¶
detect_backend ¶
detect_backend(workflow_dir: Path) -> PersistenceBackend
Auto-detect and return the appropriate persistence backend.
Prefers the SQLite DB backend when .snakemake/metadata.db exists. Falls back to filesystem backend otherwise.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
workflow_dir
|
Path
|
Root workflow directory containing .snakemake/. |
required |
Returns:
| Type | Description |
|---|---|
PersistenceBackend
|
A PersistenceBackend implementation. |