pestifer.tasks.pipeline_contract module

Static, pre-execution validation of a task pipeline.

Each task declares a TaskContract – what pipeline “currencies” it requires on entry and what it provides on exit – via BaseTask.pipeline_contract(). validate_pipeline() walks a task list once, before any work is done, and reports malformed hand-offs (a task consuming a currency no earlier task produced, an origin task that would silently discard an already-built system, or anything scheduled after the terminal task) with an explanation the user can act on.

The currencies are the things that actually flow between tasks:

  • SOURCE (base_coordinates): raw fetched coordinates – produced by fetch, consumed by psfgen.

  • STATE (state): the built PSF/PDB[/XSC] fileset – produced by psfgen, continuation, merge, and every transform; consumed by transforms and terminate.

  • MOLECULE (base_molecule): the in-memory Molecule (sequence, biological assembly, chains, loops) – produced only by the psfgen family; consumed by cleave/ligate/pdb2pqr. continuation/merge give files but not this object.

  • MD_OUTPUT (md_output): molecular-dynamics timeseries – produced by md, consumed by mdplot.

  • SOLVATED (solvated): the system carries bulk solvent – a soft flag used only to warn about re-solvation.

class pestifer.tasks.pipeline_contract.TaskContract(requires=('state',), provides=('state',), discards_state=False, terminal=False, warn_if_present=(), standalone=False)[source]

Bases: object

A task’s pipeline input/output contract.

Parameters:
  • requires (iterable of str) – Currencies that must already be available when the task runs (hard).

  • provides (iterable of str) – Currencies available after the task runs.

  • discards_state (bool) – True if the task builds a fresh system from scratch; running it when a STATE already exists silently discards that prior system.

  • terminal (bool) – True if the task closes the build (terminate); nothing may follow it.

  • warn_if_present (iterable of str) – Currencies whose prior presence is suspicious (a warning, not an error).

  • standalone (bool) – True if the task is a self-contained utility that operates on explicit inputs and does not participate in the build data-flow (e.g. desolvate); it is an error to place it inside a build pipeline.

pestifer.tasks.pipeline_contract.validate_pipeline(tasks)[source]

Statically check a task list for malformed hand-offs before execution.

Raises PestiferBuildError listing every hard problem found; emits warnings for softer, occasionally-legitimate issues. tasks is any sequence of objects exposing index, taskname, specs, and pipeline_contract(specs).