Skip to content
Snippets Groups Projects
Commit 33e9db79 authored by Andrew King's avatar Andrew King Committed by Nicola Vigano
Browse files

More... better oar reading

git-svn-id: https://svn.code.sf.net/p/dct/code/trunk@593 4c865b51-4357-4376-afb4-474e03ccb993
parent a5000a8a
No related branches found
No related tags found
No related merge requests found
......@@ -38,22 +38,43 @@ prompt=[];
if exist('oar.log', 'file')
fid=fopen('oar.log');
oarlog=textscan(fid, '%s %s %d %s %s');
fclose(fid)
fclose(fid);
% most recent function name
names=oarlog{2};
lastoar_name=names{end};
arrays=oarlog{3};
lastoar_array=arrays(end);
[~, status]=unix(sprintf('oarstat --array %d', lastoar_array));
% read job statuses from this text - assume format doesn't change!
% read from the third line to the end
job_status=status(230:81:length(status));
% read job numbers from this text - assume format doesn't change!
% get exit code with gtOarGetStats
ndx=160;
job_status='';
count=0;
query{1}='exit_code'; query{2}='state';
while ndx<length(status)
count=count+1;
job=str2num(status(ndx:ndx+6));
jobstat=gtOarGetStats(job, query);
exit_code=jobstat{1}.exit_code;
state=jobstat{1}.state;
if strcmp(state, 'Running')
job_status(count)='R';
elseif strcmp(state, 'Terminated') && strcmp(exit_code, '0 (0,0,0)')
job_status(count)='T';
elseif strcmp(state, 'Terminated')
job_status(count)='E';
else
disp('could read this oar job...')
end
ndx=ndx+81;
end
launch_time=status((end-30):(end-12));
fprintf('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n')
fprintf('Last OAR job was %s \n(array %d launched at %s) \n', lastoar_name, lastoar_array, launch_time)
% finished?
if all(job_status=='T')
fprintf('All these jobs have finished correctly\n')
if all(job_status=='T' | job_status=='E')
fprintf('All these jobs have finished\n')
end
% errors?
if all(job_status=='E')
......@@ -298,7 +319,8 @@ for ii=length(parameters.cryst)
n_pairs_inp(ii)=length(inp.tot.pairid);
if n_pairs_inp(ii)~=n_pairs(ii)
fprintf('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n')
fprintf('Strong warning!!! Number of pairs in the indexing input file does not match the spotpair table\n')
fprintf('!!! Strong warning !!! \n')
fprintf('Number of pairs in the indexing input file does not match the spotpair table\n')
fprintf('If you have update the pair matching, un-check "use input file" in gtSetupIndexing\n')
else
fprintf('indexing input looks consistant with the spot pairs table\n')
......@@ -311,10 +333,10 @@ for ii=length(parameters.cryst)
fprintf('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n')
% is there an output file?
d=dir(sprintf('4_grains/phase_%02d/index.mat', ii));
if ~isempty(d)
d2=dir(sprintf('4_grains/phase_%02d/index.mat', ii));
if ~isempty(d2)
fprintf('Indexing results found for phase %02d:\n', ii)
fprintf('Latest output file date: %s\n', d.date)
fprintf('Latest output file date: %s\n', d2.date)
a=load(sprintf('4_grains/phase_%02d/index.mat', ii));
n_grains(ii)=length(a.grain);
fprintf('Latest output contains %d indexed grains\n', n_grains(ii))
......@@ -322,6 +344,13 @@ for ii=length(parameters.cryst)
fprintf('No indexing output found for phase %02d\n', ii)
end
fprintf('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n')
if d.datenum>d2.datenum
fprintf('!!! Strong warning !!! \n')
fprintf('Input file is newer than the output file! Indexing has started but not been finished\n')
fprintf('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n')
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FORWARD SIMULATION STATUS
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment