HamiltonGraphAdapter#
Graph adapters control how functions are executed as the graph is walked.
- class hamilton.base.HamiltonGraphAdapter#
Any GraphAdapters should implement this interface to adapt the HamiltonGraph for that particular context.
Note since it inherits ResultMixin β HamiltonGraphAdapters need a build_result function too.
- abstract static check_input_type(node_type: Type, input_value: Any) bool #
Used to check whether the user inputs match what the execution strategy & functions can handle.
- Parameters:
node_type β The type of the node.
input_value β An actual value that we want to inspect matches our expectation.
- Returns:
- abstract static check_node_type_equivalence(node_type: Type, input_type: Type) bool #
Used to check whether two types are equivalent.
This is used when the function graph is being created and weβre statically type checking the annotations for compatibility.
- Parameters:
node_type β The type of the node.
input_type β The type of the input that would flow into the node.
- Returns:
- abstract execute_node(node: Node, kwargs: Dict[str, Any]) Any #
Given a node that represents a hamilton function, execute it. Note, in some adapters this might just return some type of βfutureβ.
- Parameters:
node β the Hamilton Node
kwargs β the kwargs required to exercise the node function.
- Returns:
the result of exercising the node.