Skip to content
Snippets Groups Projects
Commit 9d36f015 authored by Laura Nervo's avatar Laura Nervo Committed by Nicola Vigano
Browse files

OAR : fix bug for .log .err .out filenames (use same fileroot as for file .oar and .params


Signed-off-by: default avatarLaura Nervo <laura.nervo@esrf.fr>

git-svn-id: https://svn.code.sf.net/p/dct/code/trunk@635 4c865b51-4357-4376-afb4-474e03ccb993
parent 01eedc86
No related branches found
No related tags found
No related merge requests found
function OAR_make(executable,first,last,njobs,otherparameters,submit,varargin) function OAR_make(executable,first,last,njobs,otherparameters,submitflag,varargin)
% OAR_MAKE Submit jobs to OAR. % OAR_MAKE Submit jobs to OAR.
% OAR_MAKE(executable,first,last,njobs,otherparameters,submitflag,varargin) % OAR_MAKE(executable,first,last,njobs,otherparameters,submitflag,varargin)
% ------------------------------------------------------------------------- % -------------------------------------------------------------------------
...@@ -16,7 +16,7 @@ function OAR_make(executable,first,last,njobs,otherparameters,submit,varargin) ...@@ -16,7 +16,7 @@ function OAR_make(executable,first,last,njobs,otherparameters,submit,varargin)
% otherparameters = all the other parameters to be passed to the % otherparameters = all the other parameters to be passed to the
% function as a string {''} % function as a string {''}
% (ex. 'par1 par2 par3') % (ex. 'par1 par2 par3')
% submit = logical to sumbit or not the jobs {true} % submitflag = logical to sumbit or not the jobs {true}
% varargin = the values of the OAR directives as pairs % varargin = the values of the OAR directives as pairs
% i.e. 'walltime','3:00:00','mem',4000, ... % i.e. 'walltime','3:00:00','mem',4000, ...
% %
...@@ -57,7 +57,7 @@ function OAR_make(executable,first,last,njobs,otherparameters,submit,varargin) ...@@ -57,7 +57,7 @@ function OAR_make(executable,first,last,njobs,otherparameters,submit,varargin)
% Change name of structure parameters into oarparameters % Change name of structure parameters into oarparameters
% Change argument oarparameters into oardirectives % Change argument oarparameters into oardirectives
% Add flag to submit or not the jobs % Add flag to submit or not the jobs
% Create a function submit to submit later the jobs % Create a function submitOar to submit later the jobs
% %
% %
...@@ -94,7 +94,7 @@ disp(' ****************************************') ...@@ -94,7 +94,7 @@ disp(' ****************************************')
disp(' ******* Submitting jobs to OAR *******') disp(' ******* Submitting jobs to OAR *******')
disp(' ****************************************') disp(' ****************************************')
disp(' ') disp(' ')
hostname = getenv('HOSTNAME'); hostname = getenv('HOSTNAME');
user = getenv('USER'); user = getenv('USER');
...@@ -117,8 +117,8 @@ end ...@@ -117,8 +117,8 @@ end
if (~exist('otherparameters','var') || (nargin < 5)) if (~exist('otherparameters','var') || (nargin < 5))
otherparameters = ''; otherparameters = '';
end end
if (~exist('submit','var') || isempty(submit) || (nargin < 6)) if (~exist('submitflag','var') || isempty(submitflag) || (nargin < 6))
submit = true; submitflag = true;
end end
% DEBUG: print arguments % DEBUG: print arguments
...@@ -161,7 +161,8 @@ out.odisp(['Log files now in ' logdir]) ...@@ -161,7 +161,8 @@ out.odisp(['Log files now in ' logdir])
% this file contains the parameters for oar % this file contains the parameters for oar
tmpname = [tempfilename '.oar']; tmpname = [tempfilename '.oar'];
tname = fullfile(subdir,tmpname); tname = fullfile(subdir,tmpname);
fileroot = ['oar.' fname '.%jobid%'];
fileroot = ['oar.' fname '-' getenv('USER') '_' num2str(oarpars.resubmit) '.%jobid%'];
logerr = fullfile(logdir,[fileroot '.err']); logerr = fullfile(logdir,[fileroot '.err']);
logout = strrep(logerr,'.err','.out'); logout = strrep(logerr,'.err','.out');
logname = strrep(logerr,'.err','.log'); logname = strrep(logerr,'.err','.log');
...@@ -308,7 +309,6 @@ disp(['OAR parameters: ' set.oarparameters]) ...@@ -308,7 +309,6 @@ disp(['OAR parameters: ' set.oarparameters])
%% Save OAR directives in .log file %% Save OAR directives in .log file
out.fprintf('Saving parameters in the .log file...') out.fprintf('Saving parameters in the .log file...')
fid = fopen(set.logname, 'w'); fid = fopen(set.logname, 'w');
fprintf(fid, '# General information\n'); fprintf(fid, '# General information\n');
names = fieldnames(set); names = fieldnames(set);
...@@ -346,17 +346,17 @@ out.fprintf('\n\nSaving the oarset.mat file...') ...@@ -346,17 +346,17 @@ out.fprintf('\n\nSaving the oarset.mat file...')
cd(set.launchdir); cd(set.launchdir);
save([set.launchdir filesep 'oarset.mat'], 'set'); save([set.launchdir filesep 'oarset.mat'], 'set');
out.fprintf('done!\n') out.fprintf('done!\n')
%% Submit the job(s) %% Submit the job(s)
if submit if submitflag
submitOar(false); submitOar(false);
else else
disp([fname ' is ready for submission']); disp([fname ' is ready for submission']);
disp('Submit the jobs running the function, choosing true/false for debugging') disp('Submit the jobs running the function, choosing true/false for debugging')
disp(' submit(debug)') disp(' submitOar(debug)')
end end
end %function OAR_make_v9 end %function OAR_make_v10
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