R/partition_info.R
partition_info.Rd
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)
A character(1)
vector specifying the partition to show
information about. Set NULL to return info about all partitions.
A logical(1)
vector. When TRUE, return one row per node.
When FALSE, summarize information over nodes and return one row per
partition.
A tibble with memory and CPU information about partitions.
Other monitoring and informational functions:
job_info()
,
job_report()
# 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
)
)
}