File: prototype.R

package info (click to toggle)
r-bioc-biocparallel 1.40.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,768 kB
  • sloc: cpp: 139; sh: 14; makefile: 8
file content (31 lines) | stat: -rw-r--r-- 1,018 bytes parent folder | download | duplicates (2)
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
## There are three timeouts involved
##
## - establishing a socket connection, from getOption("timeout"),
##   default 60 seconds
## - duration of allowed computations, from argument `timeout=` to
##   *Param(), default WORKER_TIMEOUT (infinite)
## - duration of idle connections (no activity from the worker
##   socket), default IDLE_TIMEOUT (30 days) beause (a) this is the
##   snow behavior and (b) sockets appear to sometimes segfault & lead
##   to PROTECTion imbalance if an attempt is made to write to a
##   terminated socket.

## Timeout for individual worker tasks
WORKER_TIMEOUT <- NA_integer_

## Timeout for socket inactivity
IDLE_TIMEOUT <- 2592000L # 60 * 60 * 24 * 30 = 30 day; consistent w/ parallel

## Maximum number of tasks, e.g., when using progress bar
TASKS_MAXIMUM <- .Machine$integer.max

.prototype_update <-
    function(prototype, ...)
{
    args <- list(...)
    stopifnot(
        all(names(args) %in% names(prototype))
    )
    prototype[names(args)] <- unname(args)
    prototype
}