TaskObject

TaskObject[spec]

is an object that represents a background task.

Details

  • Tasks are created by functions such as SessionSubmit, LocalSubmit and CloudSubmit.
  • TaskObject[spec][prop] gives the value of a property of a task.
  • Properties of all tasks include:
  • "EvaluationExpression"expression to evaluate when the task is executed
    "EvaluationResult"result of evaluating the task expression
    "EventData"the most recent values of all handler functions keys
    "HandlerFunctions"handlers specified by the HandlerFunctions option
    "HandlerFunctionsKeys"handler functions keys specified by HandlerFunctionsKeys
    "TaskEnvironment""Session", "Local", "Cloud" or "External"
    "TaskStatus"status of the task ("Running", "Waiting", etc.)
    "TaskType"type of task ("Immediate", "Scheduled", etc.)
    "TaskUUID"unique task identifier
  • The expression to evaluate is returned wrapped in HoldForm.
  • The most recent values of handler functions keys given by "EventData" are returned as an association. If a particular key has not yet been set, it is returned as Missing[].
  • Scheduled tasks have the following additional properties:
  • "Schedule"task schedule specification
    "RunInterval"interval between task runs
    "PreviousRunCount"number of times the task has already run
    "RemainingRunCount"number of times the task still has to run
    "TotalRunCount"total number of times the task is scheduled to run
    "NextScheduledTime"next time the task is scheduled to run
  • A list of all available properties of a task object obj can be obtained using obj["Properties"].
  • Possible task statuses include:
  • "Waiting"task is waiting to run
    "Running"task expression is currently being evaluated
    "Finished"task is finished and will not repeat
    "Suspended"task has been suspended
    "Removed"task has been removed
  • Possible task types include: "Immediate", "Asynchronous", "Scheduled" and "Continuous".
  • Normal[obj] gives a representation of a TaskObject as an association.

Examples

Basic Examples  (4)

Run a task in the current session:

Convert a TaskObject to Association:

Create a task:

Look up a task's UUID:

Look up available task properties:

Get an Association representing the task:

Run a task in a separate kernel:

Run a cloud-based task:

Wolfram Research (2017), TaskObject, Wolfram Language function, https://reference.wolfram.com/language/ref/TaskObject.html (updated 2019).

Text

Wolfram Research (2017), TaskObject, Wolfram Language function, https://reference.wolfram.com/language/ref/TaskObject.html (updated 2019).

CMS

Wolfram Language. 2017. "TaskObject." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2019. https://reference.wolfram.com/language/ref/TaskObject.html.

APA

Wolfram Language. (2017). TaskObject. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/TaskObject.html

BibTeX

@misc{reference.wolfram_2024_taskobject, author="Wolfram Research", title="{TaskObject}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/TaskObject.html}", note=[Accessed: 22-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_taskobject, organization={Wolfram Research}, title={TaskObject}, year={2019}, url={https://reference.wolfram.com/language/ref/TaskObject.html}, note=[Accessed: 22-November-2024 ]}