Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

genenotebook: give a few more seconds to startup #91

Merged
merged 3 commits into from
Feb 1, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 31 additions & 15 deletions tools/genenotebook/launch_gnb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,26 @@

set -e

mongod --dbpath ./mongo_db/ --unixSocketPrefix `pwd` --bind_ip fake_socket --logpath ./mongod.log --pidfilepath ./mongo.pid &
echo "Running mongod: "
mongod --dbpath ./mongo_db/ --unixSocketPrefix "$(pwd)" --bind_ip fake_socket --logpath ./mongod.log --pidfilepath ./mongo.pid &

sleep 8
echo "Waiting while mongod starts up"

tries=0

# "Listening on" is for mongodb 5x
if ! grep -q "Listening on" ./mongod.log; then
echo "Failed to launch MongoDB:" 1>&2;
cat ./mongod.log 1>&2;
kill $GNB_PID;
exit 1;
fi;
while ! grep -q "Listening on" ./mongod.log; do

tries=$((tries + 1))

if [ "$tries" -ge 30 ]; then
echo "Failed to launch MongoDB:" 1>&2;
cat ./mongod.log 1>&2;
exit 1;
fi

sleep 3
done;

TMP_STORAGE=$(pwd)/tmp_storage
mkdir "$TMP_STORAGE"
Expand All @@ -23,11 +32,18 @@ genoboo run --storage-path "$TMP_STORAGE" --port ${GNB_PORT} --mongo-url mongodb

export GNB_PID=$!

sleep 15
tries_gnb=0

while ! grep -q "GeneNoteBook server started, serving" ./gnb.log; do

tries_gnb=$((tries_gnb + 1))

if [ "$tries_gnb" -ge 30 ]; then
echo "Failed to launch GeneNoteBook:" 1>&2;
cat ./gnb.log 1>&2;
kill $GNB_PID $(<"./mongo.pid");
exit 1;
fi

if ! grep -q "GeneNoteBook server started, serving" ./gnb.log; then
echo "Failed to launch GeneNoteBook:" 1>&2;
cat ./gnb.log 1>&2;
kill $GNB_PID $(<"./mongo.pid");
exit 1;
fi;
sleep 3
done;
Loading