crew_class_client {crew} | R Documentation |
R6
client class.R6
class for mirai
clients.
See crew_client()
.
name
See crew_client()
.
workers
See crew_client()
.
host
See crew_client()
.
port
See crew_client()
.
tls
See crew_client()
.
seconds_interval
See crew_client()
.
seconds_timeout
See crew_client()
.
retry_tasks
See crew_client()
relay
Relay object for event-driven programming on a downstream condition variable.
started
Whether the client is started.
client
Process ID of the local process running the client.
dispatcher
Process ID of the mirai
dispatcher
new()
mirai
client constructor.
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 )
name
Argument passed from crew_client()
.
workers
Argument passed from crew_client()
.
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()
.
retry_tasks
Argument passed from crew_client()
.
relay
Argument passed from crew_client()
.
An R6
object with the client.
if (identical(Sys.getenv("CREW_EXAMPLES"), "true")) { client <- crew_client() client$start() client$log() client$terminate() }
validate()
Validate the client.
crew_class_client$validate()
NULL
(invisibly).
start()
Start listening for workers on the available sockets.
crew_class_client$start()
NULL
(invisibly).
terminate()
Stop the mirai client and disconnect from the worker websockets.
crew_class_client$terminate()
NULL
(invisibly).
condition()
Get the nanonext
condition variable which tasks signal
on resolution.
crew_class_client$condition()
The nanonext
condition variable which tasks signal
on resolution. The return value is NULL
if the client
is not running.
resolved()
Get the true value of the nanonext
condition variable.
crew_class_client$resolved()
The value of the nanonext
condition variable.
summary()
Show an informative worker log.
crew_class_client$summary()
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
: TRUE
if the worker is online and connected to the
websocket URL, FALSE
otherwise.
instances
: integer, number of instances of mirai
daemons
(crew
workers) 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. crew
changes the token at the end of the
URL path periodically as a safeguard while managing workers.
pids()
Get the process IDs of the local process and the
mirai
dispatcher (if started).
crew_class_client$pids()
An integer vector of process IDs of the local process and the
mirai
dispatcher (if started).
Other client:
crew_client()
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()
}