Skip to content

Commit

Permalink
updated cancel-job to remove %||% and also allow cancelling of config…
Browse files Browse the repository at this point in the history
…uring jobs.
  • Loading branch information
mduncans committed Nov 6, 2024
1 parent f063bc6 commit 4c54706
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions R/cancel-job.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' }
cancel_job <- function(job_id, user = NULL) {

current_user = Sys.getenv("USER") %||% Sys.info()['user']
current_user = if (is.null(Sys.getenv("USER"))) Sys.info()['user'] else Sys.getenv("USER")

if (!is.null(user) && user != current_user) {
cat("The supplied user does not match the current user.\n")
Expand All @@ -35,8 +35,7 @@ cancel_job <- function(job_id, user = NULL) {
}

job_id_filtered <- jobs %>% dplyr::filter(.data$job_id == .env$job_id)
print(job_id_filtered)
if (job_id_filtered$job_state != "RUNNING") {
if (!job_id_filtered$job_state %in% c("RUNNING", "CONFIGURING")) {
stop(paste0("Job: ", job_id, " is not running"))
}

Expand Down

0 comments on commit 4c54706

Please sign in to comment.