@@ -282,7 +282,36 @@ function checkPrerequisites
282
282
return 0
283
283
}
284
284
285
- function checkForComplexHelpArgument()
285
+ function assertRequiredFileIsNonEmpty()
286
+ {
287
+ local fileName=$1
288
+ local fileDescription=$2
289
+ if [[ -z ${fileName} ]]; then
290
+ error " ERROR: ${fileDescription} must be specified."
291
+ exit 6
292
+ else
293
+ if [[ -f ${fileName} ]]; then
294
+ if [[ ! -s ${fileName} ]]; then
295
+ error " ERROR: ${fileDescription} is empty: ${fileName} "
296
+ exit 6
297
+ fi
298
+ else
299
+ error " ERROR: ${fileDescription} does not exist: ${fileName} "
300
+ exit 6;
301
+ fi
302
+ fi
303
+ }
304
+
305
+ function assertOptionalFileIsNonEmpty()
306
+ {
307
+ local fileName=$1
308
+ local fileDescription=$2
309
+ if [[ ! -z ${fileName} ]] ; then
310
+ assertRequiredFileIsNonEmpty " ${fileName} " " ${fileDescription} "
311
+ fi
312
+ }
313
+
314
+ function checkForComplexHelpArgument()
286
315
{
287
316
for arg in $@ ; do
288
317
case $arg in
@@ -617,11 +646,28 @@ function submit()
617
646
done
618
647
shift $(( OPTIND- 1 ))
619
648
620
- # ----------------------------------------
649
+ # ----------------------------------------
650
+
651
+ if [[ $# -lt 2 ]] ; then
652
+ error " ERROR: submit requires at least a WDL and JSON file."
653
+ error " "
654
+ simpleUsage submit
655
+ exit 21
656
+ fi
657
+
658
+ local wdl=${1}
659
+ local json=${2}
660
+ local optionsJson=${3}
661
+ local dependenciesZip=${4}
662
+
663
+ assertRequiredFileIsNonEmpty " ${wdl} " " WDL"
664
+ assertRequiredFileIsNonEmpty " ${json} " " Input JSON"
665
+ assertOptionalFileIsNonEmpty " ${optionsJson} " " Options JSON"
666
+ assertOptionalFileIsNonEmpty " ${dependenciesZip} " " Dependencies Zip"
621
667
622
668
assertCanCommunicateWithServer $CROMWELL_URL
623
669
624
- local response=$( curl --connect-timeout $CURL_CONNECT_TIMEOUT --max-time $CURL_MAX_TIMEOUT -s -F workflowSource=@${1 } ${2: + -F workflowInputs=@ ${2 } } ${3: + -F workflowOptions=@ ${3 } } ${4: + -F workflowDependencies=@ ${4 } } ${CROMWELL_URL} /api/workflows/v1)
670
+ local response=$( curl --connect-timeout $CURL_CONNECT_TIMEOUT --max-time $CURL_MAX_TIMEOUT -s -F workflowSource=@${wdl } ${2: + -F workflowInputs=@ ${json } } ${3: + -F workflowOptions=@ ${optionsJson } } ${4: + -F workflowDependencies=@ ${depdenciesZip } } ${CROMWELL_URL} /api/workflows/v1)
625
671
local r=$?
626
672
627
673
# Check to make sure that we actually submitted the job correctly
0 commit comments