From 303ad40c4d1e957823d51d6798b0ed7c9e841ecc Mon Sep 17 00:00:00 2001 From: Nick-Eagles <45461721+Nick-Eagles@users.noreply.github.com> Date: Tue, 10 Oct 2023 16:15:05 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20LieberIn?= =?UTF-8?q?stitute/slurmjobs@e7484695ac56f003e3aa77b91b0fcbda7585e14d=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- articles/slurmjobs.html | 63 ++++++++-------- pkgdown.yml | 2 +- reference/array_submit.html | 8 +-- reference/index.html | 8 +++ reference/job_info.html | 2 +- reference/job_info_df.html | 92 ++++++++++++++++++++++++ reference/partition_info.html | 132 ++++++++++++++++++++++++++++++++++ sitemap.xml | 6 ++ 8 files changed, 274 insertions(+), 39 deletions(-) create mode 100644 reference/job_info_df.html create mode 100644 reference/partition_info.html 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 @@

Leonardo University
lcolladotor@gmail.com -

6 October 2023

+

10 October 2023

Source: vignettes/slurmjobs.Rmd @@ -206,7 +206,7 @@

Creating Shell Scripts to 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

Analyzing Finished Jobs @@ -568,9 +565,9 @@

Reproducibilitylibrary("knitr") knit("slurmjobs.Rmd", tangle = TRUE)

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 @@

All functions job_info()

Return a tibble containing information about currently running jobs.

+ +

job_info_df

+ +

Example output from job_info(user = NULL, partition = "shared")

job_loop()

@@ -75,6 +79,10 @@

All functions job_single()

Build a SLURM job bash script

+ +

partition_info()

+ +

Return a tibble containing information about partitions.

with_wd()

diff --git a/reference/job_info.html b/reference/job_info.html index 92b09aa..27acb86 100644 --- a/reference/job_info.html +++ b/reference/job_info.html @@ -72,7 +72,7 @@

Arguments

partition

A character(1) vector specifying the partition of the jobs -to query. Set NULL to return info about jobs of all paritions.

+to query. Set NULL to return info about jobs of all partitions.

diff --git a/reference/job_info_df.html b/reference/job_info_df.html new file mode 100644 index 0000000..945e9a6 --- /dev/null +++ b/reference/job_info_df.html @@ -0,0 +1,92 @@ + +Example output from job_info(user = NULL, partition = "shared") — job_info_df • slurmjobs + + +
+
+ + + +
+
+ + +
+

A tibble with 100 rows and 10 columns describing currently running jobs (at +the time of creation)

+
+ +
+
job_info_df
+
+ +
+

Format

+

An object of class tbl_df (inherits from tbl, data.frame) with 100 rows and 10 columns.

+
+ +
+ +
+ + +
+ +
+

Site built with pkgdown 2.0.7.

+
+ +
+ + + + + + + + diff --git a/reference/partition_info.html b/reference/partition_info.html new file mode 100644 index 0000000..aa270cd --- /dev/null +++ b/reference/partition_info.html @@ -0,0 +1,132 @@ + +Return a tibble containing information about partitions. — partition_info • slurmjobs + + +
+
+ + + +
+
+ + +
+

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.

+
+
+

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
+        )
+    )
+}
+
+
+
+ +
+ + +
+ +
+

Site built with pkgdown 2.0.7.

+
+ +
+ + + + + + + + diff --git a/sitemap.xml b/sitemap.xml index d7f7d0b..59b7cf0 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -36,6 +36,9 @@ /reference/job_info.html + + /reference/job_info_df.html + /reference/job_loop.html @@ -45,6 +48,9 @@ /reference/job_single.html + + /reference/partition_info.html + /reference/with_wd.html