Skip to content
Snippets Groups Projects
Commit 509c278b authored by Karl-Hermann Wieners's avatar Karl-Hermann Wieners
Browse files

Global: changed import scripts to also handle new style run scripts

parent 323bd211
No related branches found
No related tags found
No related merge requests found
......@@ -28,6 +28,7 @@ exists $opts{x} and $xlog = '\+';
my %file_info = ();
while(<>) {
s/^\d{4,}-\d\d-\d\dT\d\d:\d\d:\d\d: //; # Remove log time stamps
if(my ($mtd, undef, $src, $dst) =
m{^$xlog\s*((cdo|cp|ln)\s.*)\s+(\S+)\s+(\S+)\s*$}) {
#DEBUG# warn($_, join(':', $mtd, $src, $dst), "\n"); #DEBUG#
......
......@@ -20,11 +20,12 @@ then
TMPDIR=.
export TMPDIR
fi
trap 'rm -f $RUN_FILE $LOG_FILE' 0
### trap 'rm -f $RUN_FILE' 0 ###
trap 'rm -rf $RUN_FILE $LOG_FILE $WORK_DIR' 0
RUN_FILE=$(mktemp)
LOG_FILE=$(mktemp)
### echo "Log file is '$LOG_FILE'" >&2 ###
WORK_DIR=$(mktemp -d)
WORK_DIR=${WORK_DIR/.\//$PWD/}
for RUN_SCRIPT
do
......@@ -34,9 +35,19 @@ do
echo "Analyzing '$RUN_SCRIPT'" >&2
sed -r 's:^(\s*)(set\s+\+x\s*$|(set\s+\+\w+)x):\1\3:' "$RUN_SCRIPT" > $RUN_FILE
sed -r '
s:^(\s*)(set\s+\+x\s*$|(set\s+\+\w+)x):\1\3:
s:^(\s*)SCRIPT_DIR=.*$:\1SCRIPT_DIR='$WORK_DIR':
s:^(\s*)EXPDIR=.*$:\1EXPDIR='$WORK_DIR':
' "$RUN_SCRIPT" > $RUN_FILE
COMMAND=$(perl -ne '/^#!\s*(\/\S+)(\s+\+x\s*$|(\s+\+\w+)x|\s*$)/ and print($1, $3); exit' $RUN_FILE)
COMMAND=$(perl -ne '
/^\#!\s*(\/\S+)(
\s+\+x\s*$|
(\s+\+\w+)x|
\s*$
)/x and print($1, $3); exit
' $RUN_FILE)
SLURM_JOB_NUM_NODES=$(perl -ne 'if(/^\s*#SBATCH\s+(--nodes|-N)(=|\s+)(\d+)/) {print($3); exit}' $RUN_FILE)
export SLURM_JOB_NUM_NODES
......@@ -46,13 +57,16 @@ do
SLURM_JOB_CPUS_PER_NODE=72 ${COMMAND:-/bin/sh} -x $RUN_FILE > $LOG_FILE 2>&1
echo "Generating configuration" >&2
eval "$(perl -lne '/^\+ \s*(
eval "$(perl -lne '/^(?:\d{4,}-\d\d-\d\dT\d\d:\d\d:\d\d:\ )?\+\ \s*(
EXPNAME|
(start|end)_date|
(?:start|end)_date|
restart_interval|
atmos_gridID|
atmos_refinement
)(=.*)$/x and print($1, $3, "\n")' $LOG_FILE)"
)(=.*)$/x and print($1, $2)' $LOG_FILE)"
eval "$(perl -lne '/_(\d{4})_(R\d\dB\d\d)_.* icon_grid_G.nc$/ and
print("atmos_gridID=$1\natmos_refinement=$2")' $LOG_FILE)"
cat << EOF
###\\
......
......@@ -92,6 +92,7 @@ my $namelist_group = {};
my $namelist_variable = [];
while(<>) {
s/^\d{4,}-\d\d-\d\dT\d\d:\d\d:\d\d: //; # Remove log time stamps
if($in_doc && m/^EOF/) {
if($open_value) {
$direct and print("\n");
......
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