Main Content

delete

Remove job or task object from cluster and memory

Syntax

Description

example

delete(obj)removes the job or task object,obj, from the local MATLAB session, and removes it from the cluster’sJobStorageLocation. When the object is deleted, references to it become invalid. Invalid objects should be removed from the workspace with theclearcommand. If multiple references to an object exist in the workspace, deleting one reference to that object invalidates the remaining references to it. These remaining references should be cleared from the workspace with theclearcommand.

When you delete a job object, this also deletes all the task objects contained in that job. Any references to those task objects will also be invalid, and you should clear them from the workspace.

Ifobjis an array of objects and one of the objects cannot be deleted, the other objects in the array are deleted and a warning is returned.

Because its data is lost when you delete an object,deleteshould be used only after you have retrieved all required output data from the effected object.

Examples

collapse all

Create a job object using the default profile. Then delete the job.

myCluster = parcluster; j = createJob(myCluster,'Name','myjob'); t = createTask(j,@rand,1,{10}); delete(j); clearjt

Delete all jobs on the cluster identified by the profilemyProfile.

myCluster = parcluster('myProfile'); delete(myCluster.Jobs)

Use the syntax with multiple outputs offindJobto obtain the jobs by state. In this example, delete the pending jobs.

myCluster = parcluster; [pending queued running completed] = findJob(myCluster); delete(pending);

Alternatively, usefindJobto retrieve the jobs that match a specific state. In this example, find the jobs in state failed and delete them.

myCluster = parcluster; failed = findJob(myCluster,'State','failed'); delete(failed);

Input Arguments

collapse all

Job or task object to delete, specified as aparallel.Joborparallel.Taskobject. You can create jobs and tasks withcreateJobandcreateTask.

Data Types:parallel.Job|parallel.Task

Introduced in R2012a