Description Usage Arguments Details Methods
Create a task handle object. This is a "pointer" to a task and
can be used to retrieve information about status, running times,
expression and the result of the task once complete. Generally
you do not need to make a task object as they will be created for
you by things like the task_get
method of the
observer
and queue
objects.
1 |
obj |
A |
task_id |
Task identifier |
key_complete |
If known, specify the |
Tasks have a unique identifier; these are unique within a queue and are implemented as an incrementing integer. However, this is an implementation detail and should not be relied on. The identifier is represented as a character string rather than an integer in most places.
Tasks exist in one of a number of statuses. See the
status
method below for a list of possible statuses and
their interpretation.
status
Returns a scalar character indicating the task status.
Usage:
status(follow_redirect = FALSE)
Arguments:
follow_redirect
should we follow redirects to get the status of any requeued task?
Value: Scalar character. Possible values are
PENDING
queued, but not run by a worker
RUNNING
being run on a worker, but not complete
COMPLETE
task completed successfully
ERROR
task completed with an error
ORPHAN
task orphaned due to loss of worker
REDIRECT
orphaned task has been redirected
MISSING
task not known (deleted, or never existed)
result
Fetch the result of a task, so long as it has completed.
Usage:
result(follow_redirect = FALSE)
Arguments:
follow_redirect
should we follow redirects to get the status of any requeued task?
wait
Like result
, but will wait until the task is complete. In order to preserve the key_complete
for anything that might be listening for it (and to avoid collision with anything else writing to that key), this function repeatedly polls the database. Over a slow connection you may want to increase the every
parameter.
Usage:
wait(timeout, every = 0.05)
Arguments:
timeout
Length of time, in seconds, to wait. A value of zero will not wait. Infinite times are possible and can be escaped by pressing Ctrl-C or Escape (depending on platform).
every
How often, in seconds, to poll for results
expr
returns the expression stored in the task
Usage:
expr(locals = FALSE)
Arguments:
locals
Logical, indicating if the local variables associated with the expression should also be retuned. If TRUE
, then local variables used in the expression will be returned in a attribute of the expression envir
.
Value:
A quoted expression (a language object). Turn this into a string with deparse. If locals
was TRUE
there will be an environment attribute with local variables included.
envir
returns the environment identifier for the task
Usage:
envir()
times
returns a summar of times associated with this task.
Usage:
times(unit_elapsed = "secs")
Arguments:
unit_elapsed
Unit to use in computing elapsed times. The default is to use "secs". This is passed through to difftime
so the units there are available and are "auto", "secs", "mins", "hours", "days", "weeks".
Value:
A one row data.frame
with columns
submitted
Time the task was submitted
started
Time the task was started, or NA
if waiting
finished
Time the task was completed, or NA
if waiting or running
waiting
Elapsed time spent waiting
running
Elapsed time spent running, or NA
if waiting
idle
Elapsed time since finished, or NA
if waiting or running
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.