Skip to main content

ray-vast

(work in progress)

Run a Ray cluster with the head on AWS EC2 and GPU workers on vast.ai.

  • The Ray head runs on one EC2 instance in your AWS account.
  • The Ray autoscaler rents GPU workers from vast.ai when your jobs need them, and removes them when they are idle.
  • The workers talk to the head over the public internet, across NAT, with TLS and a token.
  • You do not need a VPN or an overlay network.

Documentation: https://duc-ph.github.io/ray-vast/

Why

  • vast.ai has cheap GPUs. But a vast instance can stop at any time, and its IP can change.
  • ray-vast keeps the head on EC2, so the cluster stays up. Only workers come and go.
  • You keep the normal Ray workflow. Only the cluster commands change.
  • A worker that loses the head destroys its own instance. You do not pay for lost workers.

Install

pip install ray-vast "ray[default]==2.59.*"

The Ray pin keeps Ray on your laptop at the same version as Ray in the cluster image. ray-vast is tested with Ray 2.59.

You need Python 3.10 or later, an AWS profile, an EC2 key pair, and a vast.ai API key. Details: Getting started.

Quick start

Copy an example cluster YAML (gpu-24gb.yaml, gpu-80gb.yaml or cpu-heavy.yaml in ray_vast/examples/). Set the region, the budget (max_dollars_per_hour) and your EC2 key pair (key_name, key_file).

ray-vast up cluster.yaml --profile my-aws-profile
ray-vast dashboard cluster.yaml --profile my-aws-profile   # keep this terminal open

In a second terminal, run the export line that dashboard printed, and submit a job:

export RAY_AUTH_MODE=token RAY_AUTH_TOKEN_PATH=...     # the line that dashboard printed
ray job submit --address http://127.0.0.1:8265 --working-dir . -- python train.py

When you finish:

ray-vast down cluster.yaml --profile my-aws-profile
Plain Ray ray-vast
ray up ray-vast up
ray dashboard ray-vast dashboard
ray down ray-vast down

Some ray cluster commands do not work. Read limits. Use --working-dir and runtime_env to send code to the cluster.

Documentation

Status

Version 0.1.0. Tested with Ray 2.59.

Contributing

Read CONTRIBUTING.md for the tests and the docs build.

License

MIT. See LICENSE.

Metadata

Release files for ray-vast 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ray-vast 0.1.0
File Size Uploaded
ray_vast-0.1.0.tar.gz 122.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ray-vast 0.1.0
File Interpreter ABI Platform
ray_vast-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 177.4 kB

Release files / ray_vast-0.1.0.tar.gz

Download URL ray_vast-0.1.0.tar.gz
Size 122.7 kB
Tags Source
SHA-256 checksum
How to use checksums
d681b761ec9ea1bd1fd25f67a1a975e4c77f27a97606a84ab84e7fdb84c4a59e
BLAKE2b-256 checksum
How to use checksums
d34dec43024fcecd4a1ff34d6f14b5bc2962f0530cb929ec86af147f8eb0165d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / ray_vast-0.1.0-py3-none-any.whl

Download URL ray_vast-0.1.0-py3-none-any.whl
Size 54.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b8eee1ad30151d9038fa3801884f9a7cf87ebb757a794f642322962536474a3e
BLAKE2b-256 checksum
How to use checksums
0ffab67c07cf09fa2bf90cdb1e0049e9636feff25bc6b38002e0a16e29e607c1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page