How to retrieve error message when running script on cluster

11 visualizaciones (últimos 30 días)
Bi Bu
Bi Bu el 13 de Mayo de 2015
Comentada: Edric Ellis el 19 de Mayo de 2015
Hi,
I am running batch jobs using MATLAB remotely on a cluster. How to view the eventual error messages(where I hope to find the line of code where the problem is)? Thanks in advance.

Respuesta aceptada

Edric Ellis
Edric Ellis el 14 de Mayo de 2015
The task within the job object returned by the batch command has a property called Error which has the error stack. You could do something like this:
job = batch('assert(false)');
wait(job);
getReport(job.Tasks(1).Error)
Also note that if you simply call load on the job you'll see the error.
  2 comentarios
Bi Bu
Bi Bu el 14 de Mayo de 2015
Thanks. Is it also possible to see a live log of the outputs of the batch in the Matlab command window? The same way in Unix it's done using tail -tail -f filename_output. Thanks again.
Edric Ellis
Edric Ellis el 19 de Mayo de 2015
You can call the diary method while the job is running to do that (you need to be running a relatively recent version of Parallel Computing Toolbox for that to work). Unfortunately the diary method gives you the whole output each time, rather than a tail -f style.
>> j = batch('for ii=1:4,pause(1),disp(ii);end')
>> % After a short while...
>> diary(j)
Warning: The diary of this batch job might be incomplete because the job is still running.
--- Start Diary ---
1
2
--- End Diary ---

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by