_hook.py
InputHook
Bases: Protocol[T]
Hook used to inject custom logic that will be executed before and after an input is loaded.
after_input_load(io, data)
Hook that is executed after an input is loaded.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
io
|
Input[T]
|
the input object. |
required |
data
|
T
|
the loaded data. |
required |
before_input_load(io)
Hook that is executed before an input is loaded.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
io
|
Input[T]
|
the input object. |
required |
NodeHook
Bases: Protocol
Hook used to inject custom logic that will be executed when a node is run.
on_node_call_error(node, error)
Triggered when an exception is raised when calling the node.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node
|
Node
|
the node object |
required |
error
|
Exception
|
the error |
required |
OutputHook
Bases: Protocol[T]
Hook used to inject custom logic that will be executed before and after an output is saved.
after_output_save(io, data)
Hook that is executed after an output is saved.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
io
|
Output[T]
|
the input object. |
required |
data
|
T
|
the data that has been saved. |
required |
before_output_save(io, data)
Hook that is executed before an output is saved.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
io
|
Output[T]
|
the input object. |
required |
data
|
T
|
the data to be saved. |
required |
RunHook
Bases: Protocol
Hook used to inject custom logic that will be executed when a graph is run.
after_run(graph, data)
before_run(graph)
Triggered before the graph is run.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
graph
|
NodeGraph
|
the graph object |
required |