error handling in queue framework

pull/1/head
Thorsten Liebig 2011-12-19 09:54:11 +01:00
parent 743c7a592d
commit a13eb2a583
2 changed files with 8 additions and 1 deletions

View File

@ -38,8 +38,11 @@ queue.jobs{jobnum}.outargsfile = [tempname '.mat'];
queue.jobs{jobnum}.command = [queue.bin queue.bin_options ' "load(''' queue.jobs{jobnum}.argsfile ''');' ...
queue.DependPath ...
'err=[];' ...
'try;' ...
'[outargs{1:' num2str(queue.jobs{jobnum}.nargout) '}]=' func_name '(func_args{:});' ...
'save(''-V7'',''' queue.jobs{jobnum}.outargsfile ''',''outargs'');' ...
'catch err;outargs=0;end;' ...
'save(''-V7'',''' queue.jobs{jobnum}.outargsfile ''',''outargs'',''err'');' ...
'exit;"'];
[queue.jobs{jobnum}.pid, queue.jobs{jobnum}.filenames] = queue_addProcess( queue.jobs{jobnum}.command );

View File

@ -33,6 +33,10 @@ for n=1:numJobs
if (queue_checkProcess( queue.jobs{n}.pid, queue.jobs{n}.filenames)==0)
queue.jobs_finished(n)=1;
load(queue.jobs{n}.outargsfile);
if ~isempty(err)
disp(['Job with number ' num2str(n) ' failed to execute: Error message:']);
error(['CheckQueue:' err.message]);
end
queue.jobs{n}.outargs = outargs;
% read in output and cleanup