error handling in queue framework
parent
743c7a592d
commit
a13eb2a583
|
@ -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 );
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue