annotate launch_gnb.sh @ 7:dfb2bc3aedbd draft

planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 91ccbf9f293fe6b183302841aa49e061c4ab3157
author gga
date Thu, 01 Feb 2024 12:45:00 +0000
parents 5a6050937cb9
children 29eeddd8ea62
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
22f22c3e81bf planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 12282c16658b37858f49944796fd95515ef0fc0b
gga
parents:
diff changeset
1 #!/bin/bash
22f22c3e81bf planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 12282c16658b37858f49944796fd95515ef0fc0b
gga
parents:
diff changeset
2
22f22c3e81bf planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 12282c16658b37858f49944796fd95515ef0fc0b
gga
parents:
diff changeset
3 set -e
22f22c3e81bf planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 12282c16658b37858f49944796fd95515ef0fc0b
gga
parents:
diff changeset
4
7
dfb2bc3aedbd planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 91ccbf9f293fe6b183302841aa49e061c4ab3157
gga
parents: 2
diff changeset
5 echo "Running mongod: "
dfb2bc3aedbd planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 91ccbf9f293fe6b183302841aa49e061c4ab3157
gga
parents: 2
diff changeset
6 mongod --dbpath ./mongo_db/ --unixSocketPrefix "$(pwd)" --bind_ip fake_socket --logpath ./mongod.log --pidfilepath ./mongo.pid &
0
22f22c3e81bf planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 12282c16658b37858f49944796fd95515ef0fc0b
gga
parents:
diff changeset
7
7
dfb2bc3aedbd planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 91ccbf9f293fe6b183302841aa49e061c4ab3157
gga
parents: 2
diff changeset
8 echo "Waiting while mongod starts up"
dfb2bc3aedbd planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 91ccbf9f293fe6b183302841aa49e061c4ab3157
gga
parents: 2
diff changeset
9
dfb2bc3aedbd planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 91ccbf9f293fe6b183302841aa49e061c4ab3157
gga
parents: 2
diff changeset
10 tries=0
0
22f22c3e81bf planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 12282c16658b37858f49944796fd95515ef0fc0b
gga
parents:
diff changeset
11
22f22c3e81bf planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 12282c16658b37858f49944796fd95515ef0fc0b
gga
parents:
diff changeset
12 # "Listening on" is for mongodb 5x
7
dfb2bc3aedbd planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 91ccbf9f293fe6b183302841aa49e061c4ab3157
gga
parents: 2
diff changeset
13 while ! grep -q "Listening on" ./mongod.log; do
dfb2bc3aedbd planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 91ccbf9f293fe6b183302841aa49e061c4ab3157
gga
parents: 2
diff changeset
14
dfb2bc3aedbd planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 91ccbf9f293fe6b183302841aa49e061c4ab3157
gga
parents: 2
diff changeset
15 tries=$((tries + 1))
dfb2bc3aedbd planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 91ccbf9f293fe6b183302841aa49e061c4ab3157
gga
parents: 2
diff changeset
16
dfb2bc3aedbd planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 91ccbf9f293fe6b183302841aa49e061c4ab3157
gga
parents: 2
diff changeset
17 if [ "$tries" -ge 30 ]; then
dfb2bc3aedbd planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 91ccbf9f293fe6b183302841aa49e061c4ab3157
gga
parents: 2
diff changeset
18 echo "Failed to launch MongoDB:" 1>&2;
dfb2bc3aedbd planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 91ccbf9f293fe6b183302841aa49e061c4ab3157
gga
parents: 2
diff changeset
19 cat ./mongod.log 1>&2;
dfb2bc3aedbd planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 91ccbf9f293fe6b183302841aa49e061c4ab3157
gga
parents: 2
diff changeset
20 exit 1;
dfb2bc3aedbd planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 91ccbf9f293fe6b183302841aa49e061c4ab3157
gga
parents: 2
diff changeset
21 fi
dfb2bc3aedbd planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 91ccbf9f293fe6b183302841aa49e061c4ab3157
gga
parents: 2
diff changeset
22
dfb2bc3aedbd planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 91ccbf9f293fe6b183302841aa49e061c4ab3157
gga
parents: 2
diff changeset
23 sleep 3
dfb2bc3aedbd planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 91ccbf9f293fe6b183302841aa49e061c4ab3157
gga
parents: 2
diff changeset
24 done;
0
22f22c3e81bf planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 12282c16658b37858f49944796fd95515ef0fc0b
gga
parents:
diff changeset
25
22f22c3e81bf planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 12282c16658b37858f49944796fd95515ef0fc0b
gga
parents:
diff changeset
26 TMP_STORAGE=$(pwd)/tmp_storage
22f22c3e81bf planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 12282c16658b37858f49944796fd95515ef0fc0b
gga
parents:
diff changeset
27 mkdir "$TMP_STORAGE"
22f22c3e81bf planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 12282c16658b37858f49944796fd95515ef0fc0b
gga
parents:
diff changeset
28
2
5a6050937cb9 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit ec3c633a0751bb9e253bcd77fea425180c9a0014
gga
parents: 1
diff changeset
29 export NODE_OPTIONS="--max-old-space-size=$((${GALAXY_MEMORY_MB:-8192} * 75 / 100))"
5a6050937cb9 planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit ec3c633a0751bb9e253bcd77fea425180c9a0014
gga
parents: 1
diff changeset
30
1
f415e44e71de planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit a04f273adbc0ebb95bf42bf5bad8b41ba7aba91d
gga
parents: 0
diff changeset
31 genoboo run --storage-path "$TMP_STORAGE" --port ${GNB_PORT} --mongo-url mongodb://$MONGO_URI%2Fmongodb-27017.sock/genenotebook > ./gnb.log 2>&1 &
0
22f22c3e81bf planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 12282c16658b37858f49944796fd95515ef0fc0b
gga
parents:
diff changeset
32
22f22c3e81bf planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 12282c16658b37858f49944796fd95515ef0fc0b
gga
parents:
diff changeset
33 export GNB_PID=$!
22f22c3e81bf planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 12282c16658b37858f49944796fd95515ef0fc0b
gga
parents:
diff changeset
34
7
dfb2bc3aedbd planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 91ccbf9f293fe6b183302841aa49e061c4ab3157
gga
parents: 2
diff changeset
35 tries_gnb=0
dfb2bc3aedbd planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 91ccbf9f293fe6b183302841aa49e061c4ab3157
gga
parents: 2
diff changeset
36
dfb2bc3aedbd planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 91ccbf9f293fe6b183302841aa49e061c4ab3157
gga
parents: 2
diff changeset
37 while ! grep -q "GeneNoteBook server started, serving" ./gnb.log; do
dfb2bc3aedbd planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 91ccbf9f293fe6b183302841aa49e061c4ab3157
gga
parents: 2
diff changeset
38
dfb2bc3aedbd planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 91ccbf9f293fe6b183302841aa49e061c4ab3157
gga
parents: 2
diff changeset
39 tries_gnb=$((tries_gnb + 1))
0
22f22c3e81bf planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 12282c16658b37858f49944796fd95515ef0fc0b
gga
parents:
diff changeset
40
7
dfb2bc3aedbd planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 91ccbf9f293fe6b183302841aa49e061c4ab3157
gga
parents: 2
diff changeset
41 if [ "$tries_gnb" -ge 30 ]; then
dfb2bc3aedbd planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 91ccbf9f293fe6b183302841aa49e061c4ab3157
gga
parents: 2
diff changeset
42 echo "Failed to launch GeneNoteBook:" 1>&2;
dfb2bc3aedbd planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 91ccbf9f293fe6b183302841aa49e061c4ab3157
gga
parents: 2
diff changeset
43 cat ./gnb.log 1>&2;
dfb2bc3aedbd planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 91ccbf9f293fe6b183302841aa49e061c4ab3157
gga
parents: 2
diff changeset
44 kill $GNB_PID $(<"./mongo.pid");
dfb2bc3aedbd planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 91ccbf9f293fe6b183302841aa49e061c4ab3157
gga
parents: 2
diff changeset
45 exit 1;
dfb2bc3aedbd planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 91ccbf9f293fe6b183302841aa49e061c4ab3157
gga
parents: 2
diff changeset
46 fi
dfb2bc3aedbd planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 91ccbf9f293fe6b183302841aa49e061c4ab3157
gga
parents: 2
diff changeset
47
dfb2bc3aedbd planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 91ccbf9f293fe6b183302841aa49e061c4ab3157
gga
parents: 2
diff changeset
48 sleep 3
dfb2bc3aedbd planemo upload for repository https://github.com/galaxy-genome-annotation/galaxy-tools/tree/master/tools/genenotebook commit 91ccbf9f293fe6b183302841aa49e061c4ab3157
gga
parents: 2
diff changeset
49 done;