Skip to content

Commit cfa4982

Browse files
CLEANUP: Use Sys.info() for HPC backends, and Sys.getpid() for localhost ones
1 parent ae51852 commit cfa4982

24 files changed

+94
-169
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Package: future.batchtools
2-
Version: 0.12.2-9938
2+
Version: 0.12.2-9939
33
Depends:
44
R (>= 3.2.0),
55
parallelly,

R/batchtools_bash.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ BatchtoolsBashFutureBackend <- function(...,
5555
#' `r paste(c("\x60\x60\x60bash", readLines("inst/templates/bash.tmpl"), "\x60\x60\x60"), collapse = "\n")`
5656
#'
5757
#' @examplesIf interactive()
58+
#' library(future)
5859
#' # Limit runtime to 30 seconds per future
5960
#' plan(batchtools_bash, resources = list(runtime = 30))
6061
#'

R/batchtools_custom.R

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,23 @@
66
#'
77
#' @return An object of class `BatchtoolsFuture`.
88
#'
9-
#' @example incl/batchtools_custom.R
9+
#' @examplesIf interactive()
10+
#' library(future)
11+
#'
12+
#' ## Create custom cluster functions (here same as "local")
13+
#' cf <- batchtools::makeClusterFunctionsInteractive(external = TRUE)
14+
#' print(cf)
15+
#' str(cf)
16+
#'
17+
#' # Use custom batchtools backend
18+
#' plan(future.batchtools::batchtools_custom, cluster.functions = cf)
19+
#' print(plan())
20+
#'
21+
#' message("Main process ID: ", Sys.getpid())
22+
#'
23+
#' f <- future(Sys.getpid())
24+
#' pid <- value(f)
25+
#' message("Worker process ID: ", pid)
1026
#'
1127
#' @rdname BatchtoolsFutureBackend
1228
#' @keywords internal

R/batchtools_local.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ BatchtoolsLocalFutureBackend <- function(fs.latency = 0.0, ...) {
6969
#' `plan(future::cluster, workers = I(1))`.
7070
#'
7171
#' @examples
72+
#' library(future)
7273
#' plan(future.batchtools::batchtools_local)
7374
#'
7475
#' message("Main process ID: ", Sys.getpid())

R/batchtools_lsf.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ BatchtoolsLsfFutureBackend <- function(...) {
3535
#' `r paste(c("\x60\x60\x60bash", readLines("inst/templates/lsf.tmpl"), "\x60\x60\x60"), collapse = "\n")`
3636
#'
3737
#' @examplesIf interactive()
38+
#' library(future)
39+
#'
3840
#' # Limit runtime to 3 minutes and memory to 200 MiB per future
3941
#' plan(future.batchtools::batchtools_lsf, resources = list(W = "00:03:00", M = "200"))
4042
#'
41-
#' message("Main process ID: ", Sys.getpid())
42-
#'
43-
#' f <- future(Sys.getpid())
44-
#' pid <- value(f)
45-
#' message("Worker process ID: ", pid)
43+
#' f <- future(Sys.info())
44+
#' info <- value(f)
45+
#' print(info)
4646
#'
4747
#' @references
4848
#' * <https://en.wikipedia.org/wiki/IBM_Spectrum_LSF>

R/batchtools_multicore.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@ BatchtoolsMulticoreFutureBackend <- function(workers = availableCores(constraint
8888
#' `plan(future::multicore)`.
8989
#'
9090
#' @examples
91+
#' library(future)
9192
#' plan(future.batchtools::batchtools_multicore, workers = 2)
9293
#'
9394
#' message("Main process ID: ", Sys.getpid())

R/batchtools_openlava.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ BatchtoolsOpenLavaFutureBackend <- function(...) {
3535
#' `r paste(c("\x60\x60\x60bash", readLines("inst/templates/openlava.tmpl"), "\x60\x60\x60"), collapse = "\n")`
3636
#'
3737
#' @examplesIf interactive()
38+
#' library(future)
39+
#'
3840
#' # Limit runtime to 3 minutes and memory to 200 MiB per future
3941
#' plan(future.batchtools::batchtools_lsf, resources = list(W = "00:03:00", M = "200"))
4042
#'
41-
#' message("Main process ID: ", Sys.getpid())
42-
#'
43-
#' f <- future(Sys.getpid())
44-
#' pid <- value(f)
45-
#' message("Worker process ID: ", pid)
43+
#' f <- future(Sys.info())
44+
#' info <- value(f)
45+
#' print(info)
4646
#'
4747
#' @references
4848
#' * <https://en.wikipedia.org/wiki/OpenLava>

R/batchtools_sge.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ BatchtoolsSGEFutureBackend <- function(...) {
3434
#' `r paste(c("\x60\x60\x60bash", readLines("inst/templates/sge.tmpl"), "\x60\x60\x60"), collapse = "\n")`
3535
#'
3636
#' @examplesIf interactive()
37+
#' library(future)
38+
#'
3739
#' # Limit runtime to 3 minutes and memory to 200 MiB per future
3840
#' plan(future.batchtools::batchtools_sge, resources = list(h_rt = "00:03:00", mem_free = "200M"))
3941
#'
40-
#' message("Main process ID: ", Sys.getpid())
41-
#'
42-
#' f <- future(Sys.getpid())
43-
#' pid <- value(f)
44-
#' message("Worker process ID: ", pid)
42+
#' f <- future(Sys.info())
43+
#' info <- value(f)
44+
#' print(info)
4545
#'
4646
#' @references
4747
#' * <https://en.wikipedia.org/wiki/Oracle_Grid_Engine>

R/batchtools_slurm.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,14 @@ BatchtoolsSlurmFutureBackend <- function(...) {
3535
#' `r paste(c("\x60\x60\x60bash", readLines("inst/templates/slurm.tmpl"), "\x60\x60\x60"), collapse = "\n")`
3636
#'
3737
#' @examplesIf interactive()
38+
#' library(future)
39+
#'
3840
#' # Limit runtime to 3 minutes and memory to 200 MiB per future
3941
#' plan(future.batchtools::batchtools_slurm, resources = list(time = "00:03:00", mem = "200M"))
4042
#'
41-
#' message("Main process ID: ", Sys.getpid())
42-
#'
43-
#' f <- future(Sys.getpid())
44-
#' pid <- value(f)
45-
#' message("Worker process ID: ", pid)
43+
#' f <- future(Sys.info())
44+
#' info <- value(f)
45+
#' print(info)
4646
#'
4747
#' @references
4848
#' * <https://en.wikipedia.org/wiki/Slurm_Workload_Manager>

R/batchtools_torque.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ BatchtoolsTorqueFutureBackend <- function(...) {
3434
#' `r paste(c("\x60\x60\x60bash", readLines("inst/templates/torque.tmpl"), "\x60\x60\x60"), collapse = "\n")`
3535
#'
3636
#' @examplesIf interactive()
37+
#' library(future)
38+
#'
3739
#' # Limit runtime to 3 minutes and memory to 200 MiB per future
3840
#' plan(future.batchtools::batchtools_torque, resources = list(walltime = "00:03:00", mem = "200mb"))
3941
#'
40-
#' message("Main process ID: ", Sys.getpid())
41-
#'
42-
#' f <- future(Sys.getpid())
43-
#' pid <- value(f)
44-
#' message("Worker process ID: ", pid)
42+
#' f <- future(Sys.info())
43+
#' info <- value(f)
44+
#' print(info)
4545
#'
4646
#' @references
4747
#' * <https://en.wikipedia.org/wiki/TORQUE>

0 commit comments

Comments
 (0)