Skip to content

Commit 6dabb2f

Browse files
committed
use features to simplify nodeset configuration
1 parent b8c64dc commit 6dabb2f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

templates/slurm.conf.j2

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,17 +158,18 @@ Epilog=/etc/slurm/slurm.epilog.clean
158158
{% set hostlists = (inventory_group_hosts | hostlist_expression) %}{# hosts in inventory group aren't necessarily a single hostlist expression #}
159159
{% for hostlist in hostlists %}
160160
NodeName={{ hostlist }} {{ '' -}}
161+
Features=nodegroup_{{ nodegroup.name }} {{ '' -}}
161162
State=UNKNOWN {{ '' -}}
162163
RealMemory={{ nodegroup.ram_mb | default(ram_mb) }} {{ '' -}}
163-
Sockets={{first_host_hv['ansible_processor_count'] }} {{ '' -}}
164+
Sockets={{ first_host_hv['ansible_processor_count'] }} {{ '' -}}
164165
CoresPerSocket={{ first_host_hv['ansible_processor_cores'] }} {{ '' -}}
165166
ThreadsPerCore={{ first_host_hv['ansible_processor_threads_per_core'] }} {{ '' -}}
166167
{{ nodegroup.node_params | default({}) | dict2parameters }} {{ '' -}}
167168
{% if 'gres' in nodegroup %}Gres={{ ','.join(nodegroup.gres | map(attribute='conf')) }}{% endif %}
168169
{% endfor %}{# hostlists #}
169170
{% endif %}{# 1 or more hosts in inventory #}
170171

171-
NodeSet={{ nodegroup.name }} Nodes={{ ','.join(hostlists | default(['""'])) }}{# no support for creating nodesets by Feature #}
172+
NodeSet=nodegroup_{{ nodegroup.name }} Feature=nodegroup_{{ nodegroup.name }}
172173

173174
{% endfor %}
174175

@@ -181,7 +182,7 @@ PartitionName={{partition.name}} {{ '' -}}
181182
Default={{ partition.get('default', 'YES') }} {{ '' -}}
182183
MaxTime={{ partition.get('maxtime', openhpc_job_maxtime) }} {{ '' -}}
183184
State=UP {{ '' -}}
184-
Nodes={{ partition.get('groups', [partition.name]) | join(',') }} {{ '' -}}
185+
Nodes={{ partition.get('groups', [partition.name]) | map('regex_replace', '^', 'nodegroup_') | join(',') }} {{ '' -}}
185186
{{ partition.partition_params | default({}) | dict2parameters }}
186187
{% endfor %}{# openhpc_partitions #}
187188

0 commit comments

Comments
 (0)