Quickstart
This quickstart shows you how to set Ray and Ray on Golem up, start your cluster, test it, and then stop it. It limits the explanation to the bare minimum - if you are looking for more details jump to setup tutorial
Run the following to get a feeling of how Ray on Golem works.
We recommend creating a new directory and a clean Python virtual environment before you proceed. This avoids cluttering your system installation with unnecessary packages.
# Install ray-on-golem and ray (recommended within a clean virtual environment)
pip3 install -U ray-on-golem
# Download the golem-cluster.yaml
wget https://ray.golem.network/golem-cluster.yaml
# In this command:
# * yagna (golem-node) starts in the background (if not running)
# * ray-on-golem cluster manager starts in the background
# * ray head node is started on a golem provider
ray up golem-cluster.yaml --yes
# Download the example Ray app
wget https://github.com/golemfactory/ray-on-golem/raw/main/examples/simple-task.py
# Execute the app locally by starting a local ray instance on your computer
python3 simple-task.py
# Submit the app to be executed on your cluster
ray submit golem-cluster.yaml simple-task.py
The above shows the usual workflow with Ray apps.
You develop them, while at the same time testing them, on your local machine. When you are ready to get more power - you send them to a Ray cluster without changing a single line of your application's code.
Now, you can stop your cluster until you need it again.
# Tear down the cluster
ray down golem-cluster.yaml --yes
When you no longer plan to start new clusters feel free to stop the background Ray on Golem components.
# Terminate background Ray on Golem components
ray-on-golem stop
Summary
By completing the above quickstart you have successfully:
- Installed ray and ray-on-golem packages
- Downloaded the example golem cluster yaml and the example ray application
- Started up the Ray on Golem cluster
- Run the app on your local computer and then on the cluster
- Stopped the cluster
- Terminated the background Ray on Golem components
Congratulations!