launch_local spawns a new background Rscript process calling daemon with the specified arguments. May be used to re-launch daemons that have timed out on the local machine.

launch_remote returns the shell command for launching daemons as a character vector. If 'command' is specified, this is executed with the arguments in 'args' to effect the daemon launch on the remote machine.

launch_local(url, ..., tls = NULL, .compute = "default")

  tls = NULL,
  .compute = "default",
  rscript = "Rscript",
  command = NULL,
  args = c("", .)



the character host URL or vector of host URLs, including the port to connect to (and optionally for websockets, a path), e.g. tcp://' or 'ws://'

or integer index value, or vector of index values, of the dispatcher URLs, or 1L for the host URL (when not using dispatcher).


(optional) additional arguments passed to daemon (see 'additional arguments' section below).


[default NULL] required for secure TLS connections over tls+tcp or wss. Zero-configuration TLS certificates generated by daemons are automatically passed to the daemon, without requiring to be specified here. Otherwise, supply either the character path to a file containing X.509 certificate(s) in PEM format, comprising the certificate authority certificate chain, or a length 2 character vector comprising [i] the certificate authority certificate chain and [ii] the empty character ''.


[default 'default'] character compute profile (each compute profile has its own set of daemons for connecting to different resources).


[default 'Rscript'] name / path of the Rscript executable. The default assumes 'Rscript' is on the executable search path on the remote machine. Prepend the full path if necessary. If launching on Windows, 'Rscript' should be replaced with 'Rscript.exe'.


(optional) the command used to effect the daemon launch on the remote machine as a character string (e.g. 'ssh').


(optional) arguments passed to 'command', as a character vector that must include '.' (quoted or unquoted) as an element, which will be substituted for the daemons launch command. As an example, for SSH, valid arguments may comprise the port, destination IP, followed by the daemons launch command. These could be specified in the manner of: c('-p 22', .).


For launch_local: Invisible NULL.

For launch_remote: A character vector of daemon launch commands the same length as 'url'. For manual deployment, unescape the double quotes around the call to "mirai::daemons()".


If daemons have been set, the generated command will automatically contain the argument 'rs' specifying the length 7 L'Ecuyer-CMRG random seed supplied to the daemon. The values will be different each time the function is called.

Additional arguments

Additional arguments may be specified as part of '...' to be passed on to daemon:

  • 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, 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.

  • output [default FALSE] Specify as TRUE to provide redirection of output (stdout and stderr) from the daemon to the host process. This option is only applicable for local daemons when not using dispatcher.


if (interactive()) {
# Only run examples in interactive R sessions

daemons(url = "ws://[::1]:0", dispatcher = FALSE)
launch_local(status()$daemons, maxtasks = 10L)
launch_remote(1L, maxtasks = 10L)

daemons(n = 2L, url = "tls+tcp://[::1]:0")
launch_local(1:2, idletime = 60000L, timerstart = 1L)
launch_remote(1:2, idletime = 60000L, timerstart = 1L)