File: batchtools_custom.R

package info (click to toggle)
r-cran-future.batchtools 0.10.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, sid
  • size: 436 kB
  • sloc: sh: 54; makefile: 2
file content (46 lines) | stat: -rw-r--r-- 1,729 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#' Batchtools futures for custom batchtools configuration
#'
#' @inheritParams BatchtoolsFuture
#'
#' @param conf.file (character) A batchtools configuration file as for
#' instance returned by [batchtools::findConfFile()].
#'
#' @param cluster.functions A
#' [ClusterFunctions][batchtools::ClusterFunctions] object.
#'
#' @param \ldots Additional arguments passed to [BatchtoolsFuture()].
#'
#' @return An object of class `BatchtoolsFuture`.
#'
#' @example incl/batchtools_custom.R
#'
#' @export
#' @importFrom batchtools findConfFile
#' @importFrom utils file_test
batchtools_custom <- function(expr, envir = parent.frame(), substitute = TRUE,
                              globals = TRUE,
                              label = NULL,
                              resources = list(),
                              workers = NULL,
                              conf.file = findConfFile(),
                              cluster.functions = NULL,
                              registry = list(),
                              ...) {
  if (substitute) expr <- substitute(expr)

  future <- BatchtoolsFuture(expr = expr, envir = envir, substitute = FALSE,
                            globals = globals,
                            label = label,
                            resources = resources,
                            conf.file = conf.file,
                            cluster.functions = cluster.functions,
                            workers = workers,
                            registry = registry,
                            ...)

  if (!future$lazy) future <- run(future)

  future
}
class(batchtools_custom) <- c("batchtools_custom", "batchtools",
                              "multiprocess", "future", "function")