hyped.core.nodes.debug module

Module defining the base classes for debug nodes in a data flow graph.

This module introduces the BaseDebugNodeConfig for configuring debug nodes and the abstract BaseDebugNode class, which serves as the foundation for creating custom debug processors. Debug nodes are specialized components used for inspecting and monitoring data as it flows through the graph, without altering the data itself or producing outputs for further processing.

class hyped.core.nodes.debug.BaseDebugNode(*args: Any, **kwargs: Any)[source]

Bases: BaseDataProcessor[D], ABC

Base class for debug nodes in a data flow graph.

This abstract class defines the structure for debug nodes. Debug nodes are specialized data processors that are primarily used for introspection and monitoring of data flow. Unlike standard data processors, they do not produce output features that are integrated back into the main data flow.

Subclasses must implement the process() method to define their specific debugging actions, such as logging or data inspection.

call(*args: AbstractDataFlow | Feature | Any | list[Any] | Scalar | Array, **kwargs: AbstractDataFlow | Feature | Any | list[Any] | Scalar | Array) Feature | Any | list[Any] | Scalar | Array[source]

Call the debug node, adding it to the underlying data flow.

This method adds the debug node to the data flow graph. It validates the node’s signature against the provided arguments, ensuring the correct input features are connected.

Parameters:
  • *args (AbstractDataFlow | Feature) – Positional input arguments, which can be existing data flow nodes or features.

  • **kwargs (AbstractDataFlow | Feature) – Keyword input arguments, which can be existing data flow nodes or features.

Returns:

A placeholder feature representing the debug operation in the graph. This feature is typically not used for further computation.

Return type:

_Feature

Raises:

RuntimeError – If the data flow graph cannot be inferred from the arguments.

abstractmethod process(ctx: RunContext, *args: Feature | Any | list[Any] | Scalar | Array, **kwargs: Feature | Any | list[Any] | Scalar | Array) None[source]

Process function for debugging.

This abstract method defines the processing logic for the debug node. Subclasses must implement this method to perform specific debugging actions on the input features. This method can be either synchronous or asynchronous. Importantly, debug nodes do not return any features that are integrated into the data flow.

Parameters:
  • ctx (RunContext) – The context for the current process call.

  • *args (Feature) – Positional input features to be inspected.

  • **kwargs (Feature) – Keyword input features to be inspected.

async run(ctx: RunContext, arrays: dict[str, Array]) None[source]

Execute the main processing logic for the debug node.

This method executes the debugging actions defined in the process() method. It receives the input data as a dictionary of PyArrow arrays. Since debug nodes do not produce output features for the data flow, this method returns None.

Parameters:
  • ctx (RunContext) – The execution context for the current run.

  • arrays (dict[str, pa.Array]) – A dictionary mapping input names to PyArrow arrays, representing the data to be inspected or used for debugging purposes.

class hyped.core.nodes.debug.BaseDebugNodeConfig[source]

Bases: BaseDataProcessorConfig

Base configuration class for debug nodes.

model_config: ClassVar[ConfigDict] = {'extra': 'forbid', 'validate_default': True}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].