From 426b134c603b6cd347bdf607b4c12340f01b0b74 Mon Sep 17 00:00:00 2001 From: slugger70 Date: Tue, 14 Jan 2020 12:10:23 +1100 Subject: [PATCH 1/4] Added cluster creation to slurmdb install --- defaults/main.yml | 6 +++++- tasks/slurmdbd.yml | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/defaults/main.yml b/defaults/main.yml index 6d98ea3..35bf58a 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -17,6 +17,10 @@ slurmd_service_name: slurmd slurmctld_service_name: slurmctld slurmdbd_service_name: slurmdbd +#Cluster name for slurm config. This is required to correctly setup slurmdbd and attune it to the slurm config. +__slurm_cluster_name: cluster +__cluster_not_setup: true #Default value. Is modified if cluster already exists. + __slurm_user_name: "{{ (slurm_user | default({})).name | default('slurm') }}" # TODO: this could be incorrect, use the group collection from galaxyproject.galaxy __slurm_group_name: "{{ (slurm_user | default({})).group | default(omit) }}" @@ -28,7 +32,7 @@ __slurm_config_default: AuthType: auth/munge CryptoType: crypto/munge SlurmUser: "{{ __slurm_user_name }}" - ClusterName: cluster + ClusterName: "{{ __slurm_cluster_name }}" # default is proctrack/cgroup which is the best but also less than 100% chance of working e.g. in docker ProctrackType: proctrack/pgid # slurmctld options diff --git a/tasks/slurmdbd.yml b/tasks/slurmdbd.yml index ca4fd2f..2e11f7a 100644 --- a/tasks/slurmdbd.yml +++ b/tasks/slurmdbd.yml @@ -23,3 +23,22 @@ mode: 0755 state: directory when: slurm_create_dirs and __slurmdbd_config_merged.LogFile + +- name: Check for existence of cluster in db. + register: cluster_check + shell: "sacctmgr -n list cluster | cut -f 4 -d ' '" + become: yes + become_user: root + +- name: set cluster_check_boolean + set_fact: + __cluster_not_setup: false + when: cluster_check.stdout == "cluster" + +- name: Create the slurmdbd cluster + command: sacctmgr -i -n add cluster {{ __slurm_cluster_name }} + become: yes + become_user: root + notify: + - reload slurmdbd + when: __cluster_not_setup From 5f01dece6bb91be967189b11a0b7de2d7e20c849 Mon Sep 17 00:00:00 2001 From: slugger70 Date: Wed, 15 Jan 2020 11:51:40 +1100 Subject: [PATCH 2/4] Refactored order in which cluster is created --- tasks/main.yml | 4 ++++ tasks/slurmdbd.yml | 19 ------------------- tasks/slurmdbd_cluster.yml | 20 ++++++++++++++++++++ 3 files changed, 24 insertions(+), 19 deletions(-) create mode 100644 tasks/slurmdbd_cluster.yml diff --git a/tasks/main.yml b/tasks/main.yml index b25a374..765de21 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -39,3 +39,7 @@ enabled: yes state: started when: "'slurmexechosts' in group_names or 'exec' in slurm_roles" + +- name: Setup cluster on slurmdb + include_tasks: slurmdbd_cluster.yml + when: "'slurmdbdservers' in group_names or 'dbd' in slurm_roles" diff --git a/tasks/slurmdbd.yml b/tasks/slurmdbd.yml index 2e11f7a..ca4fd2f 100644 --- a/tasks/slurmdbd.yml +++ b/tasks/slurmdbd.yml @@ -23,22 +23,3 @@ mode: 0755 state: directory when: slurm_create_dirs and __slurmdbd_config_merged.LogFile - -- name: Check for existence of cluster in db. - register: cluster_check - shell: "sacctmgr -n list cluster | cut -f 4 -d ' '" - become: yes - become_user: root - -- name: set cluster_check_boolean - set_fact: - __cluster_not_setup: false - when: cluster_check.stdout == "cluster" - -- name: Create the slurmdbd cluster - command: sacctmgr -i -n add cluster {{ __slurm_cluster_name }} - become: yes - become_user: root - notify: - - reload slurmdbd - when: __cluster_not_setup diff --git a/tasks/slurmdbd_cluster.yml b/tasks/slurmdbd_cluster.yml new file mode 100644 index 0000000..08032a2 --- /dev/null +++ b/tasks/slurmdbd_cluster.yml @@ -0,0 +1,20 @@ +--- + +- name: Check for existence of cluster in db. + register: cluster_check + shell: "sacctmgr -n list cluster | cut -f 4 -d ' '" + become: yes + become_user: root + +- name: set cluster_check_boolean + set_fact: + __cluster_not_setup: false + when: cluster_check.stdout == "cluster" + +- name: Create the slurmdbd cluster + command: sacctmgr -i -n add cluster {{ __slurm_cluster_name }} + become: yes + become_user: root + notify: + - reload slurmdbd + when: __cluster_not_setup From 34a4bda0aabe81583795de13ceea4c1b31424640 Mon Sep 17 00:00:00 2001 From: Christian IUGA Date: Thu, 11 Mar 2021 12:24:56 +0100 Subject: [PATCH 3/4] review order of restarting service should follow this order when restarting : - slurmdbd - slurmctld - slurmd --- handlers/main.yml | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/handlers/main.yml b/handlers/main.yml index 798ba15..21b7ff5 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -4,17 +4,12 @@ name: munge state: restarted -- name: Reload slurmd +- name: Reload slurmdbd ansible.builtin.service: - name: "{{ slurmd_service_name }}" + name: "{{ slurmdbd_service_name }}" state: reloaded - when: "slurm_start_services and ('slurmexechosts' in group_names or 'exec' in slurm_roles)" - -- name: Restart slurmd - ansible.builtin.service: - name: "{{ slurmd_service_name }}" - state: restarted - when: "slurm_start_services and ('slurmexechosts' in group_names or 'exec' in slurm_roles)" + when: "slurm_start_services and ('slurmdbdservers' in group_names or 'dbd' in slurm_roles)" + service: - name: Reload slurmctld ansible.builtin.service: @@ -28,8 +23,14 @@ state: restarted when: "slurm_start_services and ('slurmservers' in group_names or 'controller' in slurm_roles)" -- name: Reload slurmdbd +- name: Reload slurmd ansible.builtin.service: - name: "{{ slurmdbd_service_name }}" + name: "{{ slurmd_service_name }}" state: reloaded - when: "slurm_start_services and ('slurmdbdservers' in group_names or 'dbd' in slurm_roles)" + when: "slurm_start_services and ('slurmexechosts' in group_names or 'exec' in slurm_roles)" + +- name: Restart slurmd + ansible.builtin.service: + name: "{{ slurmd_service_name }}" + state: restarted + when: "slurm_start_services and ('slurmexechosts' in group_names or 'exec' in slurm_roles)" From 05e3c5b737546775ad6c812f55c5e15ce6ed6d44 Mon Sep 17 00:00:00 2001 From: Nuwan Goonasekera <2070605+nuwang@users.noreply.github.com> Date: Sun, 16 Jul 2023 11:40:32 +1000 Subject: [PATCH 4/4] Fix syntax error in handlers --- handlers/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/handlers/main.yml b/handlers/main.yml index 21b7ff5..805a33c 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -9,7 +9,6 @@ name: "{{ slurmdbd_service_name }}" state: reloaded when: "slurm_start_services and ('slurmdbdservers' in group_names or 'dbd' in slurm_roles)" - service: - name: Reload slurmctld ansible.builtin.service: