From 31e166246e480017a93e1ae5e148dc2bd8077022 Mon Sep 17 00:00:00 2001 From: Dawa Ometto Date: Thu, 22 Oct 2026 16:07:14 +0200 Subject: [PATCH 1/2] Lint --- molecule/default/verify.yml | 2 +- molecule/nosetup_worker/verify.yml | 2 +- playbook.yml | 15 +++++++++++---- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/molecule/default/verify.yml b/molecule/default/verify.yml index 18f676e..a93c80c 100644 --- a/molecule/default/verify.yml +++ b/molecule/default/verify.yml @@ -10,7 +10,7 @@ owner: ray group: ray mode: "0655" - + - name: Test Ray job API ansible.builtin.command: /opt/ray_head-venv/bin/ray job submit --working-dir /home/ray/ --address test-ray:6379 -- python test.py timeout: 15 diff --git a/molecule/nosetup_worker/verify.yml b/molecule/nosetup_worker/verify.yml index c0c422a..926afb2 100644 --- a/molecule/nosetup_worker/verify.yml +++ b/molecule/nosetup_worker/verify.yml @@ -8,4 +8,4 @@ source ray_worker.env && ray start --disable-usage-stats --node-ip-address "$RAY_NODE_IP_ADDRESS" - --address "$RAY_HEAD_IP:$RAY_PORT" \ No newline at end of file + --address "$RAY_HEAD_IP:$RAY_PORT" diff --git a/playbook.yml b/playbook.yml index af3fada..0699c93 100644 --- a/playbook.yml +++ b/playbook.yml @@ -44,7 +44,7 @@ user: ray state: present key: "{{ _ray_public_key }}" - + # The Ray SRC provider expects the public key to be at a pre-determined location # This is to propagate the key to new nodes. - name: Write ssh key to expected location @@ -106,9 +106,16 @@ - name: Set connect address ansible.builtin.set_fact: - _ray_connect_address: >- - {%- if _ray_head_node_address | length > 0 -%} {%- if ':' in _ray_head_node_address -%} {{ _ray_head_node_address }}{%- else -%} {{ _ray_head_node_address - }}:{{ _ray_head_node_port }}{%- endif -%} {%- elif _ray_head_node -%} {{ _ray_internal_ip }}:{{ _ray_head_node_port }}{%- endif -%} + _ray_connect_address: |- + {%- if _ray_head_node_address | length > 0 -%} + {%- if ':' in _ray_head_node_address -%} + {{ _ray_head_node_address }} + {%- else -%} + {{ _ray_head_node_address }}:{{ _ray_head_node_port }} + {%- endif -%} + {%- elif _ray_head_node -%} + {{ _ray_internal_ip }}:{{ _ray_head_node_port }} + {%- endif -%} - name: Create Ray env file ansible.builtin.template: From c1733c83e7e027831c1e190e7189e323cc56f182 Mon Sep 17 00:00:00 2001 From: Dawa Ometto Date: Thu, 22 Oct 2026 16:07:28 +0200 Subject: [PATCH 2/2] Add autoscaler config param --- playbook.yml | 10 ++++++++++ templates/ray.service.j2 | 1 + 2 files changed, 11 insertions(+) diff --git a/playbook.yml b/playbook.yml index 0699c93..dd33fcd 100644 --- a/playbook.yml +++ b/playbook.yml @@ -27,6 +27,7 @@ _ray_service_name: "ray_{{ _ray_head_node | ternary('head', 'worker') }}" _ray_venv: /opt/{{ _ray_service_name }}-venv _ray_cmd: "{{ _ray_venv }}/bin/ray" + _ray_autoscaling_config: "{{ ray_autoscaling_config | default('') }}" gather_facts: false tasks: @@ -155,6 +156,15 @@ line: 'export PATH="{{ _ray_venv }}/bin/:$PATH"' state: present + - name: Create autoscaling config + when: (_ray_autoscaling_config | length) > 0 + ansible.builtin.copy: + dest: /home/ray/ + owner: ray + group: ray + mode: "0600" + content: "{{ _ray_autoscaling_config }}" + - name: Create Ray systemd service when: _ray_setup ansible.builtin.template: diff --git a/templates/ray.service.j2 b/templates/ray.service.j2 index 9fea822..05506e7 100644 --- a/templates/ray.service.j2 +++ b/templates/ray.service.j2 @@ -10,6 +10,7 @@ Environment="PATH={{ _ray_venv }}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/ {% if _ray_head_node %} ExecStart={{ _ray_cmd }} start \ + {% if _ray_autoscaling_config %}--autoscaling-config /home/ray/ray_bootstrap_config.yaml \{% endif %} --disable-usage-stats \ --block \ --node-ip-address "$RAY_NODE_IP_ADDRESS" \