diff --git a/daliuge-engine/run_engine.sh b/daliuge-engine/run_engine.sh index 9e7e0528e..2fb73048c 100755 --- a/daliuge-engine/run_engine.sh +++ b/daliuge-engine/run_engine.sh @@ -2,7 +2,7 @@ DOCKER_OPTS="\ --shm-size=2g --ipc=shareable \ --rm \ -$([[ $(nvidia-docker version) ]] && echo '--gpus=all' || echo '') \ +$([[ $(command -v nvidia-docker version) ]] && echo '--gpus=all' || echo '') \ --name daliuge-engine \ -v /var/run/docker.sock:/var/run/docker.sock \ -p 5555:5555 -p 6666:6666 \ @@ -71,6 +71,13 @@ case "$1" in exit 0;; "local") common_prep + res="$(dlg nm -h| grep -c 'Unknown command')" + if [[ $res == 1 ]] + then + echo "dlg command could not be found!" + echo "Please install daliuge-engine." + exit + fi echo "Starting managers locally in background.." dlg nm -vvd -H 0.0.0.0 --dlg-path=$DLG_ROOT --dlm-cleanup-period=10 dlg dim -vvd -H 0.0.0.0 -N localhost diff --git a/daliuge-engine/stop_engine.sh b/daliuge-engine/stop_engine.sh index 6a9cdd00d..cde4d99b1 100755 --- a/daliuge-engine/stop_engine.sh +++ b/daliuge-engine/stop_engine.sh @@ -1,3 +1,4 @@ +#!/bin/env bash # This utlity script stops a locally running docker-engine container case "$1" in "docker") diff --git a/daliuge-translator/run_translator.sh b/daliuge-translator/run_translator.sh index c79557e9b..9cbf7dc93 100755 --- a/daliuge-translator/run_translator.sh +++ b/daliuge-translator/run_translator.sh @@ -1,3 +1,4 @@ +#!/bin/env bash case "$1" in "dep") VCS_TAG=`git describe --tags --abbrev=0|sed s/v//` @@ -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 " + echo "Usage run_translator.sh " exit 0;; esac diff --git a/daliuge-translator/stop_translator.sh b/daliuge-translator/stop_translator.sh index c5953023f..aa1875417 100755 --- a/daliuge-translator/stop_translator.sh +++ b/daliuge-translator/stop_translator.sh @@ -1,2 +1,20 @@ -# This utlity script stops a locally running docker-engine container -docker stop daliuge-translator \ No newline at end of file +#!/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 " + echo " default: docker" + docker stop daliuge-translator;; +esac \ No newline at end of file