Node class

Definition

Represents a basic unit in a graph, e.g it could be any datasource or step.

Node(graph, node_id, name=None, module=None, module_builder=None, datasource=None, datasource_builder=None, module_wiring=None)
Inheritance
builtins.object
Node

Parameters

graph
Graph

The graph this node belongs to.

node_id
str

The ID of the node.

name
str

The name of the graph.

module
Module

The module associated with the Node.

module_builder
_ModuleBuilder

The module builder associated with the Node.

datasource
DataSource

The datasource associated with the Node.

datasource_builder
_DatasourceBuilder

The datasource builder associated with the Node.

module_wiring
{}

mapping between the node's inputs/outputs and the module inputs/outputs. Holds two keys,inputs and outputs, each mapped to a dict whose keys are the module's inputs/outputs names, and the values are the node's ports

Methods

get_input(name)

Return an InputPort by name.

get_output(name)

Return an OutputPort by name.

get_param(name)

Return a parameter by name.

run_after(node)

Run this node after the given node.

If you want to run a step, say, step3 after both step1 and step2 are completed, you can use:


   step3.run_after(step1)
   step3.run_after(step2)
sequence(nodes)

Configure a list of nodes to run in sequence after this node.

get_input(name)

Return an InputPort by name.

get_input(name)

Parameters

name
str

Name of the input port.

Returns

The input port with the matching name.

Return type

get_output(name)

Return an OutputPort by name.

get_output(name)

Parameters

name
str

Name of the output port

Returns

The output port

Return type

get_param(name)

Return a parameter by name.

get_param(name)

Parameters

name
str

Name of the parameter.

Returns

The parameter.

Return type

run_after(node)

Run this node after the given node.

If you want to run a step, say, step3 after both step1 and step2 are completed, you can use:


   step3.run_after(step1)
   step3.run_after(step2)
run_after(node)

Parameters

node
Node

The node to run before this node.

sequence(nodes)

Configure a list of nodes to run in sequence after this node.

sequence(nodes)

Parameters

nodes
list

The list of nodes.

Attributes

datasource_def

Get the datasource definition.

Returns

The datasource definition object.

Return type

input_dict

Get a dictionary containing all inputs.

Returns

Dictionary of {input name, InputPort}

Return type

inputs

Get a list containing all inputs.

Returns

List of InputPort.

Return type

module_def

Get the module definition.

Returns

The module definition object.

Return type

name

Get the name of this node.

Returns

The name.

Return type

str

node_id

Get the node ID for this node.

Returns

The node ID.

Return type

str

output_dict

Get a dictionary containing all outputs.

Returns

Dictionary of {output name, OutputPort}

Return type

outputs

Get a list containing all outputs.

Returns

List of OutputPort.

Return type

params

Get a dictionary containing all parameters.

Returns

Dictionary of {parameter name, Param}

Return type