Commit 79d77e50 authored by Brad Kennedy's avatar Brad Kennedy
Browse files

* VERSION: 1.0.1

        * batch/exec_func/@ef_base_driver/submit_line.m: changed mfile name handling

        * batch/exec_func/@ef_sbatch_driver/format_scheduler.m: bug fix with order
          of sprintf values

        * batch/exec_func/ef_exec_str.m: code-cleanup, mfile_name default string
          swap added

        * batch/exec_func/ef_gen_m.m: same as above

        * batch/exec_func/octave_exit_wrapper.m: added sqsub to octave exit wrapper
          jobid printers
parent 35d9fa4a
2017-08-01 Brad Kennedy <bk@co60.ca>
* VERSION: 1.0.1
* batch/exec_func/@ef_base_driver/submit_line.m: changed mfile name handling
* batch/exec_func/@ef_sbatch_driver/format_scheduler.m: bug fix with order
of sprintf values
* batch/exec_func/ef_exec_str.m: code-cleanup, mfile_name default string
swap added
* batch/exec_func/ef_gen_m.m: same as above
* batch/exec_func/octave_exit_wrapper.m: added sqsub to octave exit wrapper
jobid printers
2017-07-25 Brad Kennedy <bk@co60.ca>
* CHANGELOG: Change changelog format to actually contain changes
ensure you follow the format and put newer changes above this one
* eegplugin_batch_context.m: Added version such that it generates it
from the VERSION file in this directory
\ No newline at end of file
from the VERSION file in this directory
v1.0.0
\ No newline at end of file
v1.0.1
......@@ -59,6 +59,8 @@ job_name = key_strswap(job_name, 'batch_hfn', histfname);
%% mfile_name and backup as job_name for compat
mfile_name = batch_config.mfile_name;
mfile_name = mfile_name_gen(mfile_name, datafname, histfname, job_name);
% batch_dfn
mfile_name = key_strswap(mfile_name, 'batch_dfn', datafname);
% batch_hfn
......
......@@ -40,7 +40,8 @@ function out = format_scheduler(~, job_spec)
if ~isempty(job_spec.job_init)
out = [out job_spec.job_init];
end
out = sprintf('%ssbatch', out);
retry_fails = 'analysis/support/dependencies/eeglab_asr_amica/plugins/batch_context/batch/exec_func/retry-fails.sh';
out = sprintf('%s%s sbatch', out, retry_fails);
if ~isempty(job_spec.name)
out = sprintf('%s --job-name=%s', out, job_spec.name);
end
......
......@@ -50,22 +50,25 @@ mkdir(fullfile(job_struct.context_config.log,job_struct.m_path));
%% GET THE STRING FROM THE HTB FILES AND START BUILDING BATCHHISTSTR...
%Create batchHistStr from the current HistFName file...
[cPath,root_hfn,cExt]=fileparts(job_struct.batch_hfn);
eval(['fidRHT=fopen(''' job_struct.batch_hfp job_struct.batch_hfn ''',''r'');']);
batchHistStr=char(fread(fidRHT,'char')');
fidRHT = fopen([job_struct.batch_hfp job_struct.batch_hfn],'r');
batchHistStr = char(fread(fidRHT,'char')');
fclose(fidRHT);
qsubstr='';
disp(['Generating .m files in ',fullfile(job_struct.context_config.log,job_struct.m_path),'...']);
disp(['Generating .m files in ', fullfile( ...
job_struct.context_config.log, job_struct.m_path), '...']);
%% START LOOP THROUGH DATA FILES...
for bfni=1:length(job_struct.batch_dfn);
% DO FOR EACH DATA FILE ...
%% INITIATE TMPHISTSTR...
mfile_name = mfile_name_gen(job_struct.batch_config.mfile_name, ...
job_struct.batch_dfn{bfni}, job_struct.batch_hfn, ...
job_struct.batch_config.job_name);
%% SWAP THE HISTORY STRING KEY STRINGS...
batchStr=batch_strswap([batchInitStr,batchHistStr],job_struct.batch_config, ...
'datafname',job_struct.batch_dfn{bfni}, ...
'datafpath',job_struct.batch_dfp, ...
'mfile_name', mfile_name, ...
'log',job_struct.context_config.log, ...
'local_project',job_struct.context_config.local_project, ...
'local_dependency',job_struct.context_config.local_dependency, ...
......
......@@ -64,7 +64,7 @@ if ~strcmp(job_struct.batch_config.software, 'none') ...
%% GET THE STRING FROM THE HTB FILES AND START BUILDING BATCHHISTSTR...
%Create batchHistStr from the current HistFName file...
[~, root_hfn, ~] = fileparts(job_struct.batch_hfn);
eval(['fidRHT=fopen(''' job_struct.batch_hfp job_struct.batch_hfn ''',''r'');']);
fidRHT = fopen([job_struct.batch_hfp job_struct.batch_hfn ],'r');
batchHistStr = char(fread(fidRHT,'char')');
qsubstr='';
......@@ -74,14 +74,17 @@ if ~strcmp(job_struct.batch_config.software, 'none') ...
job_struct.m_path), '...']);
%% START LOOP THROUGH DATA FILES...
for bfni=1:length(job_struct.batch_dfn);
% DO FOR EACH DATA FILE ...
% DO FOR EACH DATA FILE ...
%% INITIATE TMPHISTSTR...
mfile_name = mfile_name_gen(job_struct.batch_config.mfile_name, ...
job_struct.batch_dfn{bfni}, job_struct.batch_hfn, ...
job_struct.batch_config.job_name);
%% SWAP THE HISTORY STRING KEY STRINGS...
batchStr = batch_strswap([batchInitStr, batchHistStr], ...
job_struct.batch_config, ...
'datafname', job_struct.batch_dfn{bfni}, ...
'datafpath', job_struct.batch_dfp, ...
'mfile_name', mfile_name, ...
'log', job_struct.context_config.log, ...
'local_project', job_struct.context_config.local_project, ...
'local_dependency', job_struct.context_config.local_dependency, ...
......
......@@ -34,10 +34,15 @@ fname = arg_list{1};
arg_list = arg_list(2:end);
%% System specific jobid printing
% This is for internal benchmarking
jobid = getenv('SLURM_JOBID');
if ~isempty(jobid)
disp(['Jobid is: ' jobid]);
end
jobid = getenv('SQ_JOBID');
if ~isempty(jobid)
disp(['Jobid is: ' jobid]);
end
%% Run the wrapped script
......
function [ mfile_name ] = mfile_name_gen(mfile_name, datafname, histfname, job_name)
% batch_dfn
mfile_name = key_strswap(mfile_name, 'batch_dfn', datafname);
% batch_hfn
mfile_name = key_strswap(mfile_name, 'batch_hfn', histfname);
if isempty(mfile_name)
% Awe yeah recursion
mfile_name = mfile_name_gen(job_name, datafname, histfname, job_name);
end
end
#!/bin/bash
set -eu
if [ $# -lt 1 ] ; then
cat << HEAD
Usage: $0 [wrapped_program] [otherargs...]
Runs wrapped_program with otherargs a few times with a delay
that allows the program to fail a few times but recover
HEAD
exit 1
fi
wp="$1"
shift
function rand_float {
echo "$RANDOM/32767.0" | bc -l
}
retrys=20
set +e
for i in `seq $retrys`; do
"$wp" "$@"
if [ $? -eq 0 ] ; then
exit 0;
fi
echo "Failed to run $wp, try $i/$retrys, sleeping for random time"
sleep `rand_float`
done
set -e
......@@ -155,6 +155,8 @@ end
tmp_histstr=key_strswap(tmp_histstr,'batch_dfn',g.datafname);
% batch_dfp
tmp_histstr=key_strswap(tmp_histstr,'batch_dfp',g.datafpath);
% batch_dfn
tmp_histstr=key_strswap(tmp_histstr,'mfile_name',g.mfile_name);
%current_dir
tmp_histstr=key_strswap(tmp_histstr,'batch_cd',cd);
%log
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment