Node api
Node API
In hyrrokkin, nodes are implemented using a python class which implements methods described in hyrrokkin_engine.node_interface.NodeInterface
:
NodeInterface
Source code in hyrrokkin_engine/node_interface.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
|
__init__(services)
abstractmethod
Create an instance of this Node
Parameters:
Name | Type | Description | Default |
---|---|---|---|
services
|
NodeServiceInterface
|
an object providing useful services, for example to get or set property values |
required |
Source code in hyrrokkin_engine/node_interface.py
30 31 32 33 34 35 36 37 38 |
|
close()
abstractmethod
Called before the node instance is deleted
Source code in hyrrokkin_engine/node_interface.py
87 88 89 90 91 92 |
|
close_client(session_id, client_name)
abstractmethod
Called when a client is detached from the node
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session_id
|
str
|
a unique identifier for the session |
required |
client_name
|
str
|
the name of the client being closed |
required |
Notes
a call to close_client is preceeded by a call to open_client with the same session_id and client_name
Source code in hyrrokkin_engine/node_interface.py
60 61 62 63 64 65 66 67 68 69 70 71 72 |
|
open_client(session_id, client_name, client_options, client_service)
abstractmethod
Called when a client is attached to the node
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session_id
|
str
|
a unique identifier for the session |
required |
client_name
|
str
|
the name of the client being opened |
required |
client_options
|
dict
|
a set of parameters accompanying the connection |
required |
client_service
|
ClientServiceInterface
|
a service instance allowing messages to be sent to and recieved from the client |
required |
Source code in hyrrokkin_engine/node_interface.py
47 48 49 50 51 52 53 54 55 56 57 58 |
|
reset_run()
abstractmethod
Called when this instance's node is about to be re-run
Source code in hyrrokkin_engine/node_interface.py
40 41 42 43 44 45 |
|
run(inputs)
abstractmethod
async
Called when a node should transform input values into output values
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inputs
|
Dict[str, List[Any]]
|
a dictionary mapping input port names to a list of values being presented at that import port |
required |
Returns:
Type | Description |
---|---|
Dict[str, Any]
|
a dictionary mapping output port names to a value output on that port |
Source code in hyrrokkin_engine/node_interface.py
74 75 76 77 78 79 80 81 82 83 84 85 |
|