Base Hook class
Hook
Base hook class used to build new hooks.
Hooks are callback-like objects that can be passed to the module's configuration, they
intercept the __call__()
method of the modules.
They can be used to log the inputs/outputs of the modules as well as for streaming data or for observability.
Attributes:
Name | Type | Description |
---|---|---|
params |
dict
|
Hook parameters (eg. endpoint, log-level ...). |
module |
Module
|
Instance of |
Source code in synalinks/src/hooks/hook.py
on_call_begin(call_id, inputs=None)
Called at the beginning of the module execution.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
call_id
|
str
|
The id of the module's call |
required |
inputs
|
SymbolicDataModel | JsonDataModel | DataModel | list | dict | tuple
|
The module's inputs. The outputs can be data models or lists, dicts or tuples of data models. |
None
|
Source code in synalinks/src/hooks/hook.py
on_call_end(call_id, outputs=None, exception=None)
Called at the end of the module execution.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
call_id
|
str
|
The id of the module's call |
required |
outputs
|
SymbolicDataModel | JsonDataModel | DataModel | list | dict | tuple
|
The module's outputs. The outputs can be data models or lists, dicts or tuples of data models. |
None
|
exception
|
str
|
Exception message if any. |
None
|