Tunnels, CLI and errors

SSH port forwarding to a Ray head node, using the OpenSSH client.

with RayTunnels(head.public_ip, user="yd-agent", private_key="~/.ssh/id_ed25519"):
    ray.init("ray://localhost:10001")      # the Ray client port
    ...                                    # the dashboard is at localhost:8265

One ssh process carries all the forwards, so they all work or none do. Your SSH configuration (~/.ssh/config: jump hosts, agents and so on) applies, except where the options below override it.

Host keys are not checked by default, as with Ray’s own SSH: cloud instances are short-lived and their addresses are reused, so a remembered host key says little. Where that matters (the tunnel carries the Ray client and dashboard traffic), record the head node’s key yourself and pass ssh_options=["StrictHostKeyChecking=yes", "UserKnownHostsFile=<file>"].

The ssh process is stopped by stop() or by leaving the with block. A process killed outright (SIGKILL, or SIGTERM with no handler) cannot do that, and leaves its ssh running.

class yellowdog_ray.tunnels.PortForward(local_port: int, remote_port: int, remote_host: str = 'localhost', local_host: str = 'localhost')[source]

Bases: object

Forward local_host:local_port here to remote_host:remote_port as seen from the head node.

The raydog command: see what clusters exist, and end them.

raydog list clusters in a namespace raydog status CLUSTER one cluster in detail raydog down CLUSTER shut a cluster down raydog cleanup find (and with –delete, remove) leftovers raydog tunnel CLUSTER forward the Ray ports of a cluster’s head node

It works from any machine with YellowDog credentials: clusters are found on the platform by name, whoever created them and however (Builder or ray up).

yellowdog_ray.cli.main(argv: Sequence[str] | None = None, *, platform: Platform | None = None, clock: Clock | None = None) → int[source]

Run the command line. Returns the process exit code.

Every exception RayDog raises deliberately.

exception yellowdog_ray.errors.BuildTimeoutError[source]

Bases: RayDogError, TimeoutError

A node did not start within the build timeout.

exception yellowdog_ray.errors.ClusterExistsError[source]

Bases: RayDogError

A live cluster with this name already exists.

exception yellowdog_ray.errors.ClusterNotFoundError[source]

Bases: RayDogError

No cluster with this name was found.

exception yellowdog_ray.errors.ClusterStateError[source]

Bases: RayDogError

The operation is not valid in the cluster’s current state.

exception yellowdog_ray.errors.ConfigError[source]

Bases: RayDogError

A cluster specification, YAML config or name is invalid.

exception yellowdog_ray.errors.CredentialsError[source]

Bases: RayDogError

YellowDog credentials are missing or were rejected.

exception yellowdog_ray.errors.InvalidRequestError(message: str, *, error_type: str | None = None, status_code: int | None = None, retryable: bool = False)[source]

Bases: PlatformError

The platform rejected the request as invalid.

exception yellowdog_ray.errors.NameInUseError(message: str, *, error_type: str | None = None, status_code: int | None = None, retryable: bool = False)[source]

Bases: InvalidRequestError

The name is already taken, possibly by an object that has ended.

exception yellowdog_ray.errors.NodeStartError[source]

Bases: RayDogError

A node’s task failed or was cancelled before it started running.

exception yellowdog_ray.errors.NotFoundError(message: str, *, error_type: str | None = None, status_code: int | None = None, retryable: bool = False)[source]

Bases: PlatformError

The object does not exist.

exception yellowdog_ray.errors.PlatformError(message: str, *, error_type: str | None = None, status_code: int | None = None, retryable: bool = False)[source]

Bases: RayDogError

A call to the YellowDog platform failed.

exception yellowdog_ray.errors.RayDogError[source]

Bases: Exception

Base class for all RayDog errors.

exception yellowdog_ray.errors.TeardownError(failures: Sequence[tuple[str, Exception]])[source]

Bases: RayDogError

Teardown ran to the end, but some steps failed.

Something may still be running. failures pairs a description of each step that failed with the exception it raised.

exception yellowdog_ray.errors.TunnelError[source]

Bases: RayDogError

An SSH tunnel could not be opened.