How do I terminate a job on a remote cluster started using the DFEVAL function in Parallel Computing Toolbox 4.2 (R2009b)?

2 views (last 30 days)
I have created a distributed job using DFEVAL as shown below:
y = dfeval(@tester,{},'JobManager','myJM','FileDependencies', {'tester.m'});
where the function TESTER can be any task that takes a long time to execute, such as:
function out = tester
out = 1;
pause(50);
I want to cancel this job midway through its execution.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 28 Dec 2009
To cancel any job that was created using the DFEVAL, you can use the CANCEL method. However, before using this method, you have to identify the specific job to cancel. You can use the functions FINDRESOURCE and FINDJOB on another client MATLAB to identify the scheduler and the jobs queued on the scheduler. The code below illustrates how this can be done:
sch = findResource('scheduler','type', 'JobManager')
% The above code will return an array of scheduler objects. Select the job manager you are using. It might not always be the first element of the array.
out = findJob(sch(1));
% The above code will return an array of job objects. Select your specific job. It might not always be the 6th job in the queue.
jobToCancel = out(6)
jobToCancel.cancel

More Answers (0)

Products


Release

R2009b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!