database.client.pis

Mixin class for databse client with PI related functions

class accre.database.client.pis.DBClientPIMixin[source]

Bases: object

Functionality related to PIs

add_pi(*, vunetid, name, department, division, organization, email, join_date=None)[source]

Add a new principle investigator 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:
  • vunetid (str) – VUNetID of the PI

  • 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

  • email (str) – Email address of the PI

  • join_date (datetime.datetime) – Date that the PI joined the cluster, defaults to the current date

add_pi_log(vunetid, comment, log_date=None)[source]

Add an entry to the given pi’s log.

Parameters:
  • vunetid (str) – vunetid of the pi

  • comment (str) – entry to add to the log

  • log_date (datetime.datetime) – Date to use for the log entry, defaults to the current date.

all_pis_info(assets=False)[source]

Fetch information about all principle investigators

Parameters:

assets (bool) – If true, return list of pi accounts and groups for each pi

Returns:

Information about all principle investigators

Return type:

list(dict)

get_pi_logs(vunetid)[source]

Fetch pi logs for a given vunetid sorted by newest first

Parameters:

vunetid (str) –

Returns:

list of all pi log dates and comments for the vunetid

Return type:

list(tuple(datetime.datetime, comment))

list_pis(active=False)[source]

List all PIs in the databse, or all active PIs.

Parameters:

active (bool) – List only active PIs if set to true

Returns:

List of PI ids

Return type:

list(str)

modify_pi(vunetid, reason=None, log_date=None, **updates)[source]

Modify one or more fields of an existing ACCRE pi and log the change with an optional reason.

Parameters:
  • vunetid (str) – VUNetID of the pi

  • 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

pi_exists(vunetid)[source]

Return true if the specified PI exists in the database

Parameters:

vunetid (str) – VUNetID for the ACCRE PI to be queried

Returns:

True if the PI is found in the database

Return type:

bool

pi_info(vunetid)[source]

Fetch information about a principle investigator by VUNetID

Parameters:

vunetid (str) – VUNetID of the principle investigator

Returns:

Information about the principle investigator

Return type:

dict