-
Notifications
You must be signed in to change notification settings - Fork 6
/
skyport_submit.sh
executable file
·122 lines (103 loc) · 3.16 KB
/
skyport_submit.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#!/bin/bash
#
# skyport_submit script
#
# submit a CWL workflow, a jobinput file and a data directory for processing
#
# simple AWE submitter
# PLEASE NOTE: all path info must be relative to DATADIR (in this case ./data)
# usage info
usage () {
echo "Usage: skyport_submit.sh -d <datadir> -j <input.job> -w <workflow.cwl> [-s SKYPORT_HOST]"
echo "Options: "
echo " -d <datadir> data directory"
echo " -j <input.job> workflow job file, specifies input files, yaml"
echo " -w <workflow.cwl> workflow file, specifies workflow"
echo " [-s SKYPORT_HOST] defaults to environment variable SKYPORT_HOST, then to localhost"
echo "Example: skyport_submit.sh \ "
echo " -w ./CWL/Workflows/simple-bioinformatic-example.cwl \ "
echo " -j ./CWL/Workflows/simple-bioinformatic-example.job.yaml \ "
echo " -d ./CWL/Data/ "
}
# get options
while getopts d:w:j:s:a: option; do
case "${option}"
in
w) WORKFLOW=${OPTARG};;
j) JOBINPUT=${OPTARG};;
d) DATADIR=${OPTARG};;
s) SKYPORT_HOST=${OPTARG};;
*)
usage
;;
esac
done
USE_AUTH=""
# check on the auth situation
if [ -z ${SKYPORT_AUTH} ]
then
echo "We did not find an auth token (-a or $SKYPORT_AUTH). Running in anonymous mode"
else
USE_AUTH="--auth=${SKYPORT_AUTH}"
fi
# make sure the required options are present
if [ -z ${WORKFLOW} ]
then
echo "Required parameter -w <workflow.cwl> is missing"
usage
exit 1
fi
# make sure the required options are present
if [ -z ${JOBINPUT} ]
then
echo "Required parameter -j <job.yaml> is missing"
usage
exit 1
fi
# make sure the required options are present
if [ -z ${DATADIR} ]
then
echo "Required parameter -d <datadir> is missing"
usage
exit 1
fi
if [ -s ${SKYPORT_HOST} ]
then
SKYPORT_HOST=skyport.local
fi
echo "SKYPORT_HOST=${SKYPORT_HOST}"
WORKFLOWDIR=$(dirname ${WORKFLOW})
JOBINPUTDIR=$(dirname ${JOBINPUT})
WORKFLOW_FILE=$(basename ${WORKFLOW})
JOBINPUT_FILE=$(basename ${JOBINPUT})
if [ ! -d ${DATADIR} ]
then
echo "directory $DATADIR does not exist!"
exit 1
fi
AWE_SERVER=http://${SKYPORT_HOST}:8001/awe/api/
SHOCK_SERVER=http://${SKYPORT_HOST}:8001/shock/api/
#SHOCK_SERVER=http://shock:7445
#AWE_SERVER=http://awe-server:8001
CURDIR=`pwd`
set -x
docker run -ti \
--network skyport2_default \
--add-host skyport.local:${SKYPORT_DOCKER_GATEWAY} \
--rm \
-v ${CURDIR}/${WORKFLOWDIR}:/mnt/workflows/ \
-v ${CURDIR}/${JOBINPUTDIR}:/mnt/jobinputs/ \
-v ${CURDIR}/${DATADIR}:/mnt/Data/ \
--workdir=${CURDIR}/${DATADIR} \
mgrast/awe-submitter:demo \
/go/bin/awe-submitter \
--group=docker \
--pack \
--wait \
--shockurl=${SHOCK_SERVER} \
--serverurl=${AWE_SERVER} \
${USE_AUTH} \
/mnt/workflows/${WORKFLOW_FILE} \
/mnt/jobinputs/${JOBINPUT_FILE}
set +x
echo