Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the task that acquires hostlist for a controller that has no workers #11

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion jetstream_common/templates/slurm/slurm.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,14 @@ ReturnToService=1
NodeName={{ hostvars[host]['inventory_hostname_short'] }} NodeAddr={{ hostvars[host]['ansible_host'] }} RealMemory={{ node_type.real_memory }} Sockets={{ node_type.sockets }} CoresPerSocket=1 ThreadsPerCore=1 State=UNKNOWN
{% endfor %}
{% endfor %}
# Needed when setting up a controller without workers
NodeName=placeholder CPUs=64 State=future
#
# Partition Configurations
#
{# well this is less than ideal, it should loop partitions, and then generate a hostlist for that partition. but this works for now... #}
{% for node_type in slurm_nodes %}
PartitionName=multi State=UP MaxTime=48:20:00 MaxNodes=1 Nodes={{ slurm_hostlists.results[0].stdout }}
PartitionName=multi State=UP MaxTime=48:20:00 MaxNodes=1 Nodes={{ slurm_hostlists.results[0].stdout | default( 'placeholder') }}
{% endfor %}

SlurmctldDebug=7
Expand Down
11 changes: 9 additions & 2 deletions roles/slurm/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,17 @@
#- slurm-torque
when: ansible_os_family == "RedHat"

- name: Acquire hostlist
- name: Check if any workers are defined locally
debug:
msg: '{{ groups[item.inventory_group] | length > 0 }}'
with_items: "{{ slurm_nodes }}"
register: local_workers

- name: Acquire remote hostlist
command: scontrol show hostlist {{ groups[item.inventory_group] | join(",") }}
with_items: slurm_nodes
with_items: "{{ slurm_nodes }}"
register: slurm_hostlists
when: local_workers.results[0].msg == True

- name: Install slurm.conf
template:
Expand Down