From 3a5220bc00bd82266bef7a6b351d91d4f657f065 Mon Sep 17 00:00:00 2001 From: wlandau Date: Wed, 10 Apr 2024 08:18:46 -0400 Subject: [PATCH] Fix checks --- DESCRIPTION | 2 +- NAMESPACE | 1 + NEWS.md | 2 +- R/crew_monitor_slurm.R | 20 ++++++++++++-------- R/crew_package.R | 1 + _pkgdown.yml | 2 ++ man/crew_class_monitor_slurm.Rd | 14 +++++++++----- 7 files changed, 27 insertions(+), 15 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 4713983..4b2b44c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -67,4 +67,4 @@ Encoding: UTF-8 Language: en-US Config/testthat/edition: 3 Roxygen: list(markdown = TRUE) -RoxygenNote: 7.3.0 +RoxygenNote: 7.3.1 diff --git a/NAMESPACE b/NAMESPACE index 037968f..5279bd0 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -35,3 +35,4 @@ importFrom(utils,globalVariables) importFrom(vctrs,vec_rbind) importFrom(xml2,as_list) importFrom(xml2,xml_find_all) +importFrom(yaml,read_yaml) diff --git a/NEWS.md b/NEWS.md index bb471aa..9a38569 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,6 @@ # crew.cluster 0.3.0.9000 -* Add a "monitor" class for SLURM clusters. +* Add a monitor class for SLURM clusters. # crew.cluster 0.3.0 diff --git a/R/crew_monitor_slurm.R b/R/crew_monitor_slurm.R index a68826c..f49ffbb 100644 --- a/R/crew_monitor_slurm.R +++ b/R/crew_monitor_slurm.R @@ -28,11 +28,12 @@ crew_class_monitor_slurm <- R6::R6Class( cloneable = FALSE, public = list( #' @description List SLURM jobs. - #' - #' This function loads the entire SLURM queue for all users, so it may take - #' several seconds to execute. It is intended for interactive use, and - #' should especially be avoided in scripts where it is called frequently. - #' It requires SLURM version 20.02 or higher, along with the YAML plugin. + #' @details This function loads the entire SLURM queue for all users, + #' so it may take several seconds to execute. + #' It is intended for interactive use, and + #' should especially be avoided in scripts where it is called + #' frequently. It requires SLURM version 20.02 or higher, + #' along with the YAML plugin. #' @return A `tibble` with one row per SLURM job and columns with #' specific details. #' @param user Character of length 1, user name of the jobs to list. @@ -64,14 +65,17 @@ crew_class_monitor_slurm <- R6::R6Class( c( map(.x[monitor_cols], ~ unlist(.x) %||% NA), list( - nodes = paste(unlist(.x$job_resources$nodes), collapse = ",") %||% NA + nodes = paste( + unlist(.x$job_resources$nodes), + collapse = "," + ) %||% NA ) ) ) ) out <- do.call(vctrs::vec_rbind, out) - out <- out[out$user_name == user,] - out <- out[which(out$job_state != "CANCELLED"),] + out <- out[out$user_name == user, ] + out <- out[which(out$job_state != "CANCELLED"), ] out$job_id <- as.character(out$job_id) out$start_time <- as.POSIXct(out$start_time, origin = "1970-01-01") out diff --git a/R/crew_package.R b/R/crew_package.R index 955d065..b2238b9 100644 --- a/R/crew_package.R +++ b/R/crew_package.R @@ -35,6 +35,7 @@ #' @importFrom vctrs vec_rbind #' @importFrom utils globalVariables #' @importFrom xml2 as_list xml_find_all +#' @importFrom yaml read_yaml NULL utils::globalVariables(".") diff --git a/_pkgdown.yml b/_pkgdown.yml index 17b9a2e..7eb5436 100644 --- a/_pkgdown.yml +++ b/_pkgdown.yml @@ -27,3 +27,5 @@ reference: - 'crew_controller_slurm' - 'crew_launcher_slurm' - 'crew_class_launcher_slurm' + - 'crew_monitor_slurm' + - 'crew_class_monitor_slurm' diff --git a/man/crew_class_monitor_slurm.Rd b/man/crew_class_monitor_slurm.Rd index 6a46fc6..0ede8a0 100644 --- a/man/crew_class_monitor_slurm.Rd +++ b/man/crew_class_monitor_slurm.Rd @@ -40,11 +40,6 @@ Other slurm: \if{latex}{\out{\hypertarget{method-crew_class_monitor_slurm-jobs}{}}} \subsection{Method \code{jobs()}}{ List SLURM jobs. - -This function loads the entire SLURM queue for all users, so it may take -several seconds to execute. It is intended for interactive use, and -should especially be avoided in scripts where it is called frequently. -It requires SLURM version 20.02 or higher, along with the YAML plugin. \subsection{Usage}{ \if{html}{\out{
}}\preformatted{crew_class_monitor_slurm$jobs(user = ps::ps_username())}\if{html}{\out{
}} } @@ -56,6 +51,15 @@ It requires SLURM version 20.02 or higher, along with the YAML plugin. } \if{html}{\out{}} } +\subsection{Details}{ +This function loads the entire SLURM queue for all users, +so it may take several seconds to execute. +It is intended for interactive use, and +should especially be avoided in scripts where it is called +frequently. It requires SLURM version 20.02 or higher, +along with the YAML plugin. +} + \subsection{Returns}{ A \code{tibble} with one row per SLURM job and columns with specific details.