Skip to content

Commit

Permalink
Merge branch 'galaxyproject:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
jakob1379 authored Nov 14, 2023
2 parents b2d63a4 + 2f051cb commit 49ae36f
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 13 deletions.
6 changes: 5 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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_start_services: true

__slurm_user_name: "{{ (slurm_user | default({})).name | default('slurm') }}"
Expand All @@ -42,7 +46,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
Expand Down
24 changes: 12 additions & 12 deletions handlers/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,11 @@
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)"

- name: Reload slurmctld
ansible.builtin.service:
Expand All @@ -28,8 +22,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)"
4 changes: 4 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,7 @@
enabled: true
state: started
when: "slurm_start_services and ('slurmexechosts' in group_names or 'exec' in slurm_roles)"

- name: Setup cluster on slurmdb
include_tasks: slurmdbd_cluster.yml
when: "slurm_start_services and ('slurmdbdservers' in group_names or 'dbd' in slurm_roles)"
20 changes: 20 additions & 0 deletions tasks/slurmdbd_cluster.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 49ae36f

Please sign in to comment.