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 byfetch, consumed bypsfgen.STATE(state): the built PSF/PDB[/XSC] fileset – produced bypsfgen,continuation,merge, and every transform; consumed by transforms andterminate.MOLECULE(base_molecule): the in-memoryMolecule(sequence, biological assembly, chains, loops) – produced only by thepsfgenfamily; consumed bycleave/ligate/pdb2pqr.continuation/mergegive files but not this object.MD_OUTPUT(md_output): molecular-dynamics timeseries – produced bymd, consumed bymdplot.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:
objectA 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
STATEalready 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
PestiferBuildErrorlisting every hard problem found; emits warnings for softer, occasionally-legitimate issues.tasksis any sequence of objects exposingindex,taskname,specs, andpipeline_contract(specs).