Description Usage Arguments Details Methods
Create a task bundle. Generally these are not created manually, but this page serves to document what task bundles are and the methods that they have.
1 | task_bundle(obj, tasks, groups = NULL, names = NULL)
|
obj |
An observer or queue object |
tasks |
A list of tasks |
groups |
Optional vector of groups. If given, then additional tasks can be added to the bundle if they share the same group names. |
names |
Optional vector of names to label output with. |
A task bundle exists to group together tasks that are related. It is possible for a task to belong to multiple bundles.
ids
Return the vector of ids for the bundle (will return character(0)
if the bundle is empty).
Usage:
ids()
status
Fetch the current task status (see task
).
Usage:
status(follow_redirect = FALSE)
Arguments:
follow_redirect
should we follow redirects to get the status of any requeued task?
overview
High-level overview of the tasks in the bundle; the number of tasks in each status.
Usage:
overview()
results
Fetch results for all tasks, immediately (unlike wait
).
Usage:
results(follow_redirect = FALSE)
Arguments:
follow_redirect
should we follow redirects to get the status of any requeued task?
Value:
Always returns a list, regardless of how many tasks are in the bundle list()
for zero tasks, list(x1)
for one task, list(x1, x2)
for two, etc). This list will be named with the ids (see ids()
) unless the bundles has a names
attribute that has not been invalidated by using update_groups()
(this interface may change).
wait
Like results
, but block until results are returned.
Usage:
wait(timeout = 60, time_poll = 1, progress_bar = TRUE, follow_redirect = FALSE)
Arguments:
timeout
Total time to wait, in seconds. If the tasks have not returned by this point an error willl be thrown.
time_poll
Interval, in seconds, to poll for new results. Increasing this time will reduce the number of Redis roundtrips but decrease the responsiveness to an interrupt.
progress_bar
Display a progress bar while waiting? Includes a spinner for reassurance that the process has not died.
follow_redirect
should we follow redirects to get the status of any requeued task?
wait1
Wait for a single task to complete,a nd return its result.
Usage:
wait1(timeout = 60, time_poll = 1, follow_redirect = FALSE)
Arguments:
timeout
Total time to wait, in seconds. If the tasks have not returned by this point an error willl be thrown.
time_poll
Interval, in seconds, to poll for new results. Increasing this time will reduce the number of Redis roundtrips but decrease the responsiveness to an interrupt.
follow_redirect
should we follow redirects to get the status of any requeued task?
Value:
If a task as available, either because all tasks are complete or because the waiting time was too short, NULL
is returned. Otherwise a list of length 2 is returned, with elements id
(the id of the task that completed) and value
the value of that that task. This interface is inspired by Redis' BLPOP
operation.
times
Like times in observer
, but limited to the ids in the bundle.
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".
update_groups
Check for new tasks that have been added to the groups included in this bunddle and add these tasks to the bundle.
Usage:
update_groups()
Value:
Invisibly, the ids of tasks that have been added to the bundle.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.