From b3e8b9079b0dcca7b06a219c1648fc594f50e9ad Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Mon, 24 Feb 2014 13:57:02 +0100 Subject: [PATCH 1/5] Close #225 - Add --submit flag help --- src/tools/bin/tbg | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/tools/bin/tbg b/src/tools/bin/tbg index c57458922e..dc181a245e 100755 --- a/src/tools/bin/tbg +++ b/src/tools/bin/tbg @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright 2013 Axel Huebl, Rene Widera, Richard Pausch +# Copyright 2013-2014 Axel Huebl, Rene Widera, Richard Pausch # # This file is part of PIConGPU. # @@ -30,11 +30,11 @@ ####################### -# $1 name of variable with template descriptions +# $1 name of variable with template descriptions ######################## function tooltpl_replace { - + eval tooltpl_replace_data="\$$1" eval tooltpl_replace_input="\$$2" @@ -77,12 +77,12 @@ function run_cfg_and_get_solved_variables do eval "$i" done - - #filter all TBG variables + + #filter all TBG variables tooltbl_env=`set | grep "^[[:alpha:]][[:alnum:]_]*=.*" | grep -v tooltpl ` data="$tooltbl_env" - + unresolved_vars=`echo -e "$data" | grep "\![[:alpha:]][[:alnum:]_]*" | wc -l` unresolved_vars_old=$(( unresolved_vars + 1)) @@ -160,6 +160,7 @@ help() echo "usage: tbg -c cfgFile [-s submitsystem] [-t templateFile] [-p project] [-o \"VARNAME1=10 VARNAME2=5\"] [-h] destinationPath" echo "" echo "-c | --cfg file - Configuration file to set up batch file." + echo "-s | --submit command - Submit command (qsub, \"qsub -h\", sbatch, ...)" echo "-t | --tpl file - Template to create a batch file from." echo " tbg will use stdin, if no file is specified." echo "-p | --project folder - Project folder containing sourcecode and binaries" @@ -310,4 +311,6 @@ check_final tbg/submit.start "$tooltpl_file_data" if [ -n "$submit_command" ] ; then $submit_command tbg/submit.start +else + echo "nothing to submit (-s option set?)" fi From f5b710cf5b73a3df488a17c4131b118272a3ff46 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Mon, 24 Feb 2014 13:59:27 +0100 Subject: [PATCH 2/5] Close #192 - Unreplaced Variables Cause An Error - change warning to error state - abort tbg and do not submit malformed job script --- src/tools/bin/tbg | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/tools/bin/tbg b/src/tools/bin/tbg index dc181a245e..12fd7069ed 100755 --- a/src/tools/bin/tbg +++ b/src/tools/bin/tbg @@ -121,7 +121,7 @@ function check_final not_replaced_cnt=`echo $not_replaced | wc -w` if [ $not_replaced_cnt -gt 0 ] ; then - echo "WARNING: $not_replaced_cnt variable(s) _not_ replaced from template (tpl):" + echo "ERROR: $not_replaced_cnt variable(s) _not_ replaced from template (tpl):" echo $not_replaced #create an OR concated pattern @@ -134,6 +134,9 @@ function check_final n=$(( n+1 )) echo $org_line | awk -v line=$n '{ if ($0 ~ /'$nrv_or'/) print "line "line }' done < <(echo -e "$org_file") + + # abort script (will no be submitted) + exit 1 fi } From c5fe31af3f26abf49180f01504ad5e146f49c765 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Mon, 24 Feb 2014 14:14:20 +0100 Subject: [PATCH 3/5] Fix Typos in Help and Functions --- src/tools/bin/tbg | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/tools/bin/tbg b/src/tools/bin/tbg index 12fd7069ed..dc6436867e 100755 --- a/src/tools/bin/tbg +++ b/src/tools/bin/tbg @@ -149,7 +149,7 @@ function get_tooltpl_value cat /dev/stdin | grep $1 | cut -d"=" -f2- | tooltpl_replace $2 } -function absulte_path() +function absolute_path() { cd $1 pwd @@ -157,8 +157,8 @@ function absulte_path() help() { - echo "tbg (template batch generator) create new folder for a batch job" - echo "and copy in all importend files" + echo "TBG (template batch generator)" + echo "create a new folder for a batch job and copy in all important files" echo "" echo "usage: tbg -c cfgFile [-s submitsystem] [-t templateFile] [-p project] [-o \"VARNAME1=10 VARNAME2=5\"] [-h] destinationPath" echo "" @@ -182,7 +182,6 @@ help() echo " TBG_cfgFile - full absolut path and name of cfg file" echo " TBG_projectPath - absolut project path (see option --project)" echo " TBG_dstPath - absolute path to destination directory" - } #!/bin/bash @@ -249,7 +248,7 @@ if [ ! -f $cfg_file ] ; then exit 1; fi -projectPath=`absulte_path $projectPath` +projectPath=`absolute_path $projectPath` job_name=`basename "$outDir"` # (up to 15 characters, no blank spaces, reduce to alphanumeric characters) @@ -282,7 +281,7 @@ export TBG_jobName="$job_name" export TBG_jobNameShort="$job_shortname" cfgFileName=`basename $cfg_file` cfgRelativPath=`dirname $cfg_file` -export TBG_cfgPath=`absulte_path "$cfgRelativPath"` +export TBG_cfgPath=`absolute_path "$cfgRelativPath"` export TBG_cfgFile="$TBG_cfgPath/$cfgFileName" export TBG_projectPath="$projectPath" From 1bd8869f647539348caeccdad4138733e55a62a6 Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Mon, 24 Feb 2014 14:18:13 +0100 Subject: [PATCH 4/5] More Typos --- src/tools/bin/tbg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/bin/tbg b/src/tools/bin/tbg index dc6436867e..6fc71b0d61 100755 --- a/src/tools/bin/tbg +++ b/src/tools/bin/tbg @@ -175,7 +175,7 @@ help() echo "destinationPath - Directory for simulation output. " echo " " echo " " - echo "tbg exports the following variables, which can used in cfg and tpl files any time:" + echo "TBG exports the following variables, which can be used in cfg and tpl files at any time:" echo " TBG_jobName - name of the job" echo " TBG_jobNameShort - short name of the job, without blanks" echo " TBG_cfgPath - absolut path to cfg file" From 14bb148d1c838e35f338e533d8c017d3e6d8fabf Mon Sep 17 00:00:00 2001 From: Axel Huebl Date: Mon, 24 Feb 2014 16:41:51 +0100 Subject: [PATCH 5/5] Typo noT --- src/tools/bin/tbg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/bin/tbg b/src/tools/bin/tbg index 6fc71b0d61..369a618ee0 100755 --- a/src/tools/bin/tbg +++ b/src/tools/bin/tbg @@ -135,7 +135,7 @@ function check_final echo $org_line | awk -v line=$n '{ if ($0 ~ /'$nrv_or'/) print "line "line }' done < <(echo -e "$org_file") - # abort script (will no be submitted) + # abort script (will not be submitted) exit 1 fi }