database.client.parent_accounts¶
Mixin class for databse client with parent account related functions
- class accre.database.client.parent_accounts.DBClientParentAccountMixin[source]¶
Bases:
object
Functionality related to slurm parent accounts
- account_info(name)[source]¶
Retrieve general information for an ACCRE adminstrative account including all PI VUNetIDs
- Parameters:
name (str) – ACCRE account to be queried
- Returns:
General account information
- Return type:
dict
- add_account(*, name, department, division, organization, pis, scheduler_account=True, fairshare=1, max_cpu=None, max_mem=None, max_runmins=None, qos='normal', active=True, join_date=None)[source]¶
Add a new administrative account to the database. The dept/div/org triplet must be a valid combination, i.e. the division must be a member of the organization.
- Parameters:
name (str) – The name of the account
department (str) – Name of the department, must be a department already in the database
division (str) – Name of the division, must be a division already in the database
organization (str) – Name of the organization, must be an organization already in the database
pis (list(str)) – A list of PI vunetids. Typically one PI. Can be an empty list for an account with no PI.
scheduler_account (bool) – True if this account should exist on the cluster job scheduler
fairshare (int) – Scheduler fairshare for the account
max_cpu (int) – Maximum running CPU cores for the account
max_mem (str) – Maximum running memory for the account, should be of the form “100G” or “10800M”
max_runmins (int) – Maximum running scheduled cpu minutes for the account
qos (str) – Scheduler QOS for the account
active (bool) – True for accounts currently using the cluster or being billed for services
join_date (datetime.datetime) – Date that the PI joined the cluster, defaults to the current date
- add_account_log(name, comment, log_date=None)[source]¶
Add an entry to the given business account’s log.
- Parameters:
name (str) – name of the account
comment (str) – entry to add to the log
log_date (datetime.datetime) – Date to use for the log entry, defaults to the current date.
- add_account_pis(name, *pis, reason=None, log_date=None)[source]¶
Add specified pis to a business account
- Parameters:
name (str) – business account to add pi(s) to
pis (str) – pis to add to the account
reason (str) – explanation of the change for logging
log_date (datetime.datetime) – Date to use for the log entry, defaults to the current date.
- all_accounts_info(limit=None, offset=None)[source]¶
Retrieve general information for all ACCRE adminstrative accounts NOT including PIs associated with the account.
- Parameters:
limit (int) – Maximum number of records to return, return all if None
offset (int) – Offset from first record to begin list of records, start at the first record if None
- Returns:
General account information for all accounts
- Return type:
list(dict)
- get_account_logs(name)[source]¶
Fetch user logs for a given business account sorted by newest first
- Parameters:
name (str) – business account name
- Returns:
list of all account log dates and comments for the account
- Return type:
list(tuple(datetime.datetime, comment))
- list_accounts(active=False)[source]¶
List all accounts in the databse, or all active accounts.
- Parameters:
active (bool) – List only active accounts if set to true
- Returns:
List of account ids
- Return type:
list(str)
- modify_account(account, reason=None, log_date=None, **updates)[source]¶
Modify one or more fields of an existing ACCRE account and log the change with an optional reason.
- Parameters:
account (str) – Name of the account
reason (str) – Explanation of the change to be logged
updates (dict) – Columns to be updated with their values
log_date (datetime.datetime) – Date to log the user modification, defaults to the current date
- remove_account_pis(name, *pis, reason=None, log_date=None)[source]¶
Remove specified pis from a business account
- Parameters:
name (str) – business account remove add pi(s) from
pis (str) – pis to remove from the account
reason (str) – explanation of the change for logging
log_date (datetime.datetime) – Date to use for the log entry, defaults to the current date.