| crew_class_client {crew} | R Documentation |
R6 client class.
Description
R6 class for mirai clients.
Details
See crew_client().
Active bindings
nameSee
crew_client().workersSee
crew_client().hostSee
crew_client().portSee
crew_client().tlsSee
crew_client().seconds_intervalSee
crew_client().seconds_timeoutSee
crew_client().retry_tasksSee
crew_client()relayRelay object for event-driven programming on a downstream condition variable.
startedWhether the client is started.
dispatcherProcess ID of the
miraidispatcher
Methods
Public methods
Method new()
mirai client constructor.
Usage
crew_class_client$new( name = NULL, workers = NULL, host = NULL, port = NULL, tls = NULL, seconds_interval = NULL, seconds_timeout = NULL, retry_tasks = NULL, relay = NULL )
Arguments
nameArgument passed from
crew_client().workersArgument passed from
crew_client().hostArgument passed from
crew_client().portArgument passed from
crew_client().tlsArgument passed from
crew_client().seconds_intervalArgument passed from
crew_client().seconds_timeoutArgument passed from
crew_client().retry_tasksArgument passed from
crew_client().relayArgument 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()
Details
Subtracts a safety offset which was padded on start.
Returns
The value of the nanonext condition variable.
Method summary()
Show an informative worker log.
Usage
crew_class_client$summary()
Returns
A tibble with information on the workers, or NULL
if the client is not started. The tibble has 1 row
per worker and the following columns:
-
worker: integer index of the worker. -
online:TRUEif the worker is online and connected to the websocket URL,FALSEotherwise. -
instances: integer, number of instances ofmiraidaemons (crewworkers) that have connected to the websocket URL during the life cycle of the listener. -
assigned: number of tasks assigned to the current websocket URL. -
complete: number of tasks completed at the current websocket URL. -
socket: websocket URL.crewchanges the token at the end of the URL path periodically as a safeguard while managing workers.
See Also
Other client:
crew_client()
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()
}