From c9d01e0af5e31fd646817a54b2fa726e6f508d7c Mon Sep 17 00:00:00 2001 From: Steve Bachmeier Date: Tue, 7 Jan 2025 08:47:56 -0800 Subject: [PATCH] various other pr fixes --- src/easylink/graph_components.py | 15 ++++++++----- src/easylink/implementation.py | 28 ++++++++++++------------- src/easylink/utilities/general_utils.py | 4 ---- 3 files changed, 24 insertions(+), 23 deletions(-) diff --git a/src/easylink/graph_components.py b/src/easylink/graph_components.py index b933f74e..a525e8d1 100644 --- a/src/easylink/graph_components.py +++ b/src/easylink/graph_components.py @@ -179,11 +179,16 @@ class ImplementationGraph(nx.MultiDiGraph): Notes ----- - Unlike a :class:`StepGraph`, an ImplementationGraph is a low-level abstraction; - it represents the actual implementations of each :class:`~easylink.step.Step` - in the pipeline. - - The highest level ImplementationGraph is the that of the entire :class:`~easylink.pipeline_graph.PipelineGraph`. + An ImplementationGraph is a low-level abstraction; it represents the _actual + implementations_ of each :class:`~easylink.step.Step` in the pipeline. This + is in contrast to a :class:`StepGraph`, which can be an intricate nested structure + due to the various complex and self-similar :class:`~easylink.step.Step` instances + (which represent abstract operations such as "loop this step N times"). An + ImplementationGraph the flattened and concrete graph of + :class:`Implementations` to run. + + The highest level ImplementationGraph is the that of the entire + :class:`~easylink.pipeline_graph.PipelineGraph`. See Also -------- diff --git a/src/easylink/implementation.py b/src/easylink/implementation.py index 276cbee9..ece45fed 100644 --- a/src/easylink/implementation.py +++ b/src/easylink/implementation.py @@ -75,14 +75,16 @@ def validate(self) -> list[str]: Returns ------- - A list of logs containing any validation errors. + A list of logs containing any validation errors. Each item in the list + is a distinct message about a particular validation error (e.g. if a + required container does not exist). Notes ----- This is intended to be run from :meth:`easylink.pipeline.Pipeline._validate`. """ logs = [] - logs = self._validate_expected_step(logs) + logs = self._validate_expected_steps(logs) logs = self._validate_container_exists(logs) return logs @@ -95,11 +97,12 @@ def _load_metadata(self) -> dict[str, str]: metadata = load_yaml(paths.IMPLEMENTATION_METADATA) return metadata[self.name] - def _validate_expected_step(self, logs: list[str]) -> list[str]: + def _validate_expected_steps(self, logs: list[str]) -> list[str]: """Validates that the Implementation is responsible for the correct steps.""" if not set(self.schema_steps) == set(self.metadata_steps): logs.append( - f"Pipeline configuration nodes {self.schema_steps} do not match metadata steps {self.metadata_steps}." + f"Pipeline configuration nodes {self.schema_steps} do not match " + f"metadata steps {self.metadata_steps}." ) return logs @@ -133,7 +136,13 @@ def outputs(self) -> dict[str, list[str]]: class NullImplementation: - """A representation of a :class:`~easylink.step.Step` that does not have an :class:`Implementation`. + """An object with a partial :class:`Implementation` interface that represents that no container needs to run. + + The primary use case for this class is when adding an :class:`~easylink.step.IOStep` - + which does not have a corresponding :class:`Implementation` - to an + :class:`~easylink.graph_components.ImplementationGraph` since adding any new + node requires an object with :class:`~easylink.graph_components.InputSlot` + and :class:`~easylink.graph_components.OutputSlot` names. Parameters ---------- @@ -143,15 +152,6 @@ class NullImplementation: The :class:`InputSlots` for this NullImplementation. output_slots The :class:`OutputSlots` for this NullImplementation. - - Notes - ----- - The primary use case for this class is when adding an :class:`~easylink.step.IOStep` - - which does not have a corresponding :class:`Implementation` - to an - :class:`~easylink.graph_components.ImplementationGraph`. Adding a new node - requires an ``implementation`` attribute with :class:`~easylink.graph_components.InputSlot` - and :class:`~easylink.graph_components.OutputSlot` names. - """ def __init__( diff --git a/src/easylink/utilities/general_utils.py b/src/easylink/utilities/general_utils.py index a5806b57..f5c033f2 100644 --- a/src/easylink/utilities/general_utils.py +++ b/src/easylink/utilities/general_utils.py @@ -93,10 +93,6 @@ def exit_with_validation_error(error_msg: dict) -> None: YAML format and terminates the program execution with a non-zero exit code (indicating an error). - This function logs the provided validation error messages using a structured - YAML format and terminates the program execution with a non-zero exit code - (indicating an error). - Parameters ---------- error_msg