Skip to content

Commit

Permalink
Codefactor
Browse files Browse the repository at this point in the history
  • Loading branch information
weshinsley committed Jul 5, 2024
1 parent 3a1ea0c commit 7cd2bb5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions R/task-purge.R
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
##' use are `created`, `success`, `failure` and `cancelled` (note
##' you cannot select tasks with status of `submitted` or `running`;
##' use [task_cancel] for these first).
##'
##'
##' @param dry_run If TRUE, report what would have been done, but
##' no changes will be made.
##'
Expand Down Expand Up @@ -126,15 +126,15 @@ hipercow_purge <- function(task_ids = NULL,
}

cli::cli_alert_info("Purging {length(ids)} task{?s}")
maybe_unlink(path_task(root$path$tasks, ids), recursive = TRUE,
maybe_unlink(path_task(root$path$tasks, ids), recursive = TRUE,
dry_run = dry_run)

nms <- dir(root$path$bundles)
contents <- lapply(nms, hipercow_bundle_load, root)
to_delete <- vlapply(contents, function(x) any(ids %in% x$ids))
if (any(to_delete)) {
cli::cli_alert_info("Deleting {sum(to_delete)} task bundle{?s}")
maybe_unlink(file.path(root$path$bundles, nms[to_delete]),
maybe_unlink(file.path(root$path$bundles, nms[to_delete]),
dry_run = dry_run)
} else {
cli::cli_alert_info("No task bundles need deleting")
Expand Down

0 comments on commit 7cd2bb5

Please sign in to comment.