kedro.framework.hooks.specs.NodeSpecs¶
- class kedro.framework.hooks.specs.NodeSpecs[source]¶
Namespace that defines all specifications for a node’s lifecycle hooks.
Methods
after_node_run
(node, catalog, inputs, ...)Hook to be invoked after a node runs.
before_node_run
(node, catalog, inputs, ...)Hook to be invoked before a node runs.
on_node_error
(error, node, catalog, inputs, ...)Hook to be invoked if a node run throws an uncaught error.
- after_node_run(node, catalog, inputs, outputs, is_async, session_id)[source]¶
Hook to be invoked after a node runs. The arguments received are the same as those used by
kedro.runner.run_node
as well as theoutputs
of the node run.- Parameters:
node (
Node
) – TheNode
that ran.catalog (
DataCatalog
) – ADataCatalog
containing the node’s inputs and outputs.inputs (
dict
[str
,Any
]) – The dictionary of inputs dataset. The keys are dataset names and the values are the actual loaded input data, not the dataset instance.outputs (
dict
[str
,Any
]) – The dictionary of outputs dataset. The keys are dataset names and the values are the actual computed output data, not the dataset instance.is_async (
bool
) – Whether the node was run inasync
mode.session_id (
str
) – The id of the session.
- Return type:
- before_node_run(node, catalog, inputs, is_async, session_id)[source]¶
Hook to be invoked before a node runs. The arguments received are the same as those used by
kedro.runner.run_node
- Parameters:
node (Node) – The
Node
to run.catalog (DataCatalog) – A
DataCatalog
containing the node’s inputs and outputs.inputs (dict[str, Any]) – The dictionary of inputs dataset. The keys are dataset names and the values are the actual loaded input data, not the dataset instance.
is_async (bool) – Whether the node was run in
async
mode.session_id (str) – The id of the session.
- Return type:
- Returns:
- Either None or a dictionary mapping dataset name(s) to new value(s).
If returned, this dictionary will be used to update the node inputs, which allows to overwrite the node inputs.
- on_node_error(error, node, catalog, inputs, is_async, session_id)[source]¶
Hook to be invoked if a node run throws an uncaught error. The signature of this error hook should match the signature of
before_node_run
along with the error that was raised.- Parameters:
error (
Exception
) – The uncaught exception thrown during the node run.node (
Node
) – TheNode
to run.catalog (
DataCatalog
) – ADataCatalog
containing the node’s inputs and outputs.inputs (
dict
[str
,Any
]) – The dictionary of inputs dataset. The keys are dataset names and the values are the actual loaded input data, not the dataset instance.is_async (
bool
) – Whether the node was run inasync
mode.session_id (
str
) – The id of the session.
- Return type: