httk.workflow.executors

Define runner-executor contracts used by the workflow manager.

Classes

AttemptLaunch

Paths and context needed to construct an attempt command.

OutcomeCommit

Describe a published outcome being committed by the authoritative manager.

RunnerExecutor

Execution behavior selected by runner.executor in job.json.

PathRunnerExecutor

Execute the runner path directly from the payload or staged copy.

Module Contents

class httk.workflow.executors.AttemptLaunch[source]

Paths and context needed to construct an attempt command.

runner is the executable the manager resolved for this attempt. A payload runner is the file inside payload; a shared runner is the verified copy the manager staged below control, never the original.

Parameters:
  • job – Immutable job definition being attempted.

  • marker – Authoritative marker for the attempt.

  • payload – Immutable job payload directory.

  • workdir – Directory in which the runner executes.

  • control – Attempt-control directory.

  • context_path – Path of the serialized runner context.

  • context – Runner context members.

  • runner – Resolved executable, or no value to use the payload runner.

  • workflow_prelude – Shell text run in a login shell before the runner, or empty for none.

job: httk.workflow.models.JobDefinition[source]
marker: httk.workflow.models.Marker[source]
payload: pathlib.Path[source]
workdir: pathlib.Path[source]
control: pathlib.Path[source]
context_path: pathlib.Path[source]
context: collections.abc.Mapping[str, Any][source]
runner: pathlib.Path | None = None[source]
workflow_prelude: str = ''[source]
property runner_command: pathlib.Path[source]

Return the executable to run, defaulting to the payload runner.

class httk.workflow.executors.OutcomeCommit[source]

Describe a published outcome being committed by the authoritative manager.

Parameters:
  • job – Immutable job definition producing the outcome.

  • marker – Authoritative marker being committed.

  • payload – Immutable job payload directory.

  • outcome_path – Path of the published outcome.

  • outcome – Outcome members.

job: httk.workflow.models.JobDefinition[source]
marker: httk.workflow.models.Marker[source]
payload: pathlib.Path[source]
outcome_path: pathlib.Path[source]
outcome: collections.abc.Mapping[str, Any][source]
class httk.workflow.executors.RunnerExecutor[source]

Bases: Protocol

Execution behavior selected by runner.executor in job.json.

name: str[source]
validate(job, payload)[source]

Validate executor-specific immutable payload requirements.

abstractmethod command(launch)[source]

Return the command argument vector for one attempt.

commit_outcome(commit)[source]

Complete executor-specific idempotent work before the marker advances.

reconcile(workspace)[source]

Repair executor-specific derived views; never alter authoritative state.

marker_changed(workspace, marker)[source]

Refresh derived views after an authoritative marker transition.

class httk.workflow.executors.PathRunnerExecutor[source]

Execute the runner path directly from the payload or staged copy.

name = 'path'[source]
validate(job, payload)[source]

Validate the payload runner when the job runs one.

Parameters:
  • job (httk.workflow.models.JobDefinition) – Job definition whose runner is checked.

  • payload (pathlib.Path) – Immutable job payload directory.

Returns:

None.

Raises:

httk.workflow.errors.FormatError – If a payload runner is missing or not a file.

Return type:

None

command(launch)[source]

Build the command for one path-runner attempt.

When the launch carries a workflow prelude, the runner is wrapped in a login shell that runs the prelude (under set -e) then execs the runner, so a failing prelude line aborts before the runner starts and the runner inherits the initialized environment.

Parameters:

launch (AttemptLaunch) – Attempt paths and runner context.

Returns:

Argument vector for the runner process.

Return type:

collections.abc.Sequence[str]

commit_outcome(commit)[source]

Complete path-executor outcome work before the marker advances.

Parameters:

commit (OutcomeCommit) – Published outcome and its job context.

Returns:

None.

Return type:

None

reconcile(workspace)[source]

Reconcile path-executor derived state.

Parameters:

workspace (httk.workflow.workspace.Workspace) – Workspace whose derived state is reconciled.

Returns:

None.

Return type:

None

marker_changed(workspace, marker)[source]

Refresh path-executor state after a marker transition.

Parameters:
  • workspace (httk.workflow.workspace.Workspace) – Workspace containing the changed marker.

  • marker (httk.workflow.models.Marker) – Newly authoritative marker.

Returns:

None.

Return type:

None