245245
246246# email withought job submission not allowed
247247if [[ -n $email ]] && [[ -z $jobSubmission ]]; then
248- echo " $( basename $0 ) : ERROR! Email is not supported wihtout job submission;"
248+ echo " $( basename $0 ) : ERROR! Email is not supported wihtout job submission;" >&2
249249 exit 1;
250250fi
251251
252252# parsable without job submission not allowed
253253if [[ -n $parsable ]] && [[ -z $jobSubmission ]]; then
254- echo " $( basename $0 ) : ERROR! --parsable argument cannot be used without job submission"
254+ echo " $( basename $0 ) : ERROR! --parsable argument cannot be used without job submission" >&2
255255 exit 1;
256256fi
257257
264264
265265# depreciation message for --account
266266if [[ -n $account ]]; then
267- echo " $( basename $0 ) : WARNING! --account is no longer a valid option."
268- echo " $( basename $0 ) : configure your scheduler account via --cluster"
267+ echo " $( basename $0 ) : WARNING! --account is no longer a valid option." >&2
268+ echo " $( basename $0 ) : configure your scheduler account via --cluster" >&2
269269fi
270270
271271# if shapefile is provided extract the extents from it
@@ -276,7 +276,7 @@ if [[ -n $shapefile ]]; then
276276 IFS=' :' read -ra sourceProj4 <<< " $(gdalsrsinfo $shapefile | grep -e " PROJ.4" )" 1>&2
277277 # Assuming EPSG:4326 if no definition of the CRS is provided
278278 if [[ ${# sourceProj4[@]} -eq 0 ]]; then
279- echo " $( basename $0 ) : WARNING! Assuming EPSG:4326 for --shape-file as none provided"
279+ echo " $( basename $0 ) : WARNING! Assuming EPSG:4326 for --shape-file as none provided" >&2
280280 sourceProj4=(' PROJ4.J' ' +proj=longlat +datum=WGS84 +no_defs' )
281281 fi
282282 # transform limits and assign to variables
@@ -298,9 +298,9 @@ if [[ -z "${datasetDir}" ]] || \
298298 [[ -z " ${lonLims} " ]] || \
299299 [[ -z " ${prefixStr} " ]]; then
300300
301- echo " $( basename $0 ) : mandatory option(s) missing." ;
302- short_usage;
303- exit 1;
301+ echo " $( basename $0 ) : ERROR! mandatory option(s) missing." >&2
302+ short_usage
303+ exit 1
304304fi
305305
306306
@@ -584,7 +584,6 @@ function call_processing_func () {
584584 --arg " logDir" " $logDir " \
585585 --arg " email" " $email " \
586586 --arg " parsable" " $parsable " \
587- --arg " dependency" " $dependency " \
588587 --argjson " specs" " $( jq -r ' .specs' $cluster ) " \
589588 ' $ARGS.named + $specs | del(.specs)' \
590589 ) "
@@ -655,13 +654,20 @@ function call_processing_func () {
655654 jobDirectiveM4=" $( json_to_m4_vars " $jobDirectiveJSON " ) "
656655 # append the main processing script using m4 macros
657656 jobScriptM4=" -D__CONF__=$jobConfPath "
658- jobScriptM4+=" $( json_to_m4_vars " $schedulerJSON " ) "
657+ jobScriptM4+=( " $( json_to_m4_vars " $schedulerJSON " ) " )
659658
660659 # create scheduler-specific job submission script
661660 # 1. job scheduler directives
662661 m4 ${jobDirectiveM4} ${schedulersPath} /${scheduler} .m4 > \
663662 ${jobScriptPath}
664663
664+ # 1.5 Due to M4's limitation in processing comma-separated values,
665+ # adjust dependencies manually
666+ if [[ -n " $dependency " ]]; then
667+ dependencyLine=" #SBATCH --dependency=afterok:$dependency "
668+ sed -i " 2i\\ ${dependencyLine} " " ${jobScriptPath} "
669+ fi
670+
665671 # 2. module inititation, if applicable
666672 echo -e " \n${jobModulesInit} " >> " ${jobScriptPath} "
667673
0 commit comments