5.3. Node#
Below you will find the structure of the classes and functions that comprise the node. A few that we would like to highlight:
Node: the main class in a vantage6 node.
NodeContext and DockerNodeContext: classes that handle the node configuration. The latter inherits from the former and adds some properties for when the node runs in a docker container.
DockerManager: Manages the docker containers and networks of the vantage6 node.
DockerTaskManager: Start a docker container that runs an algorithm and manage its lifecycle.
VPNManager: Sets up the VPN connection (if it is configured) and manages it.
vnode-local commands: commands to run non-dockerized (development) instances of your nodes.
5.3.1. Node
class#
5.3.2. NodeContext
class#
- class NodeContext(instance_name, environment='application', system_folders=False, config_file=None)#
Node context
See DockerNodeContext for the node instance mounts when running as a dockerized service.
- Parameters:
instance_name (str) – Name of the configuration instance, corresponds to the filename of the configuration file.
environment (str, optional) – DTAP environment to be loaded, by default N_ENV
system_folders (bool, optional) – _description_, by default N_FOL
config_file (str, optional) – _description_, by default None
- INST_CONFIG_MANAGER#
alias of
NodeConfigurationManager
- classmethod available_configurations(system_folders=False)#
Find all available server configurations in the default folders.
- Parameters:
system_folders (bool, optional) – System wide or user configuration, by default N_FOL
- Returns:
The first list contains validated configuration files, the second list contains invalid configuration files.
- Return type:
Tuple[List, List]
- classmethod config_exists(instance_name, environment='application', system_folders=False)#
Check if a configuration file exists.
- Parameters:
instance_name (str) – Name of the configuration instance, corresponds to the filename of the configuration file.
environment (str, optional) – DTAP environment that needs to be present, by default N_ENV
system_folders (bool, optional) – System wide or user configuration, by default N_FOL
- Returns:
Whether the configuration file exists or not
- Return type:
bool
- property databases#
Dictionary of local databases that are available for this node.
- Returns:
dictionary with database names as keys and their corresponding paths as values.
- Return type:
dict
- property docker_container_name: str#
Unique Docker container name of the node.
- Returns:
Unique Docker container name
- Return type:
str
- property docker_network_name: str#
Private Docker network name which is unique for this node.
- Returns:
Docker network name
- Return type:
str
- property docker_ssh_volume_name: str#
Docker volume in which the SSH configuration is stored.
- Returns:
Docker voluem name
- Return type:
str
- docker_temporary_volume_name(run_id)#
Docker volume in which temporary data is stored. Temporary data is linked to a specific run. Multiple algorithm containers can have the same run id, and therefore the share same temporary volume.
- Parameters:
run_id (int) – run id provided by the server
- Returns:
Docker volume name
- Return type:
str
- property docker_volume_name: str#
Docker volume in which task data is stored. In case a file based database is used, this volume contains the database file as well.
- Returns:
Docker volume name
- Return type:
str
- property docker_vpn_volume_name: str#
Docker volume in which the VPN configuration is stored.
- Returns:
Docker volume name
- Return type:
str
- classmethod from_external_config_file(path, environment='application', system_folders=False)#
Create a node context from an external configuration file. External means that the configuration file is not located in the default folders but its location is specified by the user.
- Parameters:
path (str) – Path of the configuration file
environment (str, optional) – DTAP environment to be loaded, by default N_ENV
system_folders (bool, optional) – System wide or user configuration, by default N_FOL
- Returns:
Node context object
- Return type:
- get_database_uri(label='default')#
Obtain the database URI for a specific database.
- Parameters:
label (str, optional) – Database label, by default “default”
- Returns:
URI to the database
- Return type:
str
- static type_data_folder(system_folders=False)#
Obtain OS specific data folder where to store node specific data.
- Parameters:
system_folders (bool, optional) – System wide or user configuration, by default N_FOL
- Returns:
Path to the data folder
- Return type:
Path