Skip to content

Commit

Permalink
Fix slurm sacctmgr account add
Browse files Browse the repository at this point in the history
  • Loading branch information
camillescottatwork committed Sep 19, 2024
1 parent 273a50e commit dabb69b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
24 changes: 21 additions & 3 deletions cheeto/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,21 @@ class SiteGroup(BaseDocument):
ldap_synced = BooleanField(default=False)
iam_synced = BooleanField(default=False)

meta = {
'indexes': [
{
'fields': ('groupname', 'sitename'),
'unique': True
},
{
'fields': ['_members']
},
{
'fields': ['_slurmers']
}
]
}

@property
def gid(self):
return self.parent.gid
Expand Down Expand Up @@ -1513,7 +1528,9 @@ def group_to_puppet(group: SiteGroup):
'group': s.group,
'autofs': {
'nas': s.host,
'path': str(s.host_path)},
'path': str(s.host_path),
'options': ','.join(sorted(set(s.mount_options) - {'fstype=nfs'}, reverse=True))
},
'zfs': get_puppet_zfs(s),
'globus': s.globus
} for s in storages
Expand Down Expand Up @@ -1630,12 +1647,13 @@ def site_write_to_puppet(args: argparse.Namespace):
@subcommand('sync-old-puppet',
add_site_args_req,
lambda parser: parser.add_argument('repo', type=Path),
lambda parser: parser.add_argument('--base-branch', default='main'),
lambda parser: parser.add_argument('--push-merge', default=False, action='store_true'))
def site_sync_old_puppet(args: argparse.Namespace):
connect_to_database(args.config.mongo)

site = Site.objects.get(sitename=args.site)
repo = GitRepo(args.repo)
repo = GitRepo(args.repo, base_branch=args.base_branch)
prefix = (args.repo / 'domains' / site.fqdn).absolute()
yaml_path = prefix / 'merged' / 'all.yaml'
puppet_map = site_to_puppet(args.site)
Expand All @@ -1652,7 +1670,7 @@ def site_sync_old_puppet(args: argparse.Namespace):
with keyfile.open('w') as fp:
for key in user.parent.ssh_key:
print(key, file=fp)
add(args.repo)
add(args.repo.absolute())


@subcommand('to-ldap',
Expand Down
11 changes: 6 additions & 5 deletions cheeto/slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,12 @@ def __init__(self, sacctmgr_path: Optional[str] = None,
self.show = self.cmd.bake('show', '-P')

def add_account(self, account_name: str,
max_user_jobs: int = -1,
max_group_jobs: int = -1) -> sh.Command:
args = ['account', account_name]
args.append(f'MaxJobs={max_user_jobs}')
args.append(f'MaxSubmit={max_group_jobs}')
account: SlurmAccount) -> sh.Command:
args = ['account', account_name,
f'MaxJobs={account.max_user_jobs}',
f'GrpJobs={account.max_group_jobs}',
f'MaxWall={account.max_job_length}',
f'MaxSubmit={account.max_submit_jobs}']
return self.add.bake(*args)

def modify_account(self, account_name: str,
Expand Down

0 comments on commit dabb69b

Please sign in to comment.