pasteur.kedro.pipelines.meta.ExtendedNode#

class pasteur.kedro.pipelines.meta.ExtendedNode(func, inputs, outputs, *, args=None, kwargs=None, name=None, tags=None, confirms=None, namespace=None)[source]#

Extended node is a modification of node that allows for nesting dictionaries in inputs and outputs and features a built-in closure.

Example: ``` inputs: {

metadata: metadata, ids: {

table1: table1, table2: table2

}, tables: {

table1: table1, table2: table2

},

}#

This way, multiple kedro datasets can be passed in, without having to tangle them with ids.

Also, ExtendedNode acts as a partial when args, kwargs are provided.

Attributes

confirms

Return dataset names to confirm as a list.

func

Exposes the underlying function of the node.

inputs

Return node inputs as a list, in the order required to bind them properly to the node's function.

name

Node's name.

namespace

Node's namespace.

outputs

Return node outputs as a list preserving the original order

short_name

Node's name.

tags

Return the tags assigned to the node.

Methods

run([inputs])

Run this node using the provided inputs and return its results in a dictionary.

tag(tags)

Create a new Node which is an exact copy of the current one,

property confirms: list[str]#

Return dataset names to confirm as a list.

Returns:

Dataset names to confirm as a list.

property func: Callable#

Exposes the underlying function of the node.

Returns:

Return the underlying function of the node.

property inputs: list[str]#

Return node inputs as a list, in the order required to bind them properly to the node’s function.

Returns:

Node input names as a list.

property name: str#

Node’s name.

Returns:

Node’s name if provided or the name of its function.

property namespace: str | None#

Node’s namespace.

Returns:

String representing node’s namespace, typically from outer to inner scopes.

property outputs: list[str]#
Return node outputs as a list preserving the original order

if possible.

Returns:

Node output names as a list.

run(inputs=None)[source]#

Run this node using the provided inputs and return its results in a dictionary.

Parameters:

inputs (Optional[Dict[str, Any]]) – Dictionary of inputs as specified at the creation of the node.

Raises:
  • ValueError – In the following cases: a) The node function inputs are incompatible with the node input definition. Example 1: node definition input is a list of 2 DataFrames, whereas only 1 was provided or 2 different ones were provided. b) The node function outputs are incompatible with the node output definition. Example 1: node function definition is a dictionary, whereas function returns a list. Example 2: node definition output is a list of 5 strings, whereas the function returns a list of 4 objects.

  • Exception – Any exception thrown during execution of the node.

Return type:

Union[Dict[str, Any], set[Callable[..., Dict[str, Any]]]]

Returns:

All produced node outputs are returned in a dictionary, where the keys are defined by the node outputs.

property short_name: str#

Node’s name.

Returns:

Returns a short, user-friendly name that is not guaranteed to be unique. The namespace is stripped out of the node name.

tag(tags)#
Create a new Node which is an exact copy of the current one,

but with more tags added to it.

Parameters:

tags (str | Iterable[str]) – The tags to be added to the new node.

Return type:

Node

Returns:

A copy of the current Node object with the tags added.

property tags: set[str]#

Return the tags assigned to the node.

Returns:

Return the set of all assigned tags to the node.