From 9adc3b544b6279bdbb90213a0a93de5e1d18742e Mon Sep 17 00:00:00 2001 From: Hanwen Date: Tue, 23 Apr 2024 12:01:11 -0700 Subject: [PATCH] Simplify conditional statements in slurm conf template `Uri` is required by `Database` section. `Host` is required by `ExternalSlurmdbd`. Therefore, to check the existence of `Uri` or `Host`, we just need to check the existence of `Database` or `ExternalSlurmdbd`. This improvement simplifies the code and reduces the burden of mocking in testing. Signed-off-by: Hanwen --- .../slurm/templates/slurm_parallelcluster.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cookbooks/aws-parallelcluster-slurm/files/default/head_node_slurm/slurm/templates/slurm_parallelcluster.conf b/cookbooks/aws-parallelcluster-slurm/files/default/head_node_slurm/slurm/templates/slurm_parallelcluster.conf index c6def9daaa..07c383ff79 100644 --- a/cookbooks/aws-parallelcluster-slurm/files/default/head_node_slurm/slurm/templates/slurm_parallelcluster.conf +++ b/cookbooks/aws-parallelcluster-slurm/files/default/head_node_slurm/slurm/templates/slurm_parallelcluster.conf @@ -13,12 +13,12 @@ SelectTypeParameters=CR_CPU_Memory {% else %} SelectTypeParameters=CR_CPU {% endif %} -{% if scaling_config.Database.Uri is defined or scaling_config.ExternalSlurmdbd != None %} +{% if scaling_config.Database or scaling_config.ExternalSlurmdbd %} {# #}AccountingStorageType=accounting_storage/slurmdbd -{# #}{% if scaling_config.Database.Uri is defined %} +{# #}{% if scaling_config.Database %} {# #}AccountingStorageHost={{ head_node_config.head_node_hostname }} {# #}AccountingStoragePort=6819 -{# #}{% elif scaling_config.ExternalSlurmdbd.Host is defined %} +{# #}{% elif scaling_config.ExternalSlurmdbd %} {# #}AccountingStorageHost={{ scaling_config.ExternalSlurmdbd.Host }} {# #}AccountingStoragePort={{ scaling_config.ExternalSlurmdbd.Port }} {# #}{% endif %}