gufe.protocols.protocoldag¶
Functions
|
Locally execute a full |
Classes
|
|
|
An executable directed acyclic graph (DAG) of |
|
Result for a single execution of an entire |
- class gufe.protocols.protocoldag.DAGMixin¶
- property name: str | None¶
Optional identifier.
- property graph: DiGraph¶
DAG of
ProtocolUnitnodes with edges denoting dependencies.
- property protocol_units: list[ProtocolUnit]¶
List of
ProtocolUnits given in DAG-dependency order.DAG-dependency order guarantees that any task is listed after all of its dependencies.
- property transformation_key: GufeKey | None¶
The
GufeKeyof theTransformationthis object performs.If None, then this object was not created from a Transformation. This may be the case when creating a ProtocolDAG from a Protocol directly, without use of a Transformation object.
This functions as a label, indicating where this object came from.
- property extends_key: GufeKey | None¶
The GufeKey of the ProtocolDAGResult this object extends.
If None, then this object does not extend from a result at all.
This functions as a label, indicating where this object came from. It can be used to reconstruct the set of extension relationships between a collection of ProtocolDAGs.
- class gufe.protocols.protocoldag.ProtocolDAGResult(*, protocol_units: list[ProtocolUnit], protocol_unit_results: list[ProtocolUnitResult], transformation_key: GufeKey | None, extends_key: GufeKey | None = None, name: str | None = None)¶
Result for a single execution of an entire
ProtocolDAG.There may be many of these for a given Transformation. Data elements from these objects are combined by Protocol.gather into a ProtocolResult.
- property result_graph: DiGraph¶
DAG of
ProtocolUnitResultnodes with edges denoting dependencies.Each edge is directed from a task towards its dependencies; for example, an edge between a production run and its equilibration would point towards the equilibration unit.
- property protocol_unit_results: list[ProtocolUnitResult]¶
ProtocolUnitResults for each ProtocolUnit used to compute this object.
Results are given in DAG-dependency order. In this order, tasks are always listed after their dependencies.
- property protocol_unit_failures: list[ProtocolUnitFailure]¶
A list of all failed
ProtocolUnits.Note
These are returned in DAG order, with tasks listed after their dependencies.
- property protocol_unit_successes: list[ProtocolUnitResult]¶
A list of only successful ProtocolUnit results.
Note
These are returned in DAG order, with tasks listed after their dependencies.
- unit_to_result(protocol_unit: ProtocolUnit) ProtocolUnitResult¶
Return the successful
ProtocolUnitResultfor a givenProtocolUnit, if it exists.- Returns:
success – the successful
ProtocolUnitResultfor thisProtocolUnit- Return type:
- Raises:
MissingUnitResultError: – if there are no results for that
ProtocolUnitProtocolUnitFailureError: – if there are only failures for that
ProtocolUnit
- unit_to_all_results(protocol_unit: ProtocolUnit) list[ProtocolUnitResult]¶
Return all
ProtocolUnitResults (success and failure) for a givenProtocolUnit.- Returns:
results –
ProtocolUnitResults for the givenProtocolUnit- Return type:
list[ProtocolUnitResult]
- Raises:
MissingUnitResultError – if no
ProtocolUnitResults present for the givenProtocolUnit
- result_to_unit(protocol_unit_result: ProtocolUnitResult) ProtocolUnit¶
Return the
ProtocolUnitcorresponding to the givenProtocolUnitResult.- Returns:
the
ProtocolUnitcorresponding to the givenProtocolUnitResult- Return type:
- Raises:
MissingUnitResultError – if the given
ProtocolUnitResultisn’t present
- ok() bool¶
Check if this
ProtocolDAGResultsucceeded or failed.Returns
Trueif there is at least one successfulProtocolUnitResultfor eachProtocolUnit, andFalseotherwise.
- property terminal_protocol_unit_results: list[ProtocolUnitResult]¶
Get
ProtocolUnitResults that terminate the DAG.- Returns:
All
ProtocolUnitResults which do not have aProtocolUnitResultthat follows on (depends) on them.- Return type:
list[ProtocolUnitResult]
- property extends_key: GufeKey | None¶
The GufeKey of the ProtocolDAGResult this object extends.
If None, then this object does not extend from a result at all.
This functions as a label, indicating where this object came from. It can be used to reconstruct the set of extension relationships between a collection of ProtocolDAGs.
- property graph: DiGraph¶
DAG of
ProtocolUnitnodes with edges denoting dependencies.
- property name: str | None¶
Optional identifier.
- property protocol_units: list[ProtocolUnit]¶
List of
ProtocolUnits given in DAG-dependency order.DAG-dependency order guarantees that any task is listed after all of its dependencies.
- property transformation_key: GufeKey | None¶
The
GufeKeyof theTransformationthis object performs.If None, then this object was not created from a Transformation. This may be the case when creating a ProtocolDAG from a Protocol directly, without use of a Transformation object.
This functions as a label, indicating where this object came from.
- class gufe.protocols.protocoldag.ProtocolDAG(*, protocol_units: list[ProtocolUnit], transformation_key: GufeKey | None, extends_key: GufeKey | None = None, name: str | None = None)¶
An executable directed acyclic graph (DAG) of
ProtocolUnitobjects.A
ProtocolDAGis composed ofProtocolUnitobjects as well as how they depend on each other. A singleProtocolDAGexecution should yield sufficient information to calculate a free energy difference (though perhaps not converged) between two ChemicalSystem objects.A
ProtocolDAGyields aProtocolDAGResultwhen executed.Properties¶
- namestr
Optional identifier for this
ProtocolDAGResult.- protocol_unitslist[ProtocolUnit]
ProtocolUnits (given in DAG-dependency order) used to compute thisProtocolDAGResult. Tasks are always listed after their dependencies.- graphnx.DiGraph
Graph of
ProtocolUnits as nodes, with directed edges to eachProtocolUnit’s dependencies.
Create a new ProtocolDAG`
- param protocol_units:
The ProtocolUnit s that make up this ProtocolDAG, with dependencies included as inputs.
- type protocol_units:
Iterable[ProtocolUnit]
- param transformation_key:
Key of the Transformation that this ProtocolDAG corresponds to, if applicable. This functions as a label for identifying the source of this ProtocolDAG. This label will be passed on to the ProtocolDAGResult resulting from execution of this ProtocolDAG.
- type transformation_key:
Optional[GufeKey]
- param extends_key:
Key of the ProtocolDAGResult that this ProtocolDAG extends from. This functions as a label for identifying the source of this ProtocolDAG. This label will be passed on to the ProtocolDAGResult resulting from execution of this ProtocolDAG.
- type extends_key:
Optional[GufeKey]
- param name:
Unique identifier for this ProtocolDAG.
- type name:
str
- property extends_key: GufeKey | None¶
The GufeKey of the ProtocolDAGResult this object extends.
If None, then this object does not extend from a result at all.
This functions as a label, indicating where this object came from. It can be used to reconstruct the set of extension relationships between a collection of ProtocolDAGs.
- property graph: DiGraph¶
DAG of
ProtocolUnitnodes with edges denoting dependencies.
- property name: str | None¶
Optional identifier.
- property protocol_units: list[ProtocolUnit]¶
List of
ProtocolUnits given in DAG-dependency order.DAG-dependency order guarantees that any task is listed after all of its dependencies.
- property transformation_key: GufeKey | None¶
The
GufeKeyof theTransformationthis object performs.If None, then this object was not created from a Transformation. This may be the case when creating a ProtocolDAG from a Protocol directly, without use of a Transformation object.
This functions as a label, indicating where this object came from.
- gufe.protocols.protocoldag.execute_DAG(protocoldag: ProtocolDAG, *, shared_basedir: Path, scratch_basedir: Path, cache_basedir: Path | None = None, stderr_basedir: Path | None = None, stdout_basedir: Path | None = None, keep_shared: bool = False, keep_scratch: bool = False, keep_cache: bool = False, raise_error: bool = True, n_retries: int = 0) ProtocolDAGResult¶
Locally execute a full
ProtocolDAGin serial and in-process.- Parameters:
protocoldag (ProtocolDAG) – The :class:
ProtocolDAGto execute.shared_basedir (Path) – Filesystem path to use for shared space that persists across whole DAG execution. Used by a ProtocolUnit to pass file contents to dependent class:
ProtocolUnitinstances.scratch_basedir (Path) – Filesystem path to use for ProtocolUnit scratch space.
cache_basedir (Path | None = None) – Filesystem path to use for ProtocolUnitResult caching during execution. If
None(default), results will not be cached and it will not be able to resume DAG execution from the last successfully finished ProtocolUnit.stderr_basedir (Path | None) – Filesystem path to use for ProtocolUnit stderr archiving.
stdout_basedir (Path | None) – Filesystem path to use for ProtocolUnit stdout archiving.
keep_shared (bool) – If True, don’t remove shared directories for ProtocolUnit`s after the `ProtocolDAG is executed.
keep_scratch (bool) – If True, don’t remove scratch directories for a ProtocolUnit after it is executed.
keep_cache (bool) – If True, don’t remove the cache directory which contains the serialized ProtocolUnitResult for all executed ProtocolUnit/s.
raise_error (bool) – If True, raise an exception if a ProtocolUnit fails, default True if False, any exceptions will be stored as ProtocolUnitFailure objects inside the returned ProtocolDAGResult
n_retries (int) – the number of times to attempt, default 0, i.e. try once and only once
- Returns:
The result of executing the ProtocolDAG.
- Return type:
- Raises:
ProtocolDAGExecutionError – If the ProtocolDAG cannot be executed due to an invalid cache state.