Learn R Programming

crew (version 0.5.0)

crew_class_client: R6 client class.

Description

R6 class for mirai clients.

Arguments

Public fields

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

started

Whether the client is started.

dispatcher

Process ID of the mirai dispatcher

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
)

Arguments

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

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 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: 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.


Method terminate()

Stop the mirai client and disconnect from the worker websockets.

Usage

crew_class_client$terminate()

Returns

NULL (invisibly).

Details

See crew_client().

See Also

Other class: crew_class_controller_group, crew_class_controller, crew_class_launcher, crew_class_schedule, crew_class_tls

Examples

Run this code
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()
}

Run the code above in your browser using DataLab