This function imports the output of 'sinfo' into tibble, focusing on available vs. total CPUs and memory by either node or partition (depending on all_nodes).

partition_info(partition = "shared", all_nodes = FALSE)

Arguments

partition

A character(1) vector specifying the partition to show information about. Set NULL to return info about all partitions.

all_nodes

A logical(1) vector. When TRUE, return one row per node. When FALSE, summarize information over nodes and return one row per partition.

Value

A tibble with memory and CPU information about partitions.

See also

Other monitoring and informational functions: job_info(), job_report()

Author

Nicholas J. Eagles

Examples


#    Must be run in a SLURM environment where a 'shared' partition exists
if (system("which sbatch") == 0) {
    part_df <- partition_info(partition = "shared", all_nodes = FALSE)

    #    Print summary of CPU availability for the 'shared' partition
    print(
        sprintf(
            "The %s partition has %i CPUs free (%.1f%% of total)",
            part_df$partition,
            part_df$free_cpus,
            100 * part_df$prop_free_cpus
        )
    )
}