I have a couple of Perl packages available on CPAN
Slurm::Sacctmgr
Slurm::Sshare
to provide wrappers around the sacctmgr and sshare
commands, respectively.
These will parse the output of query subcommands (
e.g. sacctmgr show XXX) and present as Perl-ish data structures,
as well as allow for issuing of commands to modify the Slurm
DB (e.g. sacctmgr create account, etc). Package does error
checking, and supports 'verbose' and 'dryrun' flags to assist
in debugging/testing scripts.
Unlike the Slurmdb package, these pretty directly follow the
syntax of the sacctmgr and sshare commands, so it is more
straightforward to go to/from manual commands to create an allocation/etc
to a script.
Recent updates to CPAN include support for TRESes, etc. from 15.x.y
versions of Slurm. These packages have been used (in various incarnations)
for a couple of years at UMD with various Slurm versions (2.x.y and 14.x.y)
and have been tested with 15.08.2 and 16.05.0. We use them for scripted
creation of allocation accounts, monthy/quarterly account resetting, and
adding/removing users from allocation accounts.
On Fri, 10 Jun 2016, Schulz, William wrote:
Thanks, R?mi. I will have a look!
-----Original Message-----
From: R?mi Palancher [mailto:[email protected]]
Sent: Friday, June 10, 2016 4:51 AM
To: slurm-dev
Subject: [slurm-dev] Re: Scripting Account Provisioning
Hi William,
Le 09/06/2016 ? 18:19, Schulz, William a ?crit :
We?re interested in scripting/automating some aspects of Slurm user
account provisioning and maintenance. Are there any examples or
tutorials available on leveraging the API, or using Python for such tasks?
I'm not sure what you're expecting here but FWIW we have this python script to
sync slurmdbd users/accounts with one POSIX group (typically with LDAP backend
through NSS):
https://na01.safelinks.protection.outlook.com/?url=https%3a%2f%2fgithub.com%2fedf-hpc%2fslurm-llnl-misc-plugins%2fblob%2fmaster%2fsync-accounts%2fslurm-sync-accounts&data=01%7c01%7cwschulz%40email.unc.edu%7c401409cdd9da4e25582d08d3910c4bee%7c58b3d54f16c942d3af081fcabd095666%7c1&sdata=in2Qj%2fMuyvMG1xniKFGwKdGKVxGuE6NvSCN9ZYG2yIw%3d
It's rather straight so you may tune easily it to fit your needs.
Best,
R?mi
Tom Payerle
IT-ETI-EUS [email protected]
4254 Stadium Dr (301) 405-6135
University of Maryland
College Park, MD 20742-4111