From 06f755c93b2fd3cdb81769def1a79ad4a1857fd1 Mon Sep 17 00:00:00 2001 From: Nick-Eagles Date: Fri, 27 Oct 2023 16:07:35 -0400 Subject: [PATCH] Add a new 'wallclock_time' column to the output of 'job_report()'; change 'elapsed_time' to 'wallclock_time' for 'job_info()' for consistency --- R/job_info.R | 2 +- R/job_report.R | 9 ++++++--- data/job_info_df.rda | Bin 2343 -> 2203 bytes man/job_info_df.Rd | 2 +- tests/testthat/test-job_info.R | 4 ++-- tests/testthat/test-job_report.R | 3 ++- 6 files changed, 12 insertions(+), 8 deletions(-) diff --git a/R/job_info.R b/R/job_info.R index 5aa0b4c..74b5c6e 100644 --- a/R/job_info.R +++ b/R/job_info.R @@ -55,7 +55,7 @@ job_info <- function(user = Sys.getenv("USER"), partition = "shared") { PARTITION = as.factor(PARTITION), STATUS = as.factor(ST), JOB_ID = as.integer(JOBID), - ELAPSED_TIME = parse_slurm_time(TIME) + WALLCLOCK_TIME = parse_slurm_time(TIME) ) |> rename(REQUESTED_MEM_GB = MIN_MEMORY) |> select(-c(ST, JOBID, TIME)) diff --git a/R/job_report.R b/R/job_report.R index c59821d..5ab876a 100644 --- a/R/job_report.R +++ b/R/job_report.R @@ -8,7 +8,7 @@ #' @return A tibble with information about the requested job. #' @export #' @author Nicholas J. Eagles -#' @import dplyr stringr utils +#' @import dplyr stringr utils lubridate #' #' @family monitoring and informational functions #' @@ -25,7 +25,7 @@ job_report <- function(job_id) { job_df <- read.csv( text = system( sprintf( - 'sacct -j %s -P -o "JobID,JobIDRaw,User,JobName,Partition,AllocCPUS,ReqMem,State,MaxRSS,MaxVMSize,ExitCode" --units=G', + 'sacct -j %s -P -o "JobID,JobIDRaw,User,JobName,Partition,AllocCPUS,ReqMem,State,MaxRSS,MaxVMSize,ExitCode,ElapsedRaw" --units=G', job_id ), intern = TRUE @@ -161,6 +161,9 @@ job_report <- function(job_id) { exit_code = as.integer( str_extract(ExitCode, "^([0-9]+):", group = 1) ), + wallclock_time = ElapsedRaw |> + seconds() |> + as.difftime(), # Some character columns should be factors Partition = as.factor(Partition), status = as.factor(State) @@ -174,7 +177,7 @@ job_report <- function(job_id) { max_vmem_gb = MaxVMSize, max_rss_gb = MaxRSS, ) |> - select(-c(State, job_step, JobIDRaw, ExitCode)) + select(-c(State, job_step, JobIDRaw, ExitCode, ElapsedRaw)) colnames(job_df) <- tolower(colnames(job_df)) # Given a character vector containing an amount of memory (containing diff --git a/data/job_info_df.rda b/data/job_info_df.rda index 0fd64d201c9e7c75fd139a9ec008abb233f99156..77f358e213201491c0b807a21c862cbdd2c7a4f7 100644 GIT binary patch literal 2203 zcmV;M2xRv{T4*^jL0KkKS^B7QB>)l)fB*mg{r&%U|Mma(|7-vM|NZ}4ZB*NS^j-h| zb^o>R(cRz&z3ls=N{g8AUP(+L~&5X)!eQG|1YGG6ANZqednpOd+&} zfCs6d4FCojo{-UyXaL9n28{zvFhCegX`~PahK&HwG8!@lOn@+kO#@8;41*xZ05Adr zKmY-zfB+2|0000005eHEqu!+frhotd000000000000000000000000000fC83O!F# z)Ose`rpXMMp%^AK4K$iCo|6+JA%KRSK#x!`j7*IlfJ}x2FaeNFG}8pg&@x~KfdFU# zJrhQNXlNQV&<2K@XaLcsfuI9G02&OM84Umc(9xqn&@0079zh!IHuB*6wurkI61 z)Y=nC>TN*u(LF;((^2XhPy^Ix0L?={Jw}=UGynj|9;TW-Kxi}?X`nO#qtxpFfqbGW z*!QCvX*oQWyN@Z}Pcm-i>Y}sW_;l73wAXLT@BfuPnXB=VtpW`N2sZBzA1f?Ac8TDc zt=q`D{eoNulXLeHc(jbL05a~P1DqQObuzS7&n#sm=I&qnWM~{)TzxPbWqlt7zfd8b zzN>RJ6*K3Sb)9@~o=n`Tp@HOn?uiC?EY-DAq1$N?>S=_4k1_eWW||r6do)uv$Bq3= z2)ald97r6;$m!T|{d$L$@lx%8u8E}uTU1ZiTuYbH?WRm>)<*m`-CI#m$FL`V)~DBFaP0@*~eiL9onrQ|opRm8-A z2?99-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}@} za4|+TQc@xacZeDO_jTM+RW1WDPM(He#s}X5DlEemPHEb65h*p0w|HP=MSpDh2Lu$GJi9IV=X5M`P0+g`fczPG{RBK#B}b zOgzjGYWA>6iCOt(@=W?DoxB1k$u{H(Ak;f18W3^_0rETtUkp7A$(3s0LM-0}Lp9y37l+ufFi|=rADF{y&gVieOr~kVFX_{ev)* zDd)s^ywqs5h!xYu0<0>{8De_0b#^KeNZfCCw#*h@OLQF>ubXewpr`|4%-2MzMdTe4 z47nq&BI%%kK-t5(h}+AKTX!+Q5Xq3410(|p8aE}1w`7h!e7nuOq#F$E%RRPSh13*9 z11#IEU^kjz0?dQOW@6jh<%lXxtti>Afd(8lj#&p}gW@nCOxUj2 zfV=SCg7iTTac8bR01cY$IPlpF5glGj2IBEV zP(`w2%p#CCrn(4fUzNlfF#x_Kz%ofPNlRn{XBD_KkV5xIGl@yDvtSUw$t`gthRm;s znZfbgLmuCPPzBq?zf)s%9uKzPt@{x=@JSbZHxdQ74c@c++tE@({Nrq=jwp;(z{31t z2P|=}P~e4pDHjquxW7p$B@7Cr5i&(9euQ4CZWs|M>^Y59@f$FUO3R_UDORd{{H)Rv zeK{s#1OPAKa-vS$>mE5+yKoNjUXXB?ey0@I0Zi3ou!j9Jd}X5_SMh Nxgwk>NF^Rt!GIl&2HF4s diff --git a/man/job_info_df.Rd b/man/job_info_df.Rd index b58242d..27d9e49 100644 --- a/man/job_info_df.Rd +++ b/man/job_info_df.Rd @@ -5,7 +5,7 @@ \alias{job_info_df} \title{Example output from \code{job_info(user = NULL, partition = "shared")}} \format{ -An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 100 rows and 10 columns. +An object of class \code{tbl_df} (inherits from \code{tbl}, \code{data.frame}) with 100 rows and 11 columns. } \usage{ job_info_df diff --git a/tests/testthat/test-job_info.R b/tests/testthat/test-job_info.R index b629899..dd9a17d 100644 --- a/tests/testthat/test-job_info.R +++ b/tests/testthat/test-job_info.R @@ -21,7 +21,7 @@ test_that( any_other_na <- job_df |> select( job_id, user, name, partition, cpus, requested_mem_gb, status, - elapsed_time + wallclock_time ) |> is.na() |> any() @@ -48,7 +48,7 @@ test_that( user = "character", array_task_id = "integer", name = "character", partition = "factor", cpus = "integer", requested_mem_gb = "numeric", status = "factor", - elapsed_time = "difftime" + wallclock_time = "difftime" ) expected_types <- unname(expected_types[colnames(job_df)]) diff --git a/tests/testthat/test-job_report.R b/tests/testthat/test-job_report.R index 0c2c3ac..39308d3 100644 --- a/tests/testthat/test-job_report.R +++ b/tests/testthat/test-job_report.R @@ -19,7 +19,8 @@ test_that( cpus = "integer", requested_mem_gb = "numeric", max_rss_gb = "numeric", max_vmem_gb = "numeric", partition = "factor", array_task_id = "integer", - exit_code = "integer", status = "factor" + exit_code = "integer", status = "factor", + wallclock_time = "difftime" ) expected_types <- unname(expected_types[colnames(job_df)])