diff --git a/articles/slurmjobs.html b/articles/slurmjobs.html index 282eb35..9569a82 100644 --- a/articles/slurmjobs.html +++ b/articles/slurmjobs.html @@ -85,7 +85,7 @@
vignettes/slurmjobs.Rmd
slurmjobs.Rmd
sbatch
job_single(
name = "my_shell_script", memory = "10G", cores = 2, create_shell = FALSE
)
-#> 2023-10-06 17:45:47.665938 creating the logs directory at: logs
+#> 2023-10-10 16:14:48.792008 creating the logs directory at: logs
#> #!/bin/bash
#> #SBATCH -p shared
#> #SBATCH --mem-per-cpu=10G
@@ -249,7 +249,7 @@ Creating Shell Scripts to sbatch
name = "my_array_job", memory = "5G", cores = 1, create_shell = FALSE,
task_num = 10
)
-#> 2023-10-06 17:45:47.750433 creating the logs directory at: logs
+#> 2023-10-10 16:14:48.876895 creating the logs directory at: logs
#> #!/bin/bash
#> #SBATCH -p shared
#> #SBATCH --mem-per-cpu=5G
@@ -388,8 +388,8 @@ Submitting and Resubmitting Jobs name = "my_array_job", memory = "5G", cores = 1, create_shell = TRUE,
task_num = 10
)
-#> 2023-10-06 17:45:48.490543 creating the logs directory at: logs
-#> 2023-10-06 17:45:48.491992 creating the shell file my_array_job.sh
+#> 2023-10-10 16:14:49.664747 creating the logs directory at: logs
+#> 2023-10-10 16:14:49.6662 creating the shell file my_array_job.sh
#> To submit the job use: sbatch my_array_job.sh
# Suppose that tasks 3, 6, 7, and 8 failed
@@ -418,28 +418,25 @@ Monitoring Running Jobssstat -j [specific job ID]
.
On a SLURM system, you’d run
-job_df = job_info(user = NULL, partition = "shared")
here,
-to get every user’s jobs running on the “shared” partition. We’ll load
-an example output directly here.
+job_info_df = job_info(user = NULL, partition = "shared")
+here, to get every user’s jobs running on the “shared” partition. We’ll
+load an example output directly here.
# On a real SLURM system
-job_df <- readRDS(
- system.file("extdata", "job_info_df.rds", package = "slurmjobs")
-)
-print(job_df)
+print(job_info_df)
#> # A tibble: 100 × 10
#> job_id max_rss_gb max_vmem_gb user array_task_id name partition cpus
#> <dbl> <dbl> <dbl> <chr> <chr> <chr> <fct> <int>
-#> 1 158071 NA NA user1 6 my_job_1 shared 2
-#> 2 158072 NA NA user1 7 my_job_1 shared 2
-#> 3 158074 NA NA user1 9 my_job_1 shared 2
-#> 4 221130 NA NA user1 54 my_job_1 shared 2
-#> 5 221145 NA NA user1 4 my_job_2 shared 2
-#> 6 221148 NA NA user1 7 my_job_2 shared 2
-#> 7 221874 NA NA user1 57 my_job_1 shared 2
-#> 8 222104 NA NA user1 67 my_job_1 shared 2
-#> 9 222709 NA NA user1 74 my_job_3 shared 2
-#> 10 223262 NA NA user1 77 my_job_1 shared 2
+#> 1 220842 NA NA user1 NA my_job_1 shared 2
+#> 2 221913 NA NA user2 60 my_job_2 shared 2
+#> 3 221940 NA NA user2 61 my_job_2 shared 2
+#> 4 222446 NA NA user2 73 my_job_2 shared 2
+#> 5 225071 NA NA user2 84 my_job_2 shared 2
+#> 6 225430 NA NA user2 88 my_job_2 shared 2
+#> 7 226820 NA NA user2 94 my_job_2 shared 2
+#> 8 264086 NA NA user2 66 my_job_3 shared 1
+#> 9 265466 NA NA user2 67 my_job_3 shared 2
+#> 10 269608 NA NA user2 13 my_job_4 shared 2
#> # ℹ 90 more rows
#> # ℹ 2 more variables: requested_mem_gb <dbl>, status <fct>
The benefit to having this data in R, now, is to be able to trivially
@@ -448,9 +445,9 @@
Monitoring Running Jobs
-job_df |>
+job_info_df |>
# Or your username here
- filter(user == "user17") |>
+ filter(user == "user21") |>
# Get the number of CPUs requested and the memory requested in GB
summarize(
total_mem_req = sum(requested_mem_gb),
@@ -460,7 +457,7 @@ Monitoring Running Jobs#> # A tibble: 1 × 2
#> total_mem_req total_cpus
#> <dbl> <int>
-#> 1 24 4
+#> 1 60 2
Date the vignette was generated.
-#> [1] "2023-10-06 17:45:49 UTC"
+#> [1] "2023-10-10 16:14:50 UTC"
Wallclock time spent generating the vignette.
-#> Time difference of 2.726 secs
+#> Time difference of 2.77 secs
R
session information.
#> ─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────────
#> setting value
@@ -582,7 +579,7 @@ Reproducibility#> collate en_US.UTF-8
#> ctype en_US.UTF-8
#> tz UTC
-#> date 2023-10-06
+#> date 2023-10-10
#> pandoc 3.1.1 @ /usr/local/bin/ (via rmarkdown)
#>
#> ─ Packages ───────────────────────────────────────────────────────────────────────────────────────────────────────────
@@ -601,12 +598,12 @@ Reproducibility#> digest 0.6.33 2023-07-07 [2] RSPM (R 4.3.0)
#> dplyr * 1.1.3 2023-09-03 [1] RSPM (R 4.3.0)
#> evaluate 0.22 2023-09-29 [2] RSPM (R 4.3.0)
-#> fansi 1.0.4 2023-01-22 [2] RSPM (R 4.3.0)
+#> fansi 1.0.5 2023-10-08 [2] RSPM (R 4.3.0)
#> fastmap 1.1.1 2023-02-24 [2] RSPM (R 4.3.0)
#> fs 1.6.3 2023-07-20 [2] RSPM (R 4.3.0)
#> generics 0.1.3 2022-07-05 [1] RSPM (R 4.3.0)
#> glue 1.6.2 2022-02-24 [2] RSPM (R 4.3.0)
-#> htmltools 0.5.6 2023-08-10 [2] RSPM (R 4.3.0)
+#> htmltools 0.5.6.1 2023-10-06 [2] RSPM (R 4.3.0)
#> httr 1.4.7 2023-08-15 [2] RSPM (R 4.3.0)
#> jquerylib 0.1.4 2021-04-26 [2] RSPM (R 4.3.0)
#> jsonlite 1.8.7 2023-06-29 [2] RSPM (R 4.3.0)
@@ -630,11 +627,11 @@ Reproducibility#> rprojroot 2.0.3 2022-04-02 [2] RSPM (R 4.3.0)
#> sass 0.4.7 2023-07-15 [2] RSPM (R 4.3.0)
#> sessioninfo * 1.2.2 2021-12-06 [2] RSPM (R 4.3.0)
-#> slurmjobs * 0.99.0 2023-10-06 [1] local
+#> slurmjobs * 0.99.0 2023-10-10 [1] local
#> stringi 1.7.12 2023-01-11 [2] RSPM (R 4.3.0)
#> stringr 1.5.0 2022-12-02 [2] RSPM (R 4.3.0)
-#> systemfonts 1.0.4 2022-02-11 [2] RSPM (R 4.3.0)
-#> textshaping 0.3.6 2021-10-13 [2] RSPM (R 4.3.0)
+#> systemfonts 1.0.5 2023-10-09 [2] RSPM (R 4.3.0)
+#> textshaping 0.3.7 2023-10-09 [2] RSPM (R 4.3.0)
#> tibble 3.2.1 2023-03-20 [2] RSPM (R 4.3.0)
#> tidyselect 1.2.0 2022-10-10 [1] RSPM (R 4.3.0)
#> timechange 0.2.0 2023-01-11 [1] RSPM (R 4.3.0)
diff --git a/pkgdown.yml b/pkgdown.yml
index 25ea714..1a4f9c7 100644
--- a/pkgdown.yml
+++ b/pkgdown.yml
@@ -3,5 +3,5 @@ pkgdown: 2.0.7
pkgdown_sha: ~
articles:
slurmjobs: slurmjobs.html
-last_built: 2023-10-06T17:45Z
+last_built: 2023-10-10T16:14Z
diff --git a/reference/array_submit.html b/reference/array_submit.html
index 8ae8bdc..4ad1962 100644
--- a/reference/array_submit.html
+++ b/reference/array_submit.html
@@ -141,10 +141,10 @@ Examples
submit = FALSE
)
})
-#> 2023-10-06 17:45:44.124882 creating the logs directory at: logs
-#> 2023-10-06 17:45:44.126472 creating the shell file array_submit_example_2023-10-06.sh
-#> To submit the job use: sbatch array_submit_example_2023-10-06.sh
-#> [1] "array_submit_example_2023-10-06.sh"
+#> 2023-10-10 16:14:44.960887 creating the logs directory at: logs
+#> 2023-10-10 16:14:44.962572 creating the shell file array_submit_example_2023-10-10.sh
+#> To submit the job use: sbatch array_submit_example_2023-10-10.sh
+#> [1] "array_submit_example_2023-10-10.sh"
diff --git a/reference/index.html b/reference/index.html
index a871b22..1c6f12c 100644
--- a/reference/index.html
+++ b/reference/index.html
@@ -61,6 +61,10 @@ job_info()
Return a tibble containing information about currently running jobs.
Example output from job_info(user = NULL, partition = "shared")
job_single()
Build a SLURM job bash script
Return a tibble containing information about partitions.
A character(1)
vector specifying the partition of the jobs
-to query. Set NULL to return info about jobs of all paritions.
job_info(user = NULL, partition = "shared")
R/data.R
+ job_info_df.Rd
A tibble with 100 rows and 10 columns describing currently running jobs (at +the time of creation)
+job_info_df
An object of class tbl_df
(inherits from tbl
, data.frame
) with 100 rows and 10 columns.
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.
+
+# 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
+ )
+ )
+}
+