Skip to content
Snippets Groups Projects
Commit 8a809c7e authored by Marco Ratto's avatar Marco Ratto
Browse files

Capture separately the error when the master asked to break the job.

parent 1a5a294c
No related branches found
No related tags found
No related merge requests found
...@@ -84,10 +84,16 @@ try, ...@@ -84,10 +84,16 @@ try,
disp(['fParallel ',int2str(whoiam),' completed.']) disp(['fParallel ',int2str(whoiam),' completed.'])
catch, catch,
theerror = lasterror;
if strfind(theerror.message,'Master asked to break the job')
fOutputVar.message = theerror;
save([ fname,'_output_',int2str(whoiam),'.mat'],'fOutputVar' )
waitbarString = theerror.message;
else
disp(['fParallel ',int2str(whoiam),' crashed.']) disp(['fParallel ',int2str(whoiam),' crashed.'])
fOutputVar.error = lasterror; fOutputVar.error = theerror;
save([ fname,'_output_',int2str(whoiam),'.mat'],'fOutputVar' ) save([ fname,'_output_',int2str(whoiam),'.mat'],'fOutputVar' )
waitbarString = fOutputVar.error.message; waitbarString = theerror.message;
% waitbarTitle=['Metropolis-Hastings ',options_.parallel(ThisMatlab).ComputerName]; % waitbarTitle=['Metropolis-Hastings ',options_.parallel(ThisMatlab).ComputerName];
if Parallel(ThisMatlab).Local, if Parallel(ThisMatlab).Local,
waitbarTitle='Local '; waitbarTitle='Local ';
...@@ -95,6 +101,7 @@ catch, ...@@ -95,6 +101,7 @@ catch,
waitbarTitle=[Parallel(ThisMatlab).ComputerName]; waitbarTitle=[Parallel(ThisMatlab).ComputerName];
end end
fMessageStatus(NaN,whoiam,waitbarString, waitbarTitle, Parallel(ThisMatlab)); fMessageStatus(NaN,whoiam,waitbarString, waitbarTitle, Parallel(ThisMatlab));
end
end end
diary off; diary off;
......
...@@ -143,9 +143,16 @@ while (etime(clock,t0)<1200 && ~isempty(fslave)) || ~isempty(dir(['stayalive',in ...@@ -143,9 +143,16 @@ while (etime(clock,t0)<1200 && ~isempty(fslave)) || ~isempty(dir(['stayalive',in
disp(['Job ',fname,' on CPU ',int2str(whoiam),' completed.']); disp(['Job ',fname,' on CPU ',int2str(whoiam),' completed.']);
t0 =clock; % Re-set waiting time of 20 mins t0 =clock; % Re-set waiting time of 20 mins
catch ME catch,
theerror = lasterror;
if strfind(theerror.message,'Master asked to break the job')
disp(['Job ',fname,' on CPU ',int2str(whoiam),' broken from master.']);
fOutputVar.message = theerror;
save([ fname,'_output_',int2str(whoiam),'.mat'],'fOutputVar' )
delete(['P_',fname,'_',int2str(whoiam),'End.txt']);
else
disp(['Job ',fname,' on CPU ',int2str(whoiam),' crashed.']); disp(['Job ',fname,' on CPU ',int2str(whoiam),' crashed.']);
fOutputVar.error = ME; fOutputVar.error = theerror;
save([ fname,'_output_',int2str(whoiam),'.mat'],'fOutputVar' ); save([ fname,'_output_',int2str(whoiam),'.mat'],'fOutputVar' );
waitbarString = fOutputVar.error.message; waitbarString = fOutputVar.error.message;
if Parallel(ThisMatlab).Local, if Parallel(ThisMatlab).Local,
...@@ -156,6 +163,7 @@ while (etime(clock,t0)<1200 && ~isempty(fslave)) || ~isempty(dir(['stayalive',in ...@@ -156,6 +163,7 @@ while (etime(clock,t0)<1200 && ~isempty(fslave)) || ~isempty(dir(['stayalive',in
fMessageStatus(NaN,whoiam,waitbarString, waitbarTitle, Parallel(ThisMatlab)); fMessageStatus(NaN,whoiam,waitbarString, waitbarTitle, Parallel(ThisMatlab));
delete(['P_',fname,'_',int2str(whoiam),'End.txt']); delete(['P_',fname,'_',int2str(whoiam),'End.txt']);
break break
end
end end
end end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment