Skip to contents

R6 class for mirai clients.

Details

See crew_client().

See also

Other client: crew_client()

Active bindings

host

See crew_client().

port

See crew_client().

tls

See crew_client().

seconds_interval

See crew_client().

seconds_timeout

See crew_client().

relay

Relay object for event-driven programming on a downstream condition variable.

started

Whether the client is started.

url

Client websocket URL.

profile

Compute profile of the client.

client

Process ID of the local process running the client.

dispatcher

Process ID of the mirai dispatcher

Methods


Method new()

mirai client constructor.

Usage

crew_class_client$new(
  host = NULL,
  port = NULL,
  tls = NULL,
  seconds_interval = NULL,
  seconds_timeout = NULL,
  relay = NULL
)

Arguments

host

Argument passed from crew_client().

port

Argument passed from crew_client().

tls

Argument passed from crew_client().

seconds_interval

Argument passed from crew_client().

seconds_timeout

Argument passed from crew_client().

relay

Argument passed from crew_client().

Returns

An R6 object with the client.

Examples

if (identical(Sys.getenv("CREW_EXAMPLES"), "true")) {
client <- crew_client()
client$start()
client$log()
client$terminate()
}


Method validate()

Validate the client.

Usage

crew_class_client$validate()

Returns

NULL (invisibly).


Method start()

Start listening for workers on the available sockets.

Usage

crew_class_client$start()

Returns

NULL (invisibly).


Method terminate()

Stop the mirai client and disconnect from the worker websockets.

Usage

crew_class_client$terminate()

Returns

NULL (invisibly).


Method condition()

Get the nanonext condition variable which tasks signal on resolution.

Usage

crew_class_client$condition()

Returns

The nanonext condition variable which tasks signal on resolution. The return value is NULL if the client is not running.


Method resolved()

Get the true value of the nanonext condition variable.

Usage

crew_class_client$resolved()

Returns

The value of the nanonext condition variable.


Method status()

Internal function: return the mirai status of the compute profile.

Usage

crew_class_client$status()

Details

Should only be called by the launcher, never by the user. The returned events field changes on every call and must be interpreted by the launcher before it vanishes.

Returns

A list with status information.


Method pids()

Get the process IDs of the local process and the mirai dispatcher (if started).

Usage

crew_class_client$pids()

Returns

An integer vector of process IDs of the local process and the mirai dispatcher (if started).

Examples

if (identical(Sys.getenv("CREW_EXAMPLES"), "true")) {
client <- crew_client()
client$start()
client$log()
client$terminate()
}

## ------------------------------------------------
## Method `crew_class_client$new`
## ------------------------------------------------

if (identical(Sys.getenv("CREW_EXAMPLES"), "true")) {
client <- crew_client()
client$start()
client$log()
client$terminate()
}