Error is a warning in parfeval function
Afficher commentaires plus anciens
I have the following (pseudo) code and I'm getting the following warning in my command window (2017b Windows).
function parallel_worker(q)
try
my_function(missing_variable)
catch ME
q.send(ME);
end
end
function my_function(v)
v = v + 1;
end
The receiving q is supposed to rethrow the error message.
Here's the caller:
function runExample()
q_receive = parallel.pool.DataQueue;
L1 = afterEach(q_receive, @handleQ);
%Launch the parallel daq session
%------------------------------------------------
fh = @parallel_worker;
feval_future = parfeval(gcp,fh,0,q_receive);
pause(5)
end
function handleQ(data)
rethrow(data)
end
%For testing:
%runExample should throw the warning below
%parallel_worker(1) - throws an error in the catch (as expected when input is a number not a queue)
I'm seeing: "Warning: Undefined function or variable 'missing_variable'" instead of: ME =
MException with properties:
identifier: 'MATLAB:UndefinedFunction'
message: 'Undefined function or variable 'missing_variable'.'
cause: {}
stack: [1×1 struct]
I know that in some cases I've seen errors throw which cause the future to stop. Why are some errors being converted into warnings?
Update: It appears that my problem may be with throwing ... one second ...
Réponses (1)
Jim Hokanson
le 6 Jan 2018
Catégories
En savoir plus sur Error Handling dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!