From 2fce87a4bfb6ae8d0c6dc139a5fb6ba57cd45910 Mon Sep 17 00:00:00 2001 From: Enis Afgan Date: Tue, 4 Oct 2016 17:42:48 -0400 Subject: [PATCH 1/3] Fix the task that acquires hostlist for a controller that has no workers --- jetstream_common/templates/slurm/slurm.conf.j2 | 4 +++- roles/slurm/tasks/main.yml | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/jetstream_common/templates/slurm/slurm.conf.j2 b/jetstream_common/templates/slurm/slurm.conf.j2 index 0f335c61..701c6d7c 100644 --- a/jetstream_common/templates/slurm/slurm.conf.j2 +++ b/jetstream_common/templates/slurm/slurm.conf.j2 @@ -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 diff --git a/roles/slurm/tasks/main.yml b/roles/slurm/tasks/main.yml index 58925a67..83a52ac3 100644 --- a/roles/slurm/tasks/main.yml +++ b/roles/slurm/tasks/main.yml @@ -40,8 +40,9 @@ - name: Acquire hostlist command: scontrol show hostlist {{ groups[item.inventory_group] | join(",") }} - with_items: slurm_nodes + with_items: "{{ slurm_nodes }}" register: slurm_hostlists + when: num_nodes.0 is defined - name: Install slurm.conf template: From 5ce48f1243b4dc46fd00f783c18b483ad63ae369 Mon Sep 17 00:00:00 2001 From: Enis Afgan Date: Wed, 5 Oct 2016 15:06:01 -0400 Subject: [PATCH 2/3] Add the task that does the inventory check for workers --- roles/slurm/tasks/main.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/roles/slurm/tasks/main.yml b/roles/slurm/tasks/main.yml index 83a52ac3..6c05ec55 100644 --- a/roles/slurm/tasks/main.yml +++ b/roles/slurm/tasks/main.yml @@ -38,6 +38,18 @@ #- slurm-torque when: ansible_os_family == "RedHat" +- 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 }}" + register: slurm_hostlists + when: local_workers.results[0].msg == True + - name: Acquire hostlist command: scontrol show hostlist {{ groups[item.inventory_group] | join(",") }} with_items: "{{ slurm_nodes }}" From fcf46ef92377a36962781dfdddacc6b567832b81 Mon Sep 17 00:00:00 2001 From: Enis Afgan Date: Wed, 5 Oct 2016 15:07:14 -0400 Subject: [PATCH 3/3] Remove duplicate task --- roles/slurm/tasks/main.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/roles/slurm/tasks/main.yml b/roles/slurm/tasks/main.yml index 6c05ec55..01d6ac30 100644 --- a/roles/slurm/tasks/main.yml +++ b/roles/slurm/tasks/main.yml @@ -50,12 +50,6 @@ register: slurm_hostlists when: local_workers.results[0].msg == True -- name: Acquire hostlist - command: scontrol show hostlist {{ groups[item.inventory_group] | join(",") }} - with_items: "{{ slurm_nodes }}" - register: slurm_hostlists - when: num_nodes.0 is defined - - name: Install slurm.conf template: src: "{{ slurm_conf_src | default( 'templates/slurm/slurm.conf.j2' ) }}"