httk.workflow.transfers¶
Crash-recoverable detached job transfer.
Attributes¶
Functions¶
|
Fence and seal one job, leaving no schedulable source marker. |
|
Validate a sealed bundle and return its manifest. |
|
Idempotently import a sealed bundle and publish its prior state. |
|
Validate an acknowledgement and retire the sealed source bundle. |
|
Finish source sealing and inventory every retained bundle. |
|
Seal every finished job of workspace into a bundle for one destination. |
|
Retire the sealed source bundle of every named job. |
|
Drop a staged incoming bundle whose payload the workspace now owns. |
Module Contents¶
- httk.workflow.transfers.detach_job(workspace: httk.workflow.workspace.Workspace, job_id: str, *, destination_workspace_id: str, destination_placement: str | pathlib.PurePosixPath | None = None, transfer_id: str | None = None) pathlib.Path[source]¶
Fence and seal one job, leaving no schedulable source marker.
- httk.workflow.transfers.validate_bundle(bundle: str | os.PathLike[str]) dict[str, Any][source]¶
Validate a sealed bundle and return its manifest.
- httk.workflow.transfers.import_bundle(workspace: httk.workflow.workspace.Workspace, bundle: str | os.PathLike[str]) dict[str, object][source]¶
Idempotently import a sealed bundle and publish its prior state.
- httk.workflow.transfers.acknowledge_transfer(workspace: httk.workflow.workspace.Workspace, acknowledgement: collections.abc.Mapping[str, object]) pathlib.Path[source]¶
Validate an acknowledgement and retire the sealed source bundle.
An acknowledgement that carries an identity signature must carry a valid one: retiring a source is irreversible enough that a damaged or forged attribution is refused rather than recorded. An acknowledgement with no signature is accepted exactly as before, so a destination without an identity key keeps working.
- httk.workflow.transfers.recover_transfers(workspace: httk.workflow.workspace.Workspace) list[dict[str, object]][source]¶
Finish source sealing and inventory every retained bundle.
- httk.workflow.transfers.offer_transfers(workspace: httk.workflow.workspace.Workspace, *, destination_workspace_id: str, states: collections.abc.Iterable[str] = DEFAULT_OFFER_STATES, placement: str | pathlib.PurePosixPath | None = None) list[dict[str, object]][source]¶
Seal every finished job of workspace into a bundle for one destination.
This is the far side of a results fetch: the remote that ran the work offers what stopped there, and the workspace that asked pulls each bundle and imports it. Offering is idempotent because a sealed bundle is reported from its ledger rather than sealed again, so the jobs a first call detached — which no longer have a schedulable marker — are exactly the jobs a second call re-offers, and an interrupted fetch resumes by simply asking again.
A job that cannot leave right now is skipped rather than fatal: one still referenced by an unresolved join keeps the campaign it belongs to consistent, and reporting the rest lets the fetch make progress.
- httk.workflow.transfers.retire_transfers(workspace: httk.workflow.workspace.Workspace, job_ids: collections.abc.Sequence[str], *, destination_workspace_id: str | None = None) list[dict[str, object]][source]¶
Retire the sealed source bundle of every named job.
A fetch retires at the source only once the destination holds an acknowledgement, so the identity of the job is all this side needs; naming the destination as well refuses to retire a bundle that was sealed for somebody else. Retirement moves the bundle rather than deleting it, and a bundle already retired is reported as such, so calling this twice is the same as calling it once.
- httk.workflow.transfers.discard_staged_bundle(workspace: httk.workflow.workspace.Workspace, staging: pathlib.Path) None[source]¶
Drop a staged incoming bundle whose payload the workspace now owns.
The staging tree is renamed out of the incoming directory before it is removed, so an interrupted removal can never leave a partial bundle where a resumed fetch would find one and mistake it for the real thing.