A TaskList
stores and retrieves one or more tasks.
Details
The TaskList
class is used as a storage class. It provides a container that
holds a collection of Task
objects, along with a collection of methods for
adding, removing, and getting Task
s. It can also report on the status of the
Task
s contained within the list and retrieve results from those Task
s. What
it cannot do is manage interactions with Worker
s or arrange for the Task
s to
be executed. That's the job of the Queue
.
Methods
Method get_task()
Return a single Task
contained in the TaskList
. The
Task
is not removed from the TaskList
, and has reference semantics:
if the listed task is completed by a Worker
, then the status of any
Task
returned by this method will update automatically
Method retrieve()
Retrieves the current state of all tasks.
Returns
Returns a tibble containing the results of all tasks and
various other useful metadata. Contains one row per task in the
TaskList
, and the following columns:
task_id
A character string specifying the task identifiersworker_id
An integer specifying the worker process ids (pid)state
A character string indicating the status of each task ("created", "waiting", "assigned", "running", or "done")result
A list containing the function outputs, or NULLruntime
Completion time for the task (NA if the task is not done)fun
A list containing the functionsargs
A list containing the arguments passed to each functioncreated
The time at which each task was createdqueued
The time at which each task was added to aQueue
assigned
The time at which each task was assigned to aWorker
started
The time at which aWorker
called each functionfinished
The time at which aWorker
output was returned for the taskcode
The status code returned by the callr R session (integer)message
The message returned by the callr R session (character)stdout
List column containing the contents of stdout during function executionstderr
List column containing the contents of stderr during function executionerror
List column containingNULL
values
If all tasks have completed this output is the same as the output as the
run()
method for a Queue
object.
Note: at present there is one field from the callr rsession::read() method
that isn't captured here, and that's the error field. I'll add that after
I've finished wrapping my head around what that actually does. The error
column, at present, is included only as a placeholder