Implements a persistent executor for the remote process. Awaits data, evaluates an expression in an environment containing the supplied data, and returns the result to the host caller.

daemon(
  url,
  asyncdial = FALSE,
  maxtasks = Inf,
  idletime = Inf,
  walltime = Inf,
  timerstart = 0L,
  output = FALSE,
  tls = NULL,
  ...,
  cleanup = 7L,
  rs = NULL
)

Arguments

url

the character host or dispatcher URL to dial into, including the port to connect to (and optionally for websockets, a path), e.g. 'tcp://192.168.0.2:5555' or 'ws://192.168.0.2:5555/path'.

asyncdial

[default FALSE] whether to perform dials asynchronously. The default FALSE will error if a connection is not immediately possible (e.g. daemons has yet to be called on the host, or the specified port is not open etc.). Specifying TRUE continues retrying (indefinitely) if not immediately successful, which is more resilient but can mask potential connection issues.

maxtasks

[default Inf] the maximum number of tasks to execute (task limit) before exiting.

idletime

[default Inf] maximum idle time, since completion of the last task (in milliseconds) before exiting.

walltime

[default Inf] soft walltime, or the minimum amount of real time taken (in milliseconds) before exiting.

timerstart

[default 0L] number of completed tasks after which to start the timer for 'idletime' and 'walltime'. 0L implies timers are started upon launch.

output

[default FALSE] logical value, to output generated stdout / stderr if TRUE, or else discard if FALSE. Specify as TRUE in the '...' argument to daemons or launch_local to provide redirection of output to the host process. Applicable only when not using dispatcher.

tls

[default NULL] required for secure TLS connections over 'tls+tcp://' or 'wss://'. Either the character path to a file containing X.509 certificate(s) in PEM format, comprising the certificate authority certificate chain starting with the TLS certificate and ending with the CA certificate, or a length 2 character vector comprising [i] the certificate authority certificate chain and [ii] the empty character ''.

...

reserved but not currently used.

cleanup

[default 7L] Integer additive bitmask controlling whether to perform cleanup of the global environment (1L), reset loaded packages to an initial state (2L), reset options to an initial state (4L), and perform garbage collection (8L) after each evaluation. This option should not normally be modified. Do not set unless you are certain you require persistence across evaluations. Note: it may be an error to reset options but not loaded packages if packages set options on load.

rs

[default NULL] the initial value of .Random.seed. This is set automatically using L'Ecuyer-CMRG RNG streams generated by the host process and should not be independently supplied.

Value

Invisible NULL.

Details

The network topology is such that daemons dial into the host or dispatcher, which listens at the 'url' address. In this way, network resources may be added or removed dynamically and the host or dispatcher automatically distributes tasks to all available daemons.