User`s guide

7 Program Independent Jobs
7-36
command to scheduler canceling job job_id
In a similar way, you can define what do to for deleting a job, and what to do for
canceling and deleting tasks.
Delete or Cancel a Running Job
After your functions are written, you set the appropriate properties of the cluster object
with handles to your functions. The corresponding cluster properties are:
CancelJobFcn
DeleteJobFcn
CancelTaskFcn
DeleteTaskFcn
You can set the properties in the Cluster Profile Manager for your cluster, or on the
command line:
c = parcluster('MyGenericProfile');
% set required properties
c.CancelJobFcn = @myCancelJob
c.DeleteJobFcn = @myDeleteJob
c.CancelTaskFcn = @myCancelTask
c.DeleteTaskFcn = @myDeleteTask
Continue with job creation and submission as usual.
j1 = createJob(c);
for ii = 1:n
t(ii) = createTask(j1,...)
end
submit(j1)
While the job is running or queued, you can cancel or delete the job or a task.
This command cancels the task and moves it to the finished state, and triggers execution
of myCancelTask, which sends the appropriate commands to the scheduler:
cancel(t(4))
This command deletes job data for j1, and triggers execution of myDeleteJob, which
sends the appropriate commands to the scheduler: