httk.workflow.compat.v1¶
Compatibility support for reading instantiated httk v1 task trees.
Attributes¶
Classes¶
Describe one finished v1 task and its newest dated run directory. |
Functions¶
Return the packaged compatibility |
|
|
Map a legacy priority from 1 through 5 onto the v2 range. |
|
Read code name/version from lines 2 and 3 of a v1 program. |
|
Collect old finished trees through a package hook or direct extractor. |
|
Lazily yield finished v1 tasks in deterministic walk order. |
|
Return the result directory described by record.workdir. |
|
Return a plain or bzip2-compressed task member without opening it. |
Package Contents¶
- httk.workflow.compat.v1.bundled_v1_root()[source]¶
Return the packaged compatibility
HTTK_DIRroot.- Returns:
The packaged v1 runtime root.
- Return type:
- httk.workflow.compat.v1.legacy_priority(value)[source]¶
Map a legacy priority from 1 through 5 onto the v2 range.
- Parameters:
value (int) – Map this legacy priority.
- Returns:
The corresponding v2 priority.
- Raises:
ValueError – If the priority is outside the legacy range.
- Return type:
- class httk.workflow.compat.v1.V1FinishedTask[source]¶
Describe one finished v1 task and its newest dated run directory.
- directory: pathlib.Path¶
- rundir: pathlib.Path¶
- computation_date: datetime.datetime¶
- property identity_stable: bool¶
Whether this task’s identity is manifest-backed and relocation-stable.
A task without a readable
ht.manifestfalls back to a path-derived identity that changes when the tree moves, so its collected result cannot be de-duplicated across machines; this isFalsefor those tasks.
- httk.workflow.compat.v1.code_of(program_path)[source]¶
Read code name/version from lines 2 and 3 of a v1 program.
Both ht_steps and ht_run use this format. Missing, unreadable, or malformed metadata returns the legacy fallback (“unknown”, “0”).
- httk.workflow.compat.v1.collect_finished_tree(root, *, workflow_dir=None, extract=None, workflow_id='httk.v1.finished', stats=None)[source]¶
Collect old finished trees through a package hook or direct extractor.
Exactly one of workflow_dir and extract is required. Unlike live collection, a hook/extractor failure degrades only that task and the sweep continues: old trees are expected to contain uneven historical results.
- Parameters:
root (str | os.PathLike[str]) – Collect the finished tree rooted here.
workflow_dir (str | os.PathLike[str] | None) – Locate the directory workflow package, when used.
extract (collections.abc.Callable[[V1FinishedTask], collections.abc.Mapping[str, object]] | None) – Supply a direct per-task extractor, when used.
workflow_id (str) – Name the synthesized workflow, for the extractor path.
stats (dict[str, object] | None) – Receive the finished-tree counters from
finished_tasks().
- Yields:
One collected job per finished task, degraded ones included.
- Raises:
ValueError – If not exactly one of
workflow_dir/extractis given, or the package declares no collector.
- httk.workflow.compat.v1.finished_tasks(root, *, stats=None)[source]¶
Lazily yield finished v1 tasks in deterministic walk order.
Every ht.task.* directory is a walk boundary, so nested subtasks are not scanned. ht.run.current is intentionally ignored because only dated run names define a computation date.
When stats is supplied it is populated, once the walk is exhausted, with
unfinished_by_status(a status-keyedcollections.Counterof the tasks the regex matched that were not.finished) andskipped_no_rundir(the count of finished tasks dropped for lacking a dated run directory).