245
245
246
246
# email withought job submission not allowed
247
247
if [[ -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
249
249
exit 1;
250
250
fi
251
251
252
252
# parsable without job submission not allowed
253
253
if [[ -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
255
255
exit 1;
256
256
fi
257
257
264
264
265
265
# depreciation message for --account
266
266
if [[ -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
269
269
fi
270
270
271
271
# if shapefile is provided extract the extents from it
@@ -276,7 +276,7 @@ if [[ -n $shapefile ]]; then
276
276
IFS=' :' read -ra sourceProj4 <<< " $(gdalsrsinfo $shapefile | grep -e " PROJ.4" )" 1>&2
277
277
# Assuming EPSG:4326 if no definition of the CRS is provided
278
278
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
280
280
sourceProj4=(' PROJ4.J' ' +proj=longlat +datum=WGS84 +no_defs' )
281
281
fi
282
282
# transform limits and assign to variables
@@ -298,9 +298,9 @@ if [[ -z "${datasetDir}" ]] || \
298
298
[[ -z " ${lonLims} " ]] || \
299
299
[[ -z " ${prefixStr} " ]]; then
300
300
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
304
304
fi
305
305
306
306
@@ -584,7 +584,6 @@ function call_processing_func () {
584
584
--arg " logDir" " $logDir " \
585
585
--arg " email" " $email " \
586
586
--arg " parsable" " $parsable " \
587
- --arg " dependency" " $dependency " \
588
587
--argjson " specs" " $( jq -r ' .specs' $cluster ) " \
589
588
' $ARGS.named + $specs | del(.specs)' \
590
589
) "
@@ -655,13 +654,20 @@ function call_processing_func () {
655
654
jobDirectiveM4=" $( json_to_m4_vars " $jobDirectiveJSON " ) "
656
655
# append the main processing script using m4 macros
657
656
jobScriptM4=" -D__CONF__=$jobConfPath "
658
- jobScriptM4+=" $( json_to_m4_vars " $schedulerJSON " ) "
657
+ jobScriptM4+=( " $( json_to_m4_vars " $schedulerJSON " ) " )
659
658
660
659
# create scheduler-specific job submission script
661
660
# 1. job scheduler directives
662
661
m4 ${jobDirectiveM4} ${schedulersPath} /${scheduler} .m4 > \
663
662
${jobScriptPath}
664
663
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
+
665
671
# 2. module inititation, if applicable
666
672
echo -e " \n${jobModulesInit} " >> " ${jobScriptPath} "
667
673
0 commit comments