yellowdog_ray.utils package

Module contents

Simple class to set up SSH tunnel port-forwarding from a Ray head node to the local host.

class yellowdog_ray.utils.ray_ssh_tunnels.RayTunnels(ray_head_ip_address: str, ssh_user: str, password: str | None = None, private_key_file: str | None = None, private_key_password: str | None = None, ray_tunnel_specs: list[SSHTunnelSpec] | None = None)[source]

Bases: object

Set up SSH port forwarding for Ray.

__init__(ray_head_ip_address: str, ssh_user: str, password: str | None = None, private_key_file: str | None = None, private_key_password: str | None = None, ray_tunnel_specs: list[SSHTunnelSpec] | None = None)[source]

Set SSH tunnel parameters. One of private_key_file or password must be supplied.

Parameters:
  • ray_head_ip_address – the network-accessible IP address for the Ray head node

  • ssh_user – the SSH user to use

  • password – the user’s password

  • private_key_password – the password for the private key

  • private_key_file – the file containing the private key to use

  • ray_tunnel_specs – the ports on which to establish tunnels as a list of SSHTunnelSpec objects

static basic_port_forward(port: int) SSHTunnelSpec[source]

Create a basic port-forwarding tunnel specification.

Parameters:

port – the port to forward

Returns:

An SSHTunnelSpec object

start_tunnels()[source]

Start the SSH tunnels.

stop_tunnels(ignore_errors: bool = True)[source]

Stop the SSH tunnels.

Parameters:

ignore_errors – suppress exceptions and proceed

class yellowdog_ray.utils.ray_ssh_tunnels.SSHTunnelSpec(local_bind_hostname: str, local_bind_ip_address: int, remote_bind_hostname: str, remote_bind_ip_address: int)[source]

Bases: object

Defines the parameters of an SSH tunnel.

__init__(local_bind_hostname: str, local_bind_ip_address: int, remote_bind_hostname: str, remote_bind_ip_address: int) None
local_bind_hostname: str
local_bind_ip_address: int
remote_bind_hostname: str
remote_bind_ip_address: int