Skip to content

Commit e510ac2

Browse files
committed
Adds bypass_validation for visualize_execution
Beforehand you needed to know all the inputs. This allows you to pass in placeholders, and bypass validation. It defaults to false.
1 parent 6107068 commit e510ac2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

hamilton/driver.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,7 @@ def _visualize_execution_helper(
791791
deduplicate_inputs: bool = False,
792792
show_schema: bool = True,
793793
custom_style_function: Callable = None,
794+
bypass_validation: bool = False,
794795
):
795796
"""Helper function to visualize execution, using a passed-in function graph.
796797
@@ -809,7 +810,8 @@ def _visualize_execution_helper(
809810
"""
810811
# TODO should determine if the visualization logic should live here or in the graph.py module
811812
nodes, user_nodes = fn_graph.get_upstream_nodes(final_vars, inputs, overrides)
812-
Driver.validate_inputs(fn_graph, adapter, user_nodes, inputs, nodes)
813+
if not bypass_validation:
814+
Driver.validate_inputs(fn_graph, adapter, user_nodes, inputs, nodes)
813815
node_modifiers = {fv: {graph.VisualizationNodeModifiers.IS_OUTPUT} for fv in final_vars}
814816
for user_node in user_nodes:
815817
if user_node.name not in node_modifiers:
@@ -857,6 +859,7 @@ def visualize_execution(
857859
deduplicate_inputs: bool = False,
858860
show_schema: bool = True,
859861
custom_style_function: Callable = None,
862+
bypass_validation: bool = False,
860863
) -> Optional["graphviz.Digraph"]: # noqa F821
861864
"""Visualizes Execution.
862865
@@ -907,6 +910,7 @@ def visualize_execution(
907910
deduplicate_inputs=deduplicate_inputs,
908911
show_schema=show_schema,
909912
custom_style_function=custom_style_function,
913+
bypass_validation=bypass_validation,
910914
)
911915

912916
@capture_function_usage
@@ -1500,6 +1504,7 @@ def visualize_materialization(
15001504
deduplicate_inputs: bool = False,
15011505
show_schema: bool = True,
15021506
custom_style_function: Callable = None,
1507+
bypass_validation: bool = False,
15031508
) -> Optional["graphviz.Digraph"]: # noqa F821
15041509
"""Visualizes materialization. This helps give you a sense of how materialization
15051510
will impact the DAG.
@@ -1521,6 +1526,7 @@ def visualize_materialization(
15211526
:param show_schema: If True, show the schema of the materialized nodes
15221527
if nodes have schema metadata attached.
15231528
:param custom_style_function: Optional. Custom style function.
1529+
:param bypass_validation: If True, bypass validation. Optional.
15241530
:return: The graphviz graph, if you want to do something with it
15251531
"""
15261532
if additional_vars is None:
@@ -1547,6 +1553,7 @@ def visualize_materialization(
15471553
deduplicate_inputs=deduplicate_inputs,
15481554
show_schema=show_schema,
15491555
custom_style_function=custom_style_function,
1556+
bypass_validation=bypass_validation,
15501557
)
15511558

15521559
def validate_execution(

0 commit comments

Comments
 (0)