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().

serialization

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.

condition

Condition variable 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,
  serialization = 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().

serialization

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 set_started()

Register the client as started.

Usage

crew_class_client$set_started()

Details

Exported to implement the sequential controller. Only meant to be called manually inside the client or the sequential controller.

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 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()
}