Skip to content

Commit

Permalink
genotebook: startup fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
abretaud committed Feb 1, 2024
1 parent 91ccbf9 commit 6f1ddc5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions tools/genenotebook/launch_gnb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

set -e

echo "Running mongod: "
# Make sure the file always exists even on first grep
touch mongod.log

echo "Starting mongod, listening on unix socket in $(pwd)"
mongod --dbpath ./mongo_db/ --unixSocketPrefix "$(pwd)" --bind_ip fake_socket --logpath ./mongod.log --pidfilepath ./mongo.pid &

echo "Waiting while mongod starts up"
Expand All @@ -23,9 +26,14 @@ while ! grep -q "Listening on" ./mongod.log; do
sleep 3
done;

echo "Mongod is ready, starting gnb now on port ${GNB_PORT} and with mongodb://${MONGO_URI}%2Fmongodb-27017.sock/genenotebook"

TMP_STORAGE=$(pwd)/tmp_storage
mkdir "$TMP_STORAGE"

# Make sure the file always exists
touch gnb.log

export NODE_OPTIONS="--max-old-space-size=$((${GALAXY_MEMORY_MB:-8192} * 75 / 100))"

genoboo run --storage-path "$TMP_STORAGE" --port ${GNB_PORT} --mongo-url mongodb://$MONGO_URI%2Fmongodb-27017.sock/genenotebook > ./gnb.log 2>&1 &
Expand All @@ -38,7 +46,8 @@ while ! grep -q "GeneNoteBook server started, serving" ./gnb.log; do

tries_gnb=$((tries_gnb + 1))

if [ "$tries_gnb" -ge 30 ]; then
# GNB can take a while to start depending on storage (accessing many many small js files)
if [ "$tries_gnb" -ge 150 ]; then
echo "Failed to launch GeneNoteBook:" 1>&2;
cat ./gnb.log 1>&2;
kill $GNB_PID $(<"./mongo.pid");
Expand All @@ -47,3 +56,5 @@ while ! grep -q "GeneNoteBook server started, serving" ./gnb.log; do

sleep 3
done;

echo "GNB is ready"
2 changes: 1 addition & 1 deletion tools/genenotebook/macros.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</xml>

<token name="@TOOL_VERSION@">0.4.12</token>
<token name="@WRAPPER_VERSION@">@TOOL_VERSION@+galaxy0</token>
<token name="@WRAPPER_VERSION@">@TOOL_VERSION@+galaxy1</token>

<xml name="citation">
<citations>
Expand Down

0 comments on commit 6f1ddc5

Please sign in to comment.