Skip to content

Commit 932cdcb

Browse files
Add a very large 'max.load' to SSH workers. It cannot be +Inf
1 parent 07decfc commit 932cdcb

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

R/BatchtoolsSSHFuture-class.R

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,25 @@
44
#' @export
55
BatchtoolsSSHFuture <- function(expr = NULL, substitute = TRUE, envir = parent.frame(), workers = availableCores(), ...) {
66
if (substitute) expr <- substitute(expr)
7+
assert_no_positional_args_but_first()
78

89
if (is.null(workers)) workers <- availableCores()
910
stopifnot(is.numeric(workers), length(workers) == 1L, !is.na(workers), is.finite(workers), workers >= 1L)
1011

1112
dotdotdot <- list(...)
1213

13-
ssh_worker <- list(Worker$new("localhost", ncpus = 1L))
14+
## WORKAROUND: 'max.load' cannot be +Inf, because that'll lead to:
15+
##
16+
## Error in sample.int(x, size, replace, prob) :
17+
## too few positive probabilities
18+
##
19+
## in the submitJob() function created by makeClusterFunctionsSSH().
20+
## /HB 2022-12-12
21+
ssh_worker <- list(Worker$new(
22+
"localhost",
23+
ncpus = 1L,
24+
max.load = .Machine$double.xmax ## +Inf fails
25+
))
1426

1527
keep <- which(names(dotdotdot) %in% names(formals(makeClusterFunctionsSSH)))
1628
args <- c(list(workers = ssh_worker), dotdotdot[keep])

0 commit comments

Comments
 (0)