def print_pipeline(pipeline, full, print_fn): check.inst_param(pipeline, 'pipeline', PipelineDefinition) check.bool_param(full, 'full') check.callable_param(print_fn, 'print_fn') printer = IndentingPrinter(indent_level=2, printer=print_fn) printer.line('Pipeline: {name}'.format(name=pipeline.name)) print_description(printer, pipeline.description) if not full: return with printer.with_indent(): printer.line('Context Definitions:') with printer.with_indent(): for context_name, context_definition in pipeline.context_definitions.items( ): print_context_definition(printer, context_name, context_definition) printer.line('Solids:') for solid in pipeline.solids: with printer.with_indent(): print_solid(printer, solid)
def print_pipeline(pipeline_snapshot, print_fn): check.inst_param(pipeline_snapshot, "pipeline", PipelineSnapshot) check.callable_param(print_fn, "print_fn") printer = IndentingPrinter(indent_level=2, printer=print_fn) printer.line("Pipeline: {name}".format(name=pipeline_snapshot.name)) print_description(printer, pipeline_snapshot.description) printer.line("Solids:") for solid in pipeline_snapshot.dep_structure_snapshot.solid_invocation_snaps: with printer.with_indent(): print_solid(printer, pipeline_snapshot, solid)
def print_solids(pipeline, print_fn): check.inst_param(pipeline, 'pipeline', PipelineDefinition) check.callable_param(print_fn, 'print_fn') printer = IndentingPrinter(indent_level=2, printer=print_fn) printer.line('Pipeline: {name}'.format(name=pipeline.name)) printer.line('Solids:') for solid in pipeline.solids: with printer.with_indent(): printer.line('Solid: {name}'.format(name=solid.name))
def print_solids(pipeline_snapshot, print_fn): check.inst_param(pipeline_snapshot, 'pipeline', PipelineSnapshot) check.callable_param(print_fn, 'print_fn') printer = IndentingPrinter(indent_level=2, printer=print_fn) printer.line('Pipeline: {name}'.format(name=pipeline_snapshot.name)) printer.line('Solids:') for solid in pipeline_snapshot.dep_structure_snapshot.solid_invocation_snaps: with printer.with_indent(): printer.line('Solid: {name}'.format(name=solid.solid_name))
def print_graph(graph, printer=print): check.inst_param(graph, 'graph', ComputeNodeGraph) printer = IndentingPrinter(printer=printer) for node in graph.topological_nodes(): with printer.with_indent( 'Node {node.friendly_name} Id: {node.guid}'.format(node=node)): for node_input in node.node_inputs: with printer.with_indent('Input: {node_input.name}'.format( node_input=node_input)): printer.line('Type: {node_input.dagster_type.name}'.format( node_input=node_input)) printer.line( 'From: {node_input.prev_output_handle}'.format( node_input=node_input)) for node_output in node.node_outputs: with printer.with_indent('Output: {node_output.name}'.format( node_output=node_output)): printer.line( 'Type: {node_output.dagster_type.name}'.format( node_output=node_output))
def print_solid_or_op( printer: IndentingPrinter, pipeline_snapshot: PipelineSnapshot, solid_invocation_snap: SolidInvocationSnap, using_job_op_graph_apis: bool, ) -> None: check.inst_param(pipeline_snapshot, "pipeline_snapshot", PipelineSnapshot) check.inst_param(solid_invocation_snap, "solid_invocation_snap", SolidInvocationSnap) printer.line( f"{'Op' if using_job_op_graph_apis else 'Solid'}: {solid_invocation_snap.solid_name}" ) with printer.with_indent(): printer.line("Inputs:") for input_dep_snap in solid_invocation_snap.input_dep_snaps: with printer.with_indent(): printer.line( "Input: {name}".format(name=input_dep_snap.input_name)) printer.line("Outputs:") for output_def_snap in pipeline_snapshot.get_node_def_snap( solid_invocation_snap.solid_def_name).output_def_snaps: printer.line(output_def_snap.name)
def print_pipeline_or_job(pipeline_snapshot, print_fn, using_job_op_graph_apis=False): check.inst_param(pipeline_snapshot, "pipeline", PipelineSnapshot) check.callable_param(print_fn, "print_fn") printer = IndentingPrinter(indent_level=2, printer=print_fn) printer.line( f"{'Job' if using_job_op_graph_apis else 'Pipeline'}: {pipeline_snapshot.name}" ) print_description(printer, pipeline_snapshot.description) printer.line(f"{'Ops' if using_job_op_graph_apis else 'Solids'}") for solid in pipeline_snapshot.dep_structure_snapshot.solid_invocation_snaps: with printer.with_indent(): print_solid_or_op(printer, pipeline_snapshot, solid, using_job_op_graph_apis)
def print_solids_or_ops( pipeline_snapshot: PipelineSnapshot, print_fn: Callable[..., Any], using_job_op_graph_apis: bool = False, ): check.inst_param(pipeline_snapshot, "pipeline", PipelineSnapshot) check.callable_param(print_fn, "print_fn") printer = IndentingPrinter(indent_level=2, printer=print_fn) printer.line( f"{'Job' if using_job_op_graph_apis else 'Pipeline'}: {pipeline_snapshot.name}" ) printer.line(f"{'Ops' if using_job_op_graph_apis else 'Solids'}") for solid in pipeline_snapshot.dep_structure_snapshot.solid_invocation_snaps: with printer.with_indent(): printer.line( f"{'Op' if using_job_op_graph_apis else 'Solid'}: {solid.solid_name}" )