|
1 | 1 | AutoDetect=off |
2 | 2 | {% for part in openhpc_slurm_partitions %} |
3 | 3 | {% set nodelist = [] %} |
| 4 | +{% set donehosts = set() %} |
4 | 5 | {% for group in part.get('groups', [part]) %} |
5 | | -{% set group_name = group.cluster_name|default(openhpc_cluster_name) ~ '_' ~ group.name %} |
6 | | -{% set inventory_group_hosts = groups.get(group_name, []) %} |
7 | | -{% if 'gres_autodetect' in group %} |
8 | | -{% for hostlist in (inventory_group_hosts | hostlist_expression) %} |
9 | | -NodeName={{ hostlist }} AutoDetect={{ group.gres_autodetect }} |
10 | | -{% endfor %} |
11 | | -{% elif 'gres' in group %} |
12 | | -{% for gres in group.gres %} |
13 | | -{% set gres_name, gres_type, _ = gres.conf.split(':') %} |
14 | | -{% for hostlist in (inventory_group_hosts | hostlist_expression) %} |
| 6 | +{% if 'gres' in group %} |
| 7 | +{% set group_name = group.cluster_name|default(openhpc_cluster_name) ~ '_' ~ group.name %} |
| 8 | +{% set inventory_group_hosts = groups.get(group_name, []) %} |
| 9 | +{% set autodetect_mechanisms = inventory_group_hosts | group_by_gres_autodetect %} |
| 10 | +{% for mechanism, _mechanism_hosts in autodetect_mechanisms.items() %} |
| 11 | +{% set mechanism_hosts = _mechanism_hosts - donehosts %} |
| 12 | +{% if mechanism != 'disabled' %} |
| 13 | +{% for hostlist in (mechanism_hosts | hostlist_expression) %} |
| 14 | +NodeName={{ hostlist }} AutoDetect={{ mechanism }} |
| 15 | + |
| 16 | +{% endfor %} |
| 17 | +{% else %} |
| 18 | +{% for gres in group.gres %} |
| 19 | +{% set gres_name, gres_type, _ = gres.conf.split(':') %} |
| 20 | +{% for hostlist in (mechanism_hosts | hostlist_expression) %} |
15 | 21 | NodeName={{ hostlist }} Name={{ gres_name }} Type={{ gres_type }} File={{ gres.file }} |
16 | 22 |
|
17 | | -{% endfor %} |
| 23 | +{% endfor %} |
| 24 | +{% endfor %} |
| 25 | +{% endif %} |
| 26 | + {% set _ = donehosts.update(mechanism_hosts) %} |
18 | 27 | {% endfor %} |
19 | 28 | {% endif %} |
20 | 29 | {% endfor %} |
|
0 commit comments