Skip to content

Use slurmd's own detection for node definition #96

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

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
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
10 changes: 10 additions & 0 deletions tasks/runtime.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,16 @@
notify:
- Restart Munge service

- name: Get slurmd's view of node configuration
command:
cmd: slurmd -C
when: openhpc_slurm_service == 'slurmd'
register: slurmd_conf
changed_when: false
# stdout is e.g.:
# NodeName=nrel-hpc-0 CPUs=16 Boards=1 SocketsPerBoard=2 CoresPerSocket=8 ThreadsPerCore=1 RealMemory=128616
# UpTime=0-00:48:14

- name: Template slurmdbd.conf
template:
src: slurmdbd.conf.j2
Expand Down
7 changes: 2 additions & 5 deletions templates/slurm.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,8 @@ Epilog=/etc/slurm/slurm.epilog.clean
{% set first_host = group_hosts | first | mandatory('Group "' + group_name + '" contains no hosts in this play - was --limit used?') %}
{% set first_host_hv = hostvars[first_host] %}

NodeName=DEFAULT State=UNKNOWN \
RealMemory={% if 'ram_mb' in group %}{{group.ram_mb}}{% else %}{{ first_host_hv['ansible_memory_mb']['real']['total'] }}{% endif %} \
Sockets={{first_host_hv['ansible_processor_count']}} \
CoresPerSocket={{first_host_hv['ansible_processor_cores']}} \
ThreadsPerCore={{first_host_hv['ansible_processor_threads_per_core']}}
# TODO: support modifying parameters using existing variables
NodeName=DEFAULT {{ first_host_hv['slurmd_conf'].stdout_lines[0] | regex_replace("NodeName=\S+ ", "") }}
{% for node in groups[group_name] %}
NodeName={{ node }}
{% endfor %}{# nodes #}
Expand Down