Skip to content

Commit

Permalink
Start and stop local translator
Browse files Browse the repository at this point in the history
  • Loading branch information
awicenec committed Sep 2, 2022
1 parent 44f1142 commit cb13dbe
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 4 deletions.
2 changes: 1 addition & 1 deletion daliuge-engine/run_engine.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ case "$1" in
exit 0;;
"local")
common_prep
res="$(dlg nm -h| grep -c "Unknown command")"
res="$(dlg nm -h| grep -c 'Unknown command')"
if [[ $res == 1 ]]
then
echo "dlg command could not be found!"
Expand Down
1 change: 1 addition & 0 deletions daliuge-engine/stop_engine.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/env bash
# This utlity script stops a locally running docker-engine container
case "$1" in
"docker")
Expand Down
21 changes: 20 additions & 1 deletion daliuge-translator/run_translator.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/env bash
case "$1" in
"dep")
VCS_TAG=`git describe --tags --abbrev=0|sed s/v//`
Expand All @@ -14,7 +15,25 @@ case "$1" in
echo "Running Translator development version in foreground..."
docker run --volume $PWD/dlg/dropmake:/dlg/lib/python3.8/site-packages/dlg/dropmake --name daliuge-translator --rm -t -p 8084:8084 icrar/daliuge-translator:${VCS_TAG}
exit 0;;
"local")
DLG_ROOT="${DLG_ROOT:-$HOME/dlg}"
res="$(dlg lgweb -h| grep -c 'Unknown command')"
if [[ $res == 1 ]]
then
echo "dlg lgweb command could not be found!"
echo "Please install daliuge-translator."
exit
fi
echo "Starting translator locally in foreground.."
dlg lgweb -vv -d /tmp -t /tmp > $DLG_ROOT/logs/dlgLGWEB.log 2>&1 &
mkdir -p $DLG_ROOT/pid
echo $! > $DLG_ROOT/pid/dlgLGWEB.pid
echo
echo "Use any of the following URLs to access the DIM:"
python -c "from dlg.utils import get_local_ip_addr; print([f'http://{addr}:8084' for addr,name in get_local_ip_addr() if not name.startswith('docker')])"
echo "Log file can be found in ${DLG_ROOT}/log/dlgLGWEB.log"
;;
*)
echo "Usage run_translator.sh <dep|dev|casa>"
echo "Usage run_translator.sh <dep|dev|casa|local>"
exit 0;;
esac
22 changes: 20 additions & 2 deletions daliuge-translator/stop_translator.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
# This utlity script stops a locally running docker-engine container
docker stop daliuge-translator
#!/bin/env bash
# This utlity script stops a locally running translator
MYPID=$$
echo $MYPID
case "$1" in
"docker")
docker stop daliuge-translator;;
"local")
DLG_ROOT="${DLG_ROOT:-$HOME/dlg}"
echo "Stopping translator.."
if [[ $DLG_ROOT/pid/dlgLGWEB.pid ]]
then
cat $DLG_ROOT/pid/dlgLGWEB.pid | xargs kill -HUP
fi
;;
*)
echo "Usage: stop_translator.sh <docker|local>"
echo " default: docker"
docker stop daliuge-translator;;
esac

0 comments on commit cb13dbe

Please sign in to comment.