Skip to content

Commit

Permalink
various other pr fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
stevebachmeier committed Jan 7, 2025
1 parent eda4002 commit c9d01e0
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 23 deletions.
15 changes: 10 additions & 5 deletions src/easylink/graph_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -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<easylink.implementation.Implementation>` to run.
The highest level ImplementationGraph is the that of the entire
:class:`~easylink.pipeline_graph.PipelineGraph`.
See Also
--------
Expand Down
28 changes: 14 additions & 14 deletions src/easylink/implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down Expand Up @@ -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
----------
Expand All @@ -143,15 +152,6 @@ class NullImplementation:
The :class:`InputSlots<easylink.graph_components.InputSlot>` for this NullImplementation.
output_slots
The :class:`OutputSlots<easylink.graph_components.OutputSlot>` 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__(
Expand Down
4 changes: 0 additions & 4 deletions src/easylink/utilities/general_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c9d01e0

Please sign in to comment.