haddock.gear.workflow_ordering module

Validate the ordering of modules in a HADDOCK3 workflow.

Module- and parameter-level validation (see haddock.gear.prepare_run) confirms that each requested module exists and that its parameters are valid, but it does not enforce constraints on the sequence of modules. Some modules only make sense when another module ran before them (e.g. clustrmsd needs an RMSD matrix), some must not be chained to themselves (e.g. two consecutive seletop), and a workflow must always start by building topologies.

Those constraints are declared as data in workflow_rules.yaml and applied here against the ordered list of modules taken from the user configuration file. Keeping the rules in a data file means new constraints can be added without editing this logic.

Rule types (see workflow_rules.yaml for the exact syntax):

  • disallowed_sequences: module B must not directly follow module A.

  • required_preceding: module B must be immediately preceded by one of a set.

  • required_prior: module B must be preceded anywhere earlier by one of a set.

  • required_first: the first module must be one of a set.

haddock.gear.workflow_ordering.read_workflow_rules(rules_file=PosixPath('/opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/haddock/gear/workflow_rules.yaml'))[source]

Read the workflow ordering rules from a YAML file.

Parameters:

rules_file (str or pathlib.Path) – Path to the YAML file defining the ordering rules. Defaults to the bundled workflow_rules.yaml.

Returns:

dict – The parsed rules, with every supported rule key present (empty containers for the ones not defined in the file).

haddock.gear.workflow_ordering.validate_workflow_order(modules, rules_file=PosixPath('/opt/hostedtoolcache/Python/3.10.20/x64/lib/python3.10/site-packages/haddock/gear/workflow_rules.yaml'))[source]

Validate the order of the modules of a workflow against the rules.

Parameters:
  • modules (sequence of str) – The module names in workflow order (without their .N suffix).

  • rules_file (str or pathlib.Path) – Path to the YAML file defining the ordering rules. Defaults to the bundled workflow_rules.yaml.

Raises:

haddock.core.exceptions.ConfigurationError – If the workflow violates one or more ordering rules. All detected violations are reported together.