Main Content

parallel.Job

Access job properties and behaviors

Constructors

createCommunicatingJob, createJob, findJob, recreate

getCurrentJob (in the workspace of the MATLAB worker)

Container Hierarchy

Parent

parallel.Cluster

Children

parallel.Task

Description

A parallel.Job object provides access to a job, which you create, define, and submit for execution.

Types

The following table describes the available types of job objects. The job type is determined by the type of cluster, and whether the tasks must communicate with each other during execution.

Job TypeDescription
parallel.job.MJSIndependentJobJob of independent tasks on MATLAB® Job Scheduler cluster
parallel.job.MJSCommunicatingJobJob of communicating tasks on MATLAB Job Scheduler cluster
parallel.job.CJSIndependentJobJob of independent tasks on CJS cluster
parallel.job.CJSCommunicatingJobJob of communicating tasks on CJS cluster

Methods

Common to All Job Types

The following methods are common to all job object types.

cancelCancel job or task
createTaskCreate new task in job
deleteRemove job or task object from cluster and memory
diaryDisplay or save Command Window text of batch job
fetchOutputsRetrieve output arguments from all tasks in job
findTaskTask objects belonging to job object
listAutoAttachedFilesList of files automatically attached to job, task, or parallel pool
loadLoad workspace variables from batch job
recreateCreate new job from existing job
submitQueue job in scheduler
waitWait for job to change state

CJS Jobs

CJS job objects have the following methods in addition to the common methods:

getTaskSchedulerIDsScheduler IDs of tasks in job

Properties

Common to All Job Types

The following properties are common to all job object types.

PropertyDescription
AdditionalPathsFolders to add to MATLAB search path of workers, specified as a character vector, string or string array, or cell array of character vectors
AttachedFilesFiles and folders that are sent to workers, specified as a character vector, string or string array, or cell array of character vectors
AutoAddClientPathSpecifies whether user-added-entries on the client's path are automatically added to each worker's path
AutoAttachFilesSpecifies if dependent code files are automatically sent to workers
CreateDateTimeDate and time when the job is created
EnvironmentVariablesNames of environment variables that are sent to the workers
FileStoreFile storage of the job that is accessible even while the job is still running, specified as a FileStore object
FinishDateTimeDate and time when the job finishes running
IDJob's numeric identifier
JobDataInformation made available to all workers for job's tasks
NameName of job
ParentCluster object containing this job
RunningDurationCurrent duration of the job, specified as a duration object
StartDateTimeDate and time when the job starts running
StateState of job: 'pending', 'queued', 'running', 'finished', or 'failed'
SubmitDateTimeDate and time when the job is submitted to the queue
TagLabel associated with job
TasksArray of task objects contained in job
TypeJob type: 'independent', 'pool', or 'spmd'
UserDataInformation associated with job object
UsernameName of user who owns job
ValueStoreData storage of the job that is accessible even while the job is still running, specified as a ValueStore object

When you offload computations to workers, any files that the client needs for computations must also be available on workers. By default, the client attempts to detect and attach these files. To turn off automatic detection, set the AutoAttachFiles property to false. If the software cannot find all the files, or if sending files from client to worker is slow, use one of these options.

  • If the files are in a folder that is not accessible on the workers, set the AttachedFiles property. The cluster copies each file you specify from the client to the workers.

  • If the files are in a folder that is accessible on the workers, you can set the AdditionalPaths property instead. Use the AdditionalPaths property to add paths to the MATLAB search path for each worker and avoid copying files unnecessarily from the client to the workers.

MATLAB Job Scheduler Jobs

MATLAB Job Scheduler independent job objects and MATLAB Job Scheduler communicating job objects have the following properties in addition to the common properties:

PropertyDescription
AuthorizedUsersUsers authorized to access job
FinishedFcnCallback function executed on client when this job finishes
NumWorkersRangeMinimum and maximum limits for number of workers to run job
QueuedFcnCallback function executed on client when this job is submitted to queue
RestartWorkerTrue if workers are restarted before evaluating first task for this job
RunningFcnCallback function executed on client when this job starts running
TimeoutTime limit, in seconds, to complete job

CJS Jobs

CJS independent job objects do not have any properties beyond the properties common to all job types.

CJS communicating job objects have the following properties in addition to the common properties:

PropertyDescription
NumWorkersRangeMinimum and maximum limits for number of workers to run job

Communicating Jobs

MATLAB Job Scheduler communicating job objects and CJS communicating job objects have this property in addition to the common properties:

PropertyDescription
SpmdEnabled

Indication if pool type job can run spmd code (since R2024a)

Help

To get further help on a particular type of parallel.Job object, including a list of links to help for its properties, type help parallel.job.<job-type>. For example:

help parallel.job.MJSIndependentJob

Version History

Introduced in R2012a