httk.workflow.compat.v1

Compatibility support for reading instantiated httk v1 task trees.

Attributes

Classes

V1FinishedTask

Describe one finished v1 task and its newest dated run directory.

Functions

bundled_v1_root()

Return the packaged compatibility HTTK_DIR root.

legacy_priority(value)

Map a legacy priority from 1 through 5 onto the v2 range.

code_of(program_path)

Read code name/version from lines 2 and 3 of a v1 program.

collect_finished_tree(root, *[, workflow_dir, ...])

Collect old finished trees through a package hook or direct extractor.

finished_tasks(root, *[, stats])

Lazily yield finished v1 tasks in deterministic walk order.

run_directory(record)

Return the result directory described by record.workdir.

task_file(directory, name)

Return a plain or bzip2-compressed task member without opening it.

Package Contents

httk.workflow.compat.v1.V1_PRIORITY_MAP[source]
httk.workflow.compat.v1.bundled_v1_root()[source]

Return the packaged compatibility HTTK_DIR root.

Returns:

The packaged v1 runtime root.

Return type:

pathlib.Path

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:

int

class httk.workflow.compat.v1.V1FinishedTask[source]

Describe one finished v1 task and its newest dated run directory.

directory: pathlib.Path
rundir: pathlib.Path
taskset: str
task_id: str
computation_date: datetime.datetime
code_name: str
code_version: str
description: str | None
manifest_hash: str | None
property immutable_id: str

Return the stable manifest id or a weaker path-derived identity.

property identity_stable: bool

Whether this task’s identity is manifest-backed and relocation-stable.

A task without a readable ht.manifest falls back to a path-derived identity that changes when the tree moves, so its collected result cannot be de-duplicated across machines; this is False for 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:
Yields:

One collected job per finished task, degraded ones included.

Raises:

ValueError – If not exactly one of workflow_dir/extract is 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-keyed collections.Counter of the tasks the regex matched that were not .finished) and skipped_no_rundir (the count of finished tasks dropped for lacking a dated run directory).

Parameters:
  • root (str | os.PathLike[str]) – Walk this finished result tree.

  • stats (dict[str, object] | None) – Receive the finished-tree counters, or leave unpopulated.

Yields:

One finished, run-bearing task per readable directory.

httk.workflow.compat.v1.run_directory(record)[source]

Return the result directory described by record.workdir.

Postprocess hooks must read result files from this path. Live v1 jobs use ht.run.current; synthesized old-tree records use their dated run dir.

httk.workflow.compat.v1.task_file(directory, name)[source]

Return a plain or bzip2-compressed task member without opening it.