Node
The scherbelberg.Node
class describes one node, i.e. server, within the cluster. It can represent both, a Dask worker node as well as a Dask scheduler node, see Dask CLI for more details.
The Node
Class
- class scherbelberg.Node(server, client, fn_private, prefix, wait, log=None)
Represents one node of the cluster, i.e. a server. Mutable.
- Parameters
server (
BoundServer
) – A cloud API server object.client (
Client
) – A cloud API client object.fn_private (
str
) – Location of private SSH key.prefix (
str
) – Name of cluster, used as a prefix in names of every component.wait (
float
) – Timeout in seconds before actions are repeated or exceptions are raised.log (
Optional
[Logger
]) – Allows to pass custom logger objects. Defaults to scherbelberg’s own default logger.
- __repr__()
Interactive string representation
- Return type
str
- async bootstrap()
Bootstraps scherbelberg’s basic infrastructure on the node, i.e.
System updates
Secure user & SSH configuration
TLS/SSL certificate
Conda-forge base install via mamba-forge
- async classmethod from_async(**kwargs)
Constructs objects from this class asynchronously
- Return type
NodeABC
- Returns
New node object
- async classmethod from_name(name, client, fn_private, prefix, wait, log=None)
Creates
scherbelberg.Node
object by connecting to an existing server. Raisesscherbelberg.NodeNotFound
if no matching server can be found.- Parameters
name (
str
) – Full name of node / server.client (
Client
) – Cloud API client object.fn_private (
str
) – Location of private SSH key.prefix (
str
) – Name of cluster, used as a prefix in names of every component.wait (
float
) – Timeout in seconds before actions are repeated or exceptions are raised.log (
Optional
[Logger
]) – Allows to pass custom logger objects. Defaults to scherbelberg’s own default logger.
- Return type
NodeABC
- Returns
New node object
- async get_sshconfig(user=None)
Generates SSH configuration for commands that are supposed to be executed on this node.
- Parameters
user (
Optional
[str
]) – Remote user name, defaults to standard cluster user name.- Return type
SSHConfigABC
- Returns
SSH configuration.
- property labels: Dict[str, str]
Labels of node / server
- Return type
Dict
[str
,str
]
- property name: str
Full name of node / server
- Return type
str
- async ping_ssh(user=None)
Checks if node can be contacted via SSH by executing an
exit
command on it. Performs exactly one single try. Does not raise any type of exception.- Parameters
user (
Optional
[str
]) – Remote user name, defaults to standard cluster user name.- Return type
bool
- Returns
Success (or the lack thereof).
- property private_ip4: str
Private IPv4 address of node / server
- Return type
str
- property public_ip4: str
Public IPv4 address of node / server
- Return type
str
- async reboot()
Triggers a server reboot.
- async start_scheduler(dask_ipc, dask_dash)
Starts Dask scheduler on node.
- Parameters
dask_ipc (
int
) – Port used for Dask’s interprocess communication.dask_dash (
int
) – Port used for Dask’s dashboard.
- async start_worker(dask_ipc, dask_dash, dask_nanny, scheduler_ip4)
Starts Dask scheduler on node.
- Parameters
dask_ipc (
int
) – Port used for Dask’s interprocess communication.dask_dash (
int
) – Port used for Dask’s dashboard.dask_nanny (
int
) – Port used for Dask’s nanny.scheduler_ip4 (
str
) – IPv4 address of scheduler node.
- property suffix: str
Suffix portion of name of node / server
- Return type
str
- async update()
Updates the internal cloud API server object by requesting new information about the node from the cloud API.
- async wait_for_ssh(user=None)
Keeps pinging the server on SSH via
scherbelberg.Node.ping_ssh()
until success inwait
second intervals.- Parameters
user (
Optional
[str
]) – Remote user name, defaults to standard cluster user name.