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 node

  • properties (Dict[str, Union[str, float, int, Set[str], None]]) – custom properties of the node

  • architecture (Architecture, default: <Architecture.UNKNOWN: 'unknown'>) – node architecture

Attributes

name

Node name.

properties

Node properties.

additional_properties

Additional node properties, often used for internal purposes and not to be exposed to the user.

architecture

Node architecture.

available_environments

Supported environments for the node (see netunicorn.base.environment_definitions).

Methods

from_json

Returns an instance of the object from a JSON representation.

name: str[source]

Node name.

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 property

  • value (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