R6
class to contain and manage task objects.
seconds_interval
See crew_schedule()
.
pushed
Hash table of pushed tasks.
collected
Linked list of resolved tasks with results available.
pushes
Number of times a task has been pushed.
head
ID of the task at the head of the collected
linked list.
tail
ID of the task at the tail of the collected
linked list.
until
Numeric of length 1, time point when throttled task collection unlocks.
new()
Schedule constructor.
crew_class_schedule$new(seconds_interval = NULL)
seconds_interval
See crew_schedule()
.
An R6
schedule object.
validate()
Validate the schedule.
crew_class_schedule$validate()
NULL
(invisibly).
Sets the pushed
and collected
hash tables to new
empty environments.
NULL (invisibly).
NULL
if not started. Otherwise, a tibble
with
the following columns:
pushed
: number tasks that were pushed but not collected yet.
These tasks may or may not have completed.
collected
: number of tasks that completed and were collected
but not yet retrieved with pop()
.
push()
Push a task.
crew_class_schedule$push(task)
task
The mirai
task object to push.
Add a task to the pushed
hash table
NULL
(invisibly).
throttle()
Throttle repeated calls.
crew_class_schedule$throttle()
TRUE
to throttle, FALSE
to continue.
collect()
Collect resolved tasks.
crew_class_schedule$collect(throttle = FALSE)
throttle
whether to defer task collection
until the next task collection request at least
seconds_interval
seconds from the original request.
The idea is similar to shiny::throttle()
except that crew
does not
accumulate a backlog of requests. The technique improves robustness
and efficiency.
Scan the tasks in pushed
and move the resolved ones to the
head of the collected
linked list.
NULL
(invisibly).
Exists to support a purrr
-like extension to crew
for
functional programming. For developers only. Not supported
for controller groups.
A list of monad objects from individual tasks.
pop()
Pop a task from the collected
linked list.
crew_class_schedule$pop()
A task object if available, NULL
otherwise.
empty()
Check if the schedule is empty.
crew_class_schedule$empty()
TRUE
if the pushed
and collected
hash tables are both
empty, FALSE
otherwise.
nonempty()
Check if the schedule is nonempty.
crew_class_schedule$nonempty()
TRUE
if either pushed
or collected
is nonempty,
FALSE
otherwise.
collected_all()
Check if all previously pushed tasks are now collected.
crew_class_schedule$collected_all()
TRUE
if all previously pushed tasks are now collected,
FALSE
otherwise. Could be FALSE
if there are unresolved tasks
or there are no tasks at all.
collected_one()
Check if there is at least one collected task or there are no pushed tasks.
crew_class_schedule$collected_one()
TRUE
if there is at least one collected task or
there are no pushed tasks, FALSE
otherwise.
collected_mode()
Either collected_all()
or collected_one()
, depending
on the mode
argument.
crew_class_schedule$collected_mode(mode = "all")
mode
"all"
to call collected_all()
or "one"
to call
collected_one()
.
TRUE
or FALSE
, depending on mode
and the state of the
schedule.
Not a user-side class. There are no examples. Please see
crew_controller_local()
for details.
Other class:
crew_class_client
,
crew_class_controller_group
,
crew_class_controller
,
crew_class_launcher
,
crew_class_tls