Access task properties and behaviors


createTask, findTask

getCurrentTask (in the workspace of the MATLAB worker)

Container Hierarchy






A parallel.Task object provides access to a task, which executes on a worker as part of a job.


The following table describes the available types of task objects, determined by the type of cluster.

Task TypeDescription
parallel.task.MJSTaskTask on MJS cluster
parallel.task.CJSTaskTask on CJS cluster


All task type objects have the same methods, described in the following table.

cancelCancel job or task
deleteRemove job or task object from cluster and memory
listAutoAttachedFilesList of files automatically attached to job, task, or parallel pool
waitWait for job to change state


Common to All Task Types

The following properties are common to all task object types.

CaptureDiarySpecify whether to return diary output
CreateTimeWhen task was created
DiaryText produced by execution of task object's function
ErrorTask error information
ErrorIdentifierTask error identifier
ErrorMessageMessage from task error
FinishTimeWhen task finished running
FunctionFunction called when evaluating task
IDTask's numeric identifier
InputArgumentsInput arguments to task function
NameName of this task
NumOutputArgumentsNumber of arguments returned by task function
OutputArgumentsOutput arguments from running task function on worker
ParentJob object containing this task
StartTimeWhen task started running
StateCurrent state of task
UserDataInformation associated with this task object
WarningsWarning information issued during execution of the task, captured in a struct array with the fields message, identifier, and stack
WorkerObject representing worker that ran this task

MJS Tasks

MJS task objects have the following properties in addition to the common properties:

FailureInfoInformation returned from failed task
FinishedFcnCallback executed in client when task finishes
MaximumRetriesMaximum number of times to rerun failed task
NumFailuresNumber of times tasked failed
RunningFcnCallback executed in client when task starts running
TimeoutTime limit, in seconds, to complete task

CJS Tasks

CJS task objects have no properties beyond the properties common to all clusters.


To get further help on either type of parallel.Task object, including a list of links to help for its properties, type:

help parallel.task.MJSTask
help parallel.task.CJSTask
Was this topic helpful?