% Generated by roxygen2: do not edit by hand % Please edit documentation in R/RushWorker.R \name{RushWorker} \alias{RushWorker} \title{Rush Worker} \value{ Object of class \link[R6:R6Class]{R6::R6Class} and \code{RushWorker}. } \description{ \link{RushWorker} inherits all methods from \link{Rush}. Upon initialization, the worker registers itself in the Redis database as a running worker. This class is usually not constructed directly by the user. } \section{Super class}{ \code{\link[rush:Rush]{rush::Rush}} -> \code{RushWorker} } \section{Public fields}{ \if{html}{\out{
}} \describe{ \item{\code{worker_id}}{(\code{character(1)})\cr Identifier of the worker.} \item{\code{heartbeat}}{(\code{callr::r_bg})\cr Background process for the heartbeat.} } \if{html}{\out{
}} } \section{Active bindings}{ \if{html}{\out{
}} \describe{ \item{\code{terminated}}{(\code{logical(1)})\cr Whether to shutdown the worker. Used in the worker loop to determine whether to continue.} } \if{html}{\out{
}} } \section{Methods}{ \subsection{Public methods}{ \itemize{ \item \href{#method-RushWorker-new}{\code{RushWorker$new()}} \item \href{#method-RushWorker-set_terminated}{\code{RushWorker$set_terminated()}} \item \href{#method-RushWorker-clone}{\code{RushWorker$clone()}} } } \if{html}{\out{
Inherited methods

- `rush::Rush$detect_lost_workers()`
- `rush::Rush$empty_queue()`
- `rush::Rush$fail_tasks()`
- `rush::Rush$fetch_failed_tasks()`
- `rush::Rush$fetch_finished_tasks()`
- `rush::Rush$fetch_new_tasks()`
- `rush::Rush$fetch_queued_tasks()`
- `rush::Rush$fetch_running_tasks()`
- `rush::Rush$fetch_tasks()`
- `rush::Rush$fetch_tasks_with_state()`
- `rush::Rush$finish_tasks()`
- `rush::Rush$format()`
- `rush::Rush$is_failed_task()`
- `rush::Rush$is_running_task()`
- `rush::Rush$pop_task()`
- `rush::Rush$print()`
- `rush::Rush$print_log()`
- `rush::Rush$push_failed()`
- `rush::Rush$push_failed_tasks()`
- `rush::Rush$push_finished_tasks()`
- `rush::Rush$push_results()`
- `rush::Rush$push_running_tasks()`
- `rush::Rush$push_tasks()`
- `rush::Rush$read_hash()`
- `rush::Rush$read_hashes()`
- `rush::Rush$read_log()`
- `rush::Rush$reconnect()`
- `rush::Rush$reset()`
- `rush::Rush$reset_cache()`
- `rush::Rush$start_local_workers()`
- `rush::Rush$start_remote_workers()`
- `rush::Rush$start_workers()`
- `rush::Rush$stop_workers()`
- `rush::Rush$tasks_with_state()`
- `rush::Rush$wait_for_tasks()`
- `rush::Rush$wait_for_workers()`
- `rush::Rush$worker_script()`
- `rush::Rush$write_hashes()`

}} \if{html}{\out{

}} \if{html}{\out{}} \if{latex}{\out{\hypertarget{method-RushWorker-new}{}}} \subsection{Method \code{new()}}{ Creates a new instance of this \link[R6:R6Class]{R6} class. \subsection{Usage}{ \if{html}{\out{
}}\preformatted{RushWorker$new( network_id, config = NULL, worker_id = NULL, heartbeat_period = NULL, heartbeat_expire = NULL )}\if{html}{\out{
}} } \subsection{Arguments}{ \if{html}{\out{
}} \describe{ \item{\code{network_id}}{(\code{character(1)})\cr Identifier of the rush network. Manager and workers must have the same id. Keys in Redis are prefixed with the instance id.} \item{\code{config}}{(\link[redux:redis_config]{redux::redis_config})\cr Redis configuration options. If \code{NULL}, configuration set by \code{\link[=rush_plan]{rush_plan()}} is used. If \code{rush_plan()} has not been called, the \code{REDIS_URL} environment variable is parsed. If \code{REDIS_URL} is not set, a default configuration is used. See \link[redux:redis_config]{redux::redis_config} for details.} \item{\code{worker_id}}{(\code{character(1)})\cr Identifier of the worker. Keys in redis specific to the worker are prefixed with the worker id.} \item{\code{heartbeat_period}}{(\code{integer(1)})\cr Period of the heartbeat in seconds. The heartbeat is updated every \code{heartbeat_period} seconds.} \item{\code{heartbeat_expire}}{(\code{integer(1)})\cr Time to live of the heartbeat in seconds. The heartbeat key is set to expire after \code{heartbeat_expire} seconds.} } \if{html}{\out{
}} } } \if{html}{\out{

}} \if{html}{\out{}} \if{latex}{\out{\hypertarget{method-RushWorker-set_terminated}{}}} \subsection{Method \code{set_terminated()}}{ Mark the worker as terminated. Last step in the worker loop before the worker terminates. \subsection{Usage}{ \if{html}{\out{
}}\preformatted{RushWorker$set_terminated()}\if{html}{\out{
}} } \subsection{Returns}{ (\code{RushWorker})\cr Invisible self. } } \if{html}{\out{

}} \if{html}{\out{}} \if{latex}{\out{\hypertarget{method-RushWorker-clone}{}}} \subsection{Method \code{clone()}}{ The objects of this class are cloneable with this method. \subsection{Usage}{ \if{html}{\out{
}}\preformatted{RushWorker$clone(deep = FALSE)}\if{html}{\out{
}} } \subsection{Arguments}{ \if{html}{\out{
}} \describe{ \item{\code{deep}}{Whether to make a deep clone.} } \if{html}{\out{
}} } } }