Skip to content

Commit df20b4f

Browse files
committed
delete assoc!
1 parent 5a0b508 commit df20b4f

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

coldfront/plugins/slurmrest/utils.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
from slurm_rest_api_client import Client
99
from slurm_rest_api_client.api.slurm import slurm_v0043_delete_jobs
1010
from slurm_rest_api_client.api.slurmdb import (
11+
slurmdb_v0043_delete_association,
1112
slurmdb_v0043_get_accounts,
1213
slurmdb_v0043_get_associations,
1314
slurmdb_v0043_post_associations,
@@ -158,4 +159,13 @@ def delete_association_user_account(self, username: str, account: str, noop: boo
158159
if default_assoc_set_resp.errors:
159160
raise RuntimeError(f"Could not set default association for user: {username}")
160161

162+
# finally delete the association!
163+
delete_assoc_resp = slurmdb_v0043_delete_association.sync(
164+
client=self.root_client, user=username, account=account
165+
)
166+
if not delete_assoc_resp:
167+
raise ConnectionError(f"Could not delete association for user: {username} and account: {account}")
168+
if delete_assoc_resp.errors:
169+
raise RuntimeError(f"Could not delete association for user: {username} and account: {account}")
170+
161171
return

0 commit comments

Comments
 (0)