diff --git a/articles/slurmjobs.html b/articles/slurmjobs.html index 9569a82..21d3c62 100644 --- a/articles/slurmjobs.html +++ b/articles/slurmjobs.html @@ -206,7 +206,7 @@

Creating Shell Scripts to sbatch job_single( name = "my_shell_script", memory = "10G", cores = 2, create_shell = FALSE ) -#> 2023-10-10 16:14:48.792008 creating the logs directory at: logs +#> 2023-10-10 17:29:56.073699 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-10 16:14:48.876895 creating the logs directory at: logs +#> 2023-10-10 17:29:56.172312 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-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 +#> 2023-10-10 17:29:57.081484 creating the logs directory at: logs +#> 2023-10-10 17:29:57.083036 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 @@ -460,6 +460,56 @@

Monitoring Running Jobs#> 1 60 2
+

Monitoring Partitions +

+

Sometimes, it’s useful to know about the partitions as a whole rather +than about specific jobs. partition_info() serves this +purpose, and parses sinfo output into a +tibble. We’ll load an example of the output from +partition_info(partition = NULL, all_nodes = FALSE).

+
+print(partition_df)
+#> # A tibble: 5 × 7
+#>   partition   free_cpus total_cpus prop_free_cpus free_mem_gb total_mem_gb
+#>   <chr>           <int>      <int>          <dbl>       <dbl>        <dbl>
+#> 1 partition_1        48         48          1            126.         128.
+#> 2 partition_2       324        384          0.844       1050.        1643.
+#> 3 partition_3        48         48          1            127.         128.
+#> 4 partition_4       412       1024          0.402       2806.        4126.
+#> 5 partition_5        76        128          0.594        519.        1000.
+#> # ℹ 1 more variable: prop_free_mem_gb <dbl>
+

Since all_nodes was FALSE, there’s one row +per partition, summarizing information across all nodes that compose +each partition. Alternatively, set all_nodes to +TRUE to yield one row per node.

+

With partition_df, let’s summarize how busy the cluster +is as a whole, then rank partitions by amount of free memory.

+
+#   Print the proportion of CPUs and memory available for the whole cluster
+partition_df |>
+    summarize(
+        prop_free_cpus = sum(free_cpus) / sum(total_cpus),
+        prop_free_mem_gb = sum(free_mem_gb) / sum(total_mem_gb)
+    ) |>
+    print()
+#> # A tibble: 1 × 2
+#>   prop_free_cpus prop_free_mem_gb
+#>            <dbl>            <dbl>
+#> 1          0.556            0.659
+
+#   Now let's take the top 3 partitions by memory currently available
+partition_df |>
+    arrange(desc(free_mem_gb)) |>
+    select(partition, free_mem_gb) |>
+    slice_head(n = 3)
+#> # A tibble: 3 × 2
+#>   partition   free_mem_gb
+#>   <chr>             <dbl>
+#> 1 partition_4       2806.
+#> 2 partition_2       1050.
+#> 3 partition_5        519.
+
+

Analyzing Finished Jobs

The job_report() function returns in-depth information @@ -480,7 +530,7 @@

Analyzing Finished Jobsjob_report as available in the slurmjobs package.

-
+
 

Now let’s choose a better memory request:

-
+
 stat_df <- job_df |>
     #   This example includes tasks that fail. We're only interested in memory
     #   for successfully completed tasks
@@ -556,7 +606,7 @@ 

Reproducibility

This package was developed using biocthis.

Code for creating the vignette

-
+
 ## Create the vignette
 library("rmarkdown")
 system.time(render("slurmjobs.Rmd", "BiocStyle::html_document"))
@@ -565,9 +615,9 @@ 

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

Date the vignette was generated.

-
#> [1] "2023-10-10 16:14:50 UTC"
+
#> [1] "2023-10-10 17:29:58 UTC"

Wallclock time spent generating the vignette.

-
#> Time difference of 2.77 secs
+
#> Time difference of 3.398 secs

R session information.

#> ─ Session info ───────────────────────────────────────────────────────────────────────────────────────────────────────
 #>  setting  value
@@ -637,6 +687,7 @@ 

Reproducibility#> timechange 0.2.0 2023-01-11 [1] RSPM (R 4.3.0) #> utf8 1.2.3 2023-01-31 [2] RSPM (R 4.3.0) #> vctrs 0.6.3 2023-06-14 [2] RSPM (R 4.3.0) +#> withr 2.5.1 2023-09-26 [2] RSPM (R 4.3.0) #> xfun 0.40 2023-08-09 [2] RSPM (R 4.3.0) #> xml2 1.3.5 2023-07-06 [2] RSPM (R 4.3.0) #> yaml 2.3.7 2023-01-23 [2] RSPM (R 4.3.0) diff --git a/pkgdown.yml b/pkgdown.yml index 1a4f9c7..b4b670d 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-10T16:14Z +last_built: 2023-10-10T17:29Z diff --git a/reference/array_submit.html b/reference/array_submit.html index 4ad1962..38e8651 100644 --- a/reference/array_submit.html +++ b/reference/array_submit.html @@ -141,8 +141,8 @@

Examples

submit = FALSE ) }) -#> 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 +#> 2023-10-10 17:29:51.568844 creating the logs directory at: logs +#> 2023-10-10 17:29:51.570559 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 1c6f12c..3a78654 100644 --- a/reference/index.html +++ b/reference/index.html @@ -79,6 +79,10 @@

All functions job_single()

Build a SLURM job bash script

+ +

partition_df

+ +

Example output from partition_info(partition = NULL, all_nodes = FALSE)

partition_info()

diff --git a/reference/partition_df.html b/reference/partition_df.html new file mode 100644 index 0000000..5f0f86a --- /dev/null +++ b/reference/partition_df.html @@ -0,0 +1,92 @@ + +Example output from partition_info(partition = NULL, all_nodes = FALSE) — partition_df • slurmjobs + + +
+
+ + + +
+
+ + +
+

A tibble with 5 rows and 7 columns giving information about memory and CPUs +as available at the time of creation)

+
+ +
+
partition_df
+
+ +
+

Format

+

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

+
+ +
+ +
+ + +
+ +
+

Site built with pkgdown 2.0.7.

+
+ +
+ + + + + + + + diff --git a/sitemap.xml b/sitemap.xml index 59b7cf0..0ab055b 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -48,6 +48,9 @@ /reference/job_single.html + + /reference/partition_df.html + /reference/partition_info.html