-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathdev.sh
executable file
·76 lines (64 loc) · 1.97 KB
/
dev.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
#!/bin/bash -e
get_script_dir () {
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$( readlink "$SOURCE" )"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
done
cd -P "$( dirname "$SOURCE" )"
pwd
}
ROOT_DIR="$(get_script_dir)/.."
function cheat_sheet() {
echo "Cheat sheet - run the following commands:"
echo
echo "library(devtools)"
echo
echo "devtools::install_github(\"LREN-CHUV/hbplregress\")"
echo " # Load the library"
echo
echo "source(\"/src/main.R\")"
echo " # Perform the computation"
echo
echo "lintr::lint(\"/src/main.R\")"
echo " # Checks the style of the source code"
echo
echo "-----------------------------------------"
}
echo "Starting the results database..."
$ROOT_DIR/tests/analytics-db/start-db.sh
echo
echo "Starting the local database..."
$ROOT_DIR/tests/dummy-ldsm/start-db.sh
echo
sleep 2
if groups $USER | grep &>/dev/null '\bdocker\b'; then
DOCKER="docker"
else
DOCKER="sudo docker"
fi
cheat_sheet
$DOCKER run -i -t --rm \
--link dummyldsm:indb \
--link analyticsdb:outdb \
-v $(pwd)/:/src/ \
-v $(pwd)/tests:/src/tests/ \
-e JOB_ID=002 \
-e NODE=dev \
-e PARAM_query="select feature_name, tissue1_volume from brain_feature order by tissue1_volume" \
-e PARAM_variable="tissue1_volume" \
-e PARAM_covariables="feature_name" \
-e IN_JDBC_DRIVER=org.postgresql.Driver \
-e IN_JDBC_JAR_PATH=/usr/lib/R/libraries/postgresql-9.4-1201.jdbc41.jar \
-e IN_JDBC_URL="jdbc:postgresql://indb:5432/postgres" \
-e IN_JDBC_USER=postgres \
-e IN_JDBC_PASSWORD=test \
-e OUT_JDBC_DRIVER=org.postgresql.Driver \
-e OUT_JDBC_JAR_PATH=/usr/lib/R/libraries/postgresql-9.4-1201.jdbc41.jar \
-e OUT_JDBC_URL="jdbc:postgresql://outdb:5432/postgres" \
-e OUT_JDBC_USER=postgres \
-e OUT_JDBC_PASSWORD=test \
hbpmip/r-interactive:latest R
$ROOT_DIR/tests/analytics-db/stop-db.sh
$ROOT_DIR/tests/dummy-ldsm/stop-db.sh