apps.utils.system_info
Utility class for fetching data and interacting with the parent system.
Module Contents
- class Shell
Methods for interacting with the runtime shell.
- static readchar() str
Read a single character from the command line
- Returns:
The character entered by the user
- static run_command(command: str, include_err: bool = False) str | Tuple[str, str]
Run a command in a dedicated shell
- Parameters:
command – The command to execute as a string
include_err – Include output to stderr in the returned values
- Returns:
The output to stdout and (optionally) stderr
- class Slurm
Class for fetching Slurm config data.
- ignore_clusters
- ignore_partitions
- static is_installed() bool
Return whether
sacctmgr
is installed on the host machine
- classmethod get_cluster_names(include_all_clusters: bool = False) Set[str]
Return cluster names configured with slurm
- Parameters:
include_all_clusters – Include clusters that are otherwise marked as ignored
- Returns:
A set of cluster names
- classmethod get_partition_names(cluster_name: str, include_all_partitions: bool = False) Set[str]
Return a tuple of partition names associated with a given slurm cluster
- Parameters:
cluster_name – The name of a slurm cluster
include_all_partitions – Include partitions that are otherwise marked as ignored
- Returns:
A set of partition names
- classmethod check_slurm_account_exists(account_name: str) None
Check if the provided slurm account exists
- classmethod get_cluster_usage_by_user(account_name: str, start_date: datetime.date, cluster: str) dict
Return the total billable usage in hours for a given Slurm account
- Parameters:
account_name – The name of the account to get usage for
start_date – date object for the start date to supply to sreport
cluster – The name of the cluster to get usage on
- Returns:
An integer representing the total (historical + current) billing TRES hours usage from sshare