netunicorn.base.nodes.Node¶
- class Node(name, properties, architecture=Architecture.UNKNOWN)[source]¶
Bases:
object
Represents a single node in a pool of nodes.
- Parameters:
name (
str
) – name of the nodeproperties (
Dict
[str
,Union
[str
,float
,int
,Set
[str
],None
]]) – custom properties of the nodearchitecture (
Architecture
, default:<Architecture.UNKNOWN: 'unknown'>
) – node architecture
Attributes
Node name.
Node properties.
Additional node properties, often used for internal purposes and not to be exposed to the user.
Node architecture.
Supported environments for the node (see
netunicorn.base.environment_definitions
).Methods
Returns an instance of the object from a JSON representation.
-
properties:
Dict
[str
,Union
[str
,float
,int
,Set
[str
],None
]][source]¶ Node properties. Could be used to store custom information about the node.
-
additional_properties:
Dict
[str
,Union
[str
,float
,int
,Set
[str
],None
]][source]¶ Additional node properties, often used for internal purposes and not to be exposed to the user.
-
architecture:
Architecture
[source]¶ Node architecture.
-
available_environments:
Set
[type
][source]¶ Supported environments for the node (see
netunicorn.base.environment_definitions
).
- __getitem__(item)[source]¶
Returns a node property by name.
- Parameters:
item (
str
) – name of the property- Returns:
Union
[str
,float
,int
,Set
[str
],None
] – property value
- __setitem__(key, value)[source]¶
Sets a node property.
- Parameters:
key (
str
) – name of the propertyvalue (
Union
[str
,float
,int
,Set
[str
],None
]) – property value
- Return type:
None
- classmethod from_json(data)[source]¶
Returns an instance of the object from a JSON representation.
- Parameters:
data (
NodeRepresentation
) – JSON representation of the object- Returns:
Node
– instance of the object