From eb1996eb727648d18fe162e9aad09e1c251c37e9 Mon Sep 17 00:00:00 2001 From: Andy Georges Date: Wed, 22 Nov 2023 20:59:38 +0100 Subject: [PATCH 1/3] fix: only set the credits as billing target if they were available --- lib/vsc/administration/slurm/sync.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/vsc/administration/slurm/sync.py b/lib/vsc/administration/slurm/sync.py index bde2c6e5..b760a0de 100644 --- a/lib/vsc/administration/slurm/sync.py +++ b/lib/vsc/administration/slurm/sync.py @@ -116,11 +116,15 @@ def slurm_project_qos(projects, slurm_qos_info, clusters, protected_qos, qos_cle qos_name = f"{cluster}-{project.name}" if qos_name not in cluster_qos_names: commands.append(create_add_qos_command(qos_name)) - commands.append(create_modify_qos_command(qos_name, { - "GRPTRESMins": "billing={credits},gres/gpu={gpuminutes}".format( - credits=60*int(project.credits), - gpuminutes=max(1, 60*int(project.gpu_hours))) - })) + + try: + commands.append(create_modify_qos_command(qos_name, { + "GRPTRESMins": "billing={credits},gres/gpu={gpuminutes}".format( + credits=60*int(project.credits), + gpuminutes=max(1, 60*int(project.gpu_hours or 0))) + })) + except TypeError as err: + logging.error(f"{project.name} cannot set QoS due to {err}") # TODO: if we pass a cutoff date, we need to alter the hours if less was spent From f6e9740c2b1c36af4182900af45b793b7c08de5c Mon Sep 17 00:00:00 2001 From: Andy Georges Date: Wed, 22 Nov 2023 21:00:17 +0100 Subject: [PATCH 2/3] bump: version to 4.6.1 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index c19c89df..f3786b7a 100644 --- a/setup.py +++ b/setup.py @@ -32,7 +32,7 @@ ] PACKAGE = { - 'version': '4.6.0', + 'version': '4.6.1', 'author': [ag, jt], 'maintainer': [ag, jt], 'tests_require': ['mock'], From c54fed4274a5f92a2fff73307ec2802f8e7ea3ef Mon Sep 17 00:00:00 2001 From: Andy Georges Date: Thu, 23 Nov 2023 16:02:10 +0100 Subject: [PATCH 3/3] fix: f-string --- lib/vsc/administration/slurm/sync.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/vsc/administration/slurm/sync.py b/lib/vsc/administration/slurm/sync.py index b760a0de..07c45fff 100644 --- a/lib/vsc/administration/slurm/sync.py +++ b/lib/vsc/administration/slurm/sync.py @@ -119,11 +119,10 @@ def slurm_project_qos(projects, slurm_qos_info, clusters, protected_qos, qos_cle try: commands.append(create_modify_qos_command(qos_name, { - "GRPTRESMins": "billing={credits},gres/gpu={gpuminutes}".format( - credits=60*int(project.credits), - gpuminutes=max(1, 60*int(project.gpu_hours or 0))) - })) + "GRPTRESMins": f"billing={60 * int(project.credits)},gres/gpu={max(1, 60 * int(project.hpu_hours or 0))}" + })) except TypeError as err: + # This should not fail the script immediately. logging.error(f"{project.name} cannot set QoS due to {err}") # TODO: if we pass a cutoff date, we need to alter the hours if less was spent