0001 function [joblist,C3PO_status,LUKE_status,orphan_batch_dir,dirsearch] = jobstatus_yp(dirsearch,displaymode)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022 warning off
0023
0024 if nargin < 1,
0025 dirsearch = pwd;
0026 displaymode = 0;
0027 end
0028 if nargin == 1,
0029 displaymode = 0;
0030 end
0031
0032 if isempty(dirsearch) | isnan(dirsearch),
0033 dirsearch = pwd;
0034 end
0035
0036 C3PO_status = '';
0037 LUKE_status ='';
0038
0039 dirinit = pwd;
0040 cd(dirsearch);
0041
0042 filelist = what;
0043 filename = filelist.mat;
0044
0045 jj = 1;
0046 joblist = '';
0047 max_waves = 0;
0048
0049 for ii = 1:length(filename),
0050 if strfind(filename{ii},'LUKE_DATA_')> 0 & strcmp(filename{ii}(1),'L') == 1,
0051 filedata = load(filename{ii},'id_simul','id_simul_o','output','waves','luke_job');
0052 joblist(jj).filename = filename{ii};
0053 joblist(jj).id_simul = filedata.id_simul_o;
0054
0055 if isfield(filedata,'waves')
0056
0057 max_waves = max(max_waves,length(filedata.waves));
0058
0059 for iw = 1:length(filedata.waves),
0060
0061 status(jj).C3PO(iw).notdone = 0;
0062 status(jj).C3PO(iw).completed = 0;
0063 status(jj).C3PO(iw).running = 0;
0064
0065 if isempty(filedata.waves{iw}),
0066 joblist(jj).C3PO(iw).status = 'C3PO ray tracing calculations not done';
0067 joblist(jj).C3PO(iw).host = '';
0068 joblist(jj).C3PO(iw).jobid = NaN;
0069 joblist(jj).C3PO(iw).batch_dir = '';
0070 status(jj).C3PO(iw).notdone = 1;
0071 elseif isfield(filedata.waves{iw},'rays')
0072 joblist(jj).C3PO(iw).status = 'C3PO ray tracing calculations completed';
0073 joblist(jj).C3PO(iw).host = '';
0074 joblist(jj).C3PO(iw).jobid = NaN;
0075 joblist(jj).C3PO(iw).batch_dir = '';
0076 status(jj).C3PO(iw).completed = 1;
0077 elseif isfield(filedata.waves{iw},'job')
0078 joblist(jj).C3PO(iw).status = 'C3PO ray tracing calculations running';
0079 if isempty(filedata.waves{iw}.job.remote.host),
0080 joblist(jj).C3PO(iw).host = 'local';
0081 else
0082 joblist(jj).C3PO(iw).host = filedata.waves{iw}.job.remote.host;
0083 end
0084
0085 joblist(jj).C3PO(iw).jobid = filedata.waves{iw}.job.id;
0086 joblist(jj).C3PO(iw).batch_dir = filedata.waves{iw}.job.batch_dir;
0087 status(jj).C3PO(iw).running = 1;
0088 end
0089 end
0090 end
0091
0092 status(jj).LUKE.notdone = 0;
0093 status(jj).LUKE.completed = 0;
0094 status(jj).LUKE.running = 0;
0095
0096 if isempty(filedata.output)
0097 if isfield(filedata,'luke_job') & ~isempty(filedata.luke_job),
0098 joblist(jj).LUKE.status = 'LUKE Fokker-Planck calculations running';
0099 if isfield(filedata.luke_job,'remote')
0100 if isempty(filedata.luke_job.remote.host),
0101 joblist(jj).LUKE.host = 'local';
0102 else
0103 joblist(jj).LUKE.host = filedata.luke_job.remote.host;
0104 end
0105 else
0106 joblist(jj).LUKE.host = 'local';
0107 end
0108
0109 joblist(jj).LUKE.jobid = filedata.luke_job.id;
0110 if isfield(filedata.luke_job,'batch_dir')
0111 joblist(jj).LUKE.batch_dir = filedata.luke_job.batch_dir;
0112 else
0113 joblist(jj).LUKE.batch_dir = '';
0114 end
0115
0116 status(jj).LUKE.running = 1;
0117 else
0118 joblist(jj).LUKE.status = 'LUKE Fokker-Planck calculations not done';
0119 joblist(jj).LUKE.host = '';
0120 joblist(jj).LUKE.jobid = NaN;
0121 joblist(jj).LUKE.batch_dir = '';
0122 status(jj).LUKE.notdone = 1;
0123 end
0124 elseif isfield(filedata.output,'Znorm'),
0125 joblist(jj).LUKE.status = 'LUKE Fokker-Planck calculations completed';
0126 joblist(jj).LUKE.host = '';
0127 joblist(jj).LUKE.jobid = NaN;
0128 joblist(jj).LUKE.batch_dir = '';
0129 status(jj).LUKE.completed = 1;
0130 end
0131
0132 jj = jj + 1;
0133 end
0134 end
0135
0136 LUKE_status.notdone = 0;
0137 LUKE_status.completed = 0;
0138 LUKE_status.running = 0;
0139
0140 for iw = 1:max_waves,
0141 C3PO_status(iw).notdone = 0;
0142 C3PO_status(iw).completed = 0;
0143 C3PO_status(iw).running = 0;
0144 end
0145
0146 for jj = 1:length(joblist),
0147 LUKE_status.notdone = LUKE_status.notdone + status(jj).LUKE.notdone;
0148 LUKE_status.completed = LUKE_status.completed + status(jj).LUKE.completed;
0149 LUKE_status.running = LUKE_status.running + status(jj).LUKE.running;
0150
0151 for iw = 1:length(status(jj).C3PO),
0152 C3PO_status(iw).notdone = C3PO_status(iw).notdone + status(jj).C3PO(iw).notdone;
0153 C3PO_status(iw).completed = C3PO_status(iw).completed + status(jj).C3PO(iw).completed;
0154 C3PO_status(iw).running = C3PO_status(iw).running + status(jj).C3PO(iw).running;
0155 end
0156 end
0157
0158 if displaymode,
0159 disp(['-------------------------------------------------------------------------------------'])
0160 disp(['-------------------------------------------------------------------------------------'])
0161 disp(['Simulations status in folder : ',dirsearch]);
0162 disp(['-------------------------------------------------------------------------------------'])
0163 disp(['-------------------------------------------------------------------------------------'])
0164 disp(['Total number of simulations : ',int2str(length(joblist))]);
0165 for iw = 1:length(C3PO_status)
0166 disp(['Total number of simulations for wave #',int2str(iw),' not done (C3PO): ',int2str(C3PO_status(iw).notdone)]);
0167 disp(['Total number of simulations for wave #',int2str(iw),' completed (C3PO): ',int2str(C3PO_status(iw).completed)]);
0168 disp(['Total number of simulations for wave #',int2str(iw),' running (C3PO) : ',int2str(C3PO_status(iw).running)]);
0169 end
0170 disp(['Total number of simulations not done (LUKE): ',int2str(LUKE_status.notdone)]);
0171 disp(['Total number of simulations completed (LUKE): ',int2str(LUKE_status.completed)]);
0172 disp(['Total number of simulations running (LUKE) : ',int2str(LUKE_status.running)]);
0173 disp(['-------------------------------------------------------------------------------------'])
0174 disp(['-------------------------------------------------------------------------------------'])
0175
0176 for ii = 1:length(joblist),
0177 disp([' - id_simul : ',joblist(ii).id_simul]);
0178
0179 for iw = 1:length(joblist(ii).C3PO)
0180 if strcmp(joblist(ii).C3PO(iw).status,'C3PO ray tracing calculations not done'),
0181 disp([' - C3PO (wave #',int2str(iw),') status: **** ',joblist(ii).C3PO(iw).status,' ****']);
0182 else
0183 disp([' - C3PO (wave #',int2str(iw),') status: ',joblist(ii).C3PO(iw).status]);
0184 end
0185 if strcmp(joblist(ii).C3PO(iw).status,'C3PO ray tracing calculations running'),
0186 disp([' - C3PO (wave #',int2str(iw),') remote host address : ',joblist(ii).C3PO(iw).host]);
0187 disp([' - C3PO (wave #',int2str(iw),') remote jobid : ',joblist(ii).C3PO(iw).jobid]);
0188 disp([' - C3PO (wave #',int2str(iw),') batch directory : ',joblist(ii).C3PO(iw).batch_dir]);
0189 end
0190 end
0191
0192 if strcmp(joblist(ii).LUKE.status,'LUKE Fokker-Planck calculations not done'),
0193 disp([' - LUKE status: **** ',joblist(ii).LUKE.status, ' ****']);
0194 else
0195 disp([' - LUKE status: ',joblist(ii).LUKE.status]);
0196 end
0197 if strcmp(joblist(ii).LUKE.status,'LUKE Fokker-Planck calculations running'),
0198 disp([' - LUKE remote host address : ',joblist(ii).LUKE.host]);
0199 disp([' - LUKE remote jobid : ',joblist(ii).LUKE.jobid]);
0200 disp([' - LUKE batch directory : ',joblist(ii).LUKE.batch_dir]);
0201 end
0202
0203 disp(['-------------------------------------------------------------------------------------'])
0204 disp(['-------------------------------------------------------------------------------------'])
0205 end
0206 end
0207
0208 if displaymode
0209 disp(['Orphan batch directories']);
0210 disp(['-------------------------------------------------------------------------------------'])
0211 disp(['-------------------------------------------------------------------------------------'])
0212 end
0213
0214 allfileslist = dir;
0215 io = 1;
0216 orphan_batch_dir = '';
0217
0218 for ii = 1:length(allfileslist),
0219 if allfileslist(ii).isdir & strfind(allfileslist(ii).name,'batch_'),
0220
0221 cd(allfileslist(ii).name),
0222
0223 datain_matrun = load(['MAT_RUN_',allfileslist(ii).name(7:end),'.mat']);
0224
0225 if ~isfield(datain_matrun,'arg_range');
0226 orphan_batch_dir(io).name = allfileslist(ii).name;
0227 orphan_batch_dir(io).simul = '';
0228 orphan_batch_dir(io).code = '';
0229 orphan_batch_dir(io).remote = '';
0230 orphan_batch_dir(io).status = 1;
0231
0232 disp([' - batch directory : ',orphan_batch_dir(io).name,' is orphan. You can delete it.']);
0233
0234 io = io + 1;
0235 cd('..');
0236
0237 clear datain_matrun
0238
0239 break;
0240 end
0241
0242 cd('..');
0243 datain_lukedata = load(['LUKE_DATA_',datain_matrun.arg_range{:}.simul_in,'.mat'],'dkepath');
0244
0245 orphan_batch_dir(io).name = allfileslist(ii).name;
0246 orphan_batch_dir(io).simul = datain_matrun.arg_range{:}.simul_in;
0247 orphan_batch_dir(io).code = '';
0248 orphan_batch_dir(io).remote = datain_lukedata.dkepath.profilestr(datain_matrun.dkecluster.scheduler.remnum);
0249 orphan_batch_dir(io).status = 1;
0250
0251 clear datain_matrun datain_lukedata
0252
0253
0254 for jj = 1:length(joblist),
0255
0256 if strcmp(joblist(jj).LUKE.status,'LUKE Fokker-Planck calculations running'),
0257 if strcmp(allfileslist(ii).name,joblist(jj).LUKE.batch_dir(1:end-1)),
0258 orphan_batch_dir(io).simul = joblist(jj).id_simul;
0259 orphan_batch_dir(io).code = 'LUKE';
0260 orphan_batch_dir(io).remote = joblist(jj).LUKE.host;
0261 orphan_batch_dir(io).status = 0;
0262 end
0263 end
0264
0265 for iw = 1:length(joblist(jj).C3PO),
0266 if strcmp(joblist(jj).C3PO(iw).status,'C3PO ray tracing calculations running'),
0267 if strcmp(allfileslist(ii).name,joblist(jj).C3PO(iw).batch_dir),
0268 orphan_batch_dir(io).simul = joblist(jj).id_simul;
0269 orphan_batch_dir(io).code = ['C3PO, wave #',int2str(iw)];
0270 orphan_batch_dir(io).host = joblist(jj).C3PO(iw).host;
0271 orphan_batch_dir(io).status = 0;
0272
0273 end
0274 end
0275 end
0276 end
0277
0278 if displaymode,
0279 if orphan_batch_dir(io).status == 1,
0280 disp([' - batch directory : ',orphan_batch_dir(io).name,' is orphan. You can delete it.']);
0281 end
0282 end
0283
0284 io = io + 1;
0285 end
0286 end
0287
0288 cd(dirinit);
0289
0290 warning on
0291
0292