Main Content


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 MATLAB® Job Scheduler 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


Common to All Task Types

The following properties are common to all task object types.

CaptureDiarySpecify whether to return diary output
CreateDateTimeDate and time when the task is created
DiaryText produced by execution of task object's function
ErrorTask error information
ErrorIdentifierTask error identifier
ErrorMessageMessage from task error
FinishDateTimeDate and time when the task is finished
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
RunningDurationCurrent duration of the task, specified as a duration object.
StartDateTimeDate and time when the task is started
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

MATLAB Job Scheduler Tasks

MATLAB Job Scheduler 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 the following properties in addition to the common properties:


If you have submitted the task to a third-party scheduler, this is the ID that the scheduler gives to the task on submission. For example, this corresponds to the JOBID on a SLURM scheduler.


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

Version History

Introduced in R2012a