I have created a GCP Ray cluster from the ray cluster dashboard within GCP, I have also created a Ray cluster locally via docker compose.
Is there an easy way to generate the ray cluster config?
For example here is the base Dockerfile
I used on the ray head and nodes:
FROM python:3.11.9-slim
RUN apt-get update
&& apt-get install libgl1 tesseract-ocr git -y
&& apt-get install libxml2-dev libxslt-dev -y
&& apt-get install poppler-utils -y
&& apt-get install libmagic1 -y
&& apt-get install libcairo2-dev libjpeg62-turbo-dev libpango1.0-dev libgif-dev build-essential g++ curl -y
&& apt-get install postgresql-server-dev-all -y
&& apt-get install libpq-dev -y
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
RUN echo '. /root/.cargo/env' >> /root/.bashrc
ENV PATH=$PATH:/root/.cargo/bin/
RUN echo PATH: $PATH
RUN ls /root/.cargo/env
ENV PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1
WORKDIR /app
COPY vertexai_loaders/pyproject.toml /app
COPY vertexai_loaders/requirements.txt /app
COPY vertexai_loaders/poetry.lock /app
COPY vertexai_loaders/README.md /app
COPY vertexai_loaders/src/ /app/src
COPY vertexai_loaders/alembic/ /app/alembic
COPY vertexai_loaders/alembic.ini /app/alembic.ini
COPY secrets /secrets
RUN pip install --upgrade pip
RUN pip install psycopg2
RUN pip install -e .
RUN pip install "ray[default]"
RUN pip install -r requirements.txt
RUN echo done
EXPOSE 6479
EXPOSE 8265
EXPOSE 10001
And the snippet for the ray cluster in the docker-compose.yaml
ray-head:
build:
context: .
dockerfile: ./dockerfile.ray.cluster
ports:
- 6479:6479 # default (6379) but that is also the default for redis port for starting jobs on head node
- 8265:8265 # default ray dashboard port
- 10001:10001 # ray client server port
volumes:
- ray-data:/var/lib/ray/data
command: sh -c 'ray start --head --dashboard-host=0.0.0.0 --dashboard-port=8265 --port=6479 --ray-client-server-port=10001 --block'
networks:
- net
ray-worker-1:
build:
context: .
dockerfile: ./dockerfile.ray.cluster
depends_on:
- ray-head
command: ray start --address=ray-head:6479 --ray-client-server-port=10001 --block
environment:
- RAY_HEAD_IP=ray-head
networks:
- net
extra_hosts:
- "host.docker.internal:host-gateway"
ray-worker-2:
build:
context: .
dockerfile: ./dockerfile.ray.cluster
depends_on:
- ray-head
command: ray start --address=ray-head:6479 --ray-client-server-port=10001 --block
environment:
- RAY_HEAD_IP=ray-head
networks:
- net
extra_hosts:
- "host.docker.internal:host-gateway"
ray-worker-3:
build:
context: .
dockerfile: ./dockerfile.ray.cluster
depends_on:
- ray-head
command: ray start --address=ray-head:6479 --ray-client-server-port=10001 --block
environment:
- RAY_HEAD_IP=ray-head
networks:
- net
extra_hosts:
- "host.docker.internal:host-gateway"
volumes:
ray-data:
driver: local
networks:
net:
driver: bridge
ui-network:
external: false
I also tried to use the in browser GCP SSH, and dug around the ray --help
but didn’t find an easy way to generate the ray config yaml?
How can I do that?
Of course I had a look at: https://docs.ray.io/en/latest/cluster/vms/references/ray-cluster-configuration.html#cluster-config
However, even looking at each config key, its not clear, and seems prone to mistakes especially considering each value would need to be hand crafted and tried. Seems pretty weird considering its an already deployed cluster.
I also tried find / | grep '.yml|.yaml | less
and didn’t see anywhere on the head node a pre-existing configuration file.
Related:
- https://docs.ray.io/en/latest/ray-core/handling-dependencies.html