From 7cd295e4b1c35dbc71b1acb152afaaa494538fb3 Mon Sep 17 00:00:00 2001 From: Ryan Bunney Date: Mon, 14 Oct 2024 14:44:13 +0800 Subject: [PATCH 1/4] MPI Fix: Re-do @awicenc mpi_fixes branch on updated repository. --- daliuge-engine/dlg/apps/mpi.py | 98 +++++++++++++++++-- daliuge-engine/dlg/deploy/configs/__init__.py | 85 +++++++++++----- daliuge-engine/dlg/deploy/create_dlg_job.py | 4 +- daliuge-engine/dlg/deploy/slurm_client.py | 18 +++- daliuge-engine/run_engine.sh | 2 +- daliuge-translator/build_translator.sh | 5 +- daliuge-translator/run_translator.sh | 21 ++-- 7 files changed, 177 insertions(+), 56 deletions(-) diff --git a/daliuge-engine/dlg/apps/mpi.py b/daliuge-engine/dlg/apps/mpi.py index 4f3b4f2f8..de7d48139 100644 --- a/daliuge-engine/dlg/apps/mpi.py +++ b/daliuge-engine/dlg/apps/mpi.py @@ -20,14 +20,24 @@ # MA 02111-1307 USA # """Module containing MPI application wrapping support""" - +import json import logging +import os import signal import subprocess import sys +from dlg import utils, droputils from dlg.apps.app_base import BarrierAppDROP -from ..exceptions import InvalidDropException +from dlg.named_port_utils import ( + DropParser, + get_port_reader_function, + replace_named_ports, +) +from dlg.exceptions import InvalidDropException +from ..meta import ( + dlg_enum_param, +) logger = logging.getLogger(__name__) @@ -38,15 +48,15 @@ # @par EAGLE_START # @param category Mpi # @param tag template -# @param num_of_procs 1/Integer/ComponentParameter/NoPort/ReadWrite//False/False/Number of processes used for this application # @param command /String/ComponentParameter/NoPort/ReadWrite//False/False/The command to be executed +# @param args /String/ComponentParameter/NoPort/ReadWrite//False/False/Additional command line arguments to be added to the command line to be executed +# @param num_of_procs 1/Integer/ComponentParameter/NoPort/ReadWrite//False/False/Number of processes used for this application +# @param use_wrapper False/Boolean/ComponentParameter/NoPort/ReadWrite//False/False/If the command should be executed inside the existing MPI communicator set this to True # @param input_redirection /String/ComponentParameter/NoPort/ReadWrite//False/False/The command line argument that specifies the input into this application # @param output_redirection /String/ComponentParameter/NoPort/ReadWrite//False/False/The command line argument that specifies the output from this application -# @param command_line_arguments /String/ComponentParameter/NoPort/ReadWrite//False/False/Additional command line arguments to be added to the command line to be executed # @param paramValueSeparator " "/String/ComponentParameter/NoPort/ReadWrite//False/False/Separator character(s) between parameters on the command line # @param argumentPrefix "--"/String/ComponentParameter/NoPort/ReadWrite//False/False/Prefix to each keyed argument on the command line # @param dropclass dlg.apps.mpi.MPIApp/String/ComponentParameter/NoPort/ReadWrite//False/False/Drop class -# @param mpi construct/String/ComponentParameter/NoPort/ReadOnly//False/False/Base name of application class # @param execution_time 5/Float/ConstraintParameter/NoPort/ReadOnly//False/False/Estimated execution time # @param num_cpus 1/Integer/ConstraintParameter/NoPort/ReadOnly//False/False/Number of cores used # @param group_end False/Boolean/ComponentParameter/NoPort/ReadWrite//False/False/Is this node the end of a group? @@ -66,24 +76,96 @@ class MPIApp(BarrierAppDROP): This drop will gather the individual exit codes from the launched applications and transition to ERROR if any of them did not exit cleanly, or to FINISHED if all of them finished successfully. + """ + input_parser: DropParser = dlg_enum_param(DropParser, "input_parser", DropParser.PICKLE) # type: ignore + def initialize(self, **kwargs): super(MPIApp, self).initialize(**kwargs) - self._command = self._popArg(kwargs, "command", None) self._maxprocs = self._popArg(kwargs, "maxprocs", 1) self._use_wrapper = self._popArg(kwargs, "use_wrapper", False) - self._args = self._popArg(kwargs, "args", []) + self._args = self._popArg(kwargs, "args", "") + self._applicationArgs = self._popArg(kwargs, "applicationArgs", {}) + self._argumentPrefix = self._popArg(kwargs, "argumentPrefix", "--") + self._paramValueSeparator = self._popArg(kwargs, "paramValueSeparator", " ") + self._inputRedirect = self._popArg(kwargs, "input_redirection", "") + self._outputRedirect = self._popArg(kwargs, "output_redirection", "") + + self._command = self._popArg(kwargs, "command", None) if not self._command: raise InvalidDropException( self, "No command specified, cannot create MPIApp" ) + self._recompute_data = {} def run(self): from mpi4py import MPI cmd, args = self._command, self._args + inputs = self._inputs + outputs = self._outputs + + logger.debug("Parameters found: %s", json.dumps(self.parameters)) + logger.debug("MPI Inputs: %s; MPI Outputs: %s", inputs, outputs) + # we only support passing a path for bash apps + fsInputs = {uid: i for uid, i in inputs.items() if droputils.has_path(i)} + fsOutputs = {uid: o for uid, o in outputs.items() if droputils.has_path(o)} + dataURLInputs = { + uid: i for uid, i in inputs.items() if not droputils.has_path(i) + } + dataURLOutputs = { + uid: o for uid, o in outputs.items() if not droputils.has_path(o) + } + # deal with named ports + inport_names = self.parameters["inputs"] if "inputs" in self.parameters else [] + outport_names = ( + self.parameters["outputs"] if "outputs" in self.parameters else [] + ) + reader = get_port_reader_function(self.input_parser) + keyargs, pargs = replace_named_ports( + inputs.items(), + outputs.items(), + inport_names, + outport_names, + self._applicationArgs, + argumentPrefix=self._argumentPrefix, + separator=self._paramValueSeparator, + parser=reader, + ) + argumentString = ( + f"{' '.join(map(str,pargs + keyargs))}" # add kwargs to end of pargs + ) + # complete command including all additional parameters and optional redirects + if len(argumentString.strip()) > 0: + # the _cmdLineArgs would very likely make the command line invalid + cmd = f"{self._command} {argumentString} " + else: + cmd = f"{self._command} {argumentString} {args} " + if self._outputRedirect: + cmd = f"{cmd} > {self._outputRedirect}" + if self._inputRedirect: + cmd = f"cat {self._inputRedirect} > {cmd}" + cmd = cmd.strip() + + app_uid = self.uid + + # Replace inputs/outputs in command line with paths or data URLs + cmd = droputils.replace_path_placeholders(cmd, fsInputs, fsOutputs) + + cmd = droputils.replace_dataurl_placeholders(cmd, dataURLInputs, dataURLOutputs) + + # Pass down daliuge-specific information to the subprocesses as environment variables + env = os.environ.copy() + env.update({"DLG_UID": self._uid}) + if self._dlg_session_id: + env.update({"DLG_SESSION_ID": self._dlg_session_id}) + + env.update({"DLG_ROOT": utils.getDlgDir()}) + + logger.info("Command after wrapping is: %s", cmd) + if self._use_wrapper: # We spawn this very same module # When invoked as a program (see at the bottom) this module @@ -91,8 +173,8 @@ def run(self): # command line, and send back the exit code. # Likewise, we barrier on the children communicator, and thus # we wait until all children processes are completed + args = ["-m", __name__, cmd] cmd = sys.executable - args = ["-m", __name__, self._command] + self._args errcodes = [] diff --git a/daliuge-engine/dlg/deploy/configs/__init__.py b/daliuge-engine/dlg/deploy/configs/__init__.py index 93dec451f..59f92dbb8 100644 --- a/daliuge-engine/dlg/deploy/configs/__init__.py +++ b/daliuge-engine/dlg/deploy/configs/__init__.py @@ -25,6 +25,7 @@ # =================== # Deployment defaults # ==================== +USER = "" ACCOUNT = "" LOGIN_NODE = "" HOME_DIR = os.environ["HOME"] if "HOME" in os.environ else "" @@ -34,6 +35,7 @@ VENV = f"{DLG_ROOT}/venv" DEFAULT_MON_HOST = "dlg-mon.icrar.org" # TODO: need to get this running DEFAULT_MON_PORT = 8898 +EXEC_PREFIX = "srun -l" __sub_tpl_str = """#!/bin/bash --login @@ -48,35 +50,64 @@ export DLG_ROOT=$DLG_ROOT $VENV -srun -l $PY_BIN -m dlg.deploy.start_dlg_cluster --log_dir $LOG_DIR $GRAPH_PAR $PROXY_PAR $GRAPH_VIS_PAR $LOGV_PAR $ZERORUN_PAR $MAXTHREADS_PAR $SNC_PAR $NUM_ISLANDS_PAR $ALL_NICS $CHECK_WITH_SESSION --ssid $SESSION_ID +$EXEC_PREFIX $PY_BIN -m dlg.deploy.start_dlg_cluster --log_dir $LOG_DIR $GRAPH_PAR $PROXY_PAR $GRAPH_VIS_PAR $LOGV_PAR $ZERORUN_PAR $MAXTHREADS_PAR $SNC_PAR $NUM_ISLANDS_PAR $ALL_NICS $CHECK_WITH_SESSION --ssid $SESSION_ID """ init_tpl = string.Template(__sub_tpl_str) class DefaultConfig(object): - def __init__(self): + def __init__(self, user=None): self._dict = dict() - self.setpar("host", self.LOGIN_NODE) - self.setpar("account", self.ACCOUNT) - self.setpar("home_dir", self.HOME_DIR.strip()) - self.setpar("dlg_root", self.DLG_ROOT.strip()) - self.setpar("log_root", self.LOG_DIR) - self.setpar("modules", self.MODULES.strip()) - self.setpar("venv", self.VENV.strip()) + if user: + print(f"Setting user to {user}") + self._dict["user"] = user + self.setpar("host", "LOGIN_NODE") + self.setpar("account", "ACCOUNT") + self.setpar("home_dir", "HOME_DIR") + self.setpar("dlg_root", "DLG_ROOT") + self.setpar("log_root", "LOG_DIR") + self.setpar("modules", "MODULES") + self.setpar("venv", "VENV") + self.setpar("exec_prefix", "EXEC_PREFIX") @abstractmethod def init_list(self): pass def setpar(self, k, v): - self._dict[k] = v + if hasattr(self, v): + value = getattr(self, v) + if "user" in self._dict: + pardict = {"USER": self._dict["user"]} + value = string.Template(value).safe_substitute(pardict) + self._dict[k] = value + else: + print(f"default[{v}] = '{globals()[v]}'") + self._dict[k] = globals()[v] def getpar(self, k): return self._dict.get(k) ############################# +class ICRARHyadesConfig(DefaultConfig): + MODULES = """ + """ + # The following is more a workaround than a solution + # requires the user to have a venv exectly in that place + LOGIN_NODE = "hyades.icrar.org" + HOME_DIR = "/home/$USER" + DLG_ROOT = "/home/$USER/dlg" + LOG_DIR = "/home/$USER/dlg/log" + VENV = "source /home/$USER/dlg/venv/bin/activate" + EXEC_PREFIX = "" + + def __init__(self, user=None): + super(ICRARHyadesConfig, self).__init__(user=user) + + def init_list(self): # TODO please fill in + return [self.ACCOUNT, self.LOG_DIR, self.MODULES, self.VENV] class ICRARoodConfig(DefaultConfig): @@ -85,14 +116,14 @@ class ICRARoodConfig(DefaultConfig): """ # The following is more a workaround than a solution # requires the user to have a venv exectly in that place - ACCOUNT = os.environ["USER"] + LOGIN_NODE = "hyades.icrar.org" HOME_DIR = os.environ["HOME"] if "HOME" in os.environ else "" DLG_ROOT = f"{HOME_DIR}/dlg" LOG_DIR = f"{DLG_ROOT}/log" VENV = f"source {HOME_DIR}/dlg/venv/bin/activate" - def __init__(self): - super(ICRARoodConfig, self).__init__() + def __init__(self, user=None): + super(ICRARoodConfig, self).__init__(user=user) def init_list(self): # TODO please fill in return [self.ACCOUNT, self.LOG_DIR, self.MODULES, self.VENV] @@ -108,16 +139,16 @@ class ICRARoodCldConfig(DefaultConfig): # The compute nodes have have required python and DALiuGE but just in case.... VENV = f"source {DLG_ROOT}/venv/bin/activate" - def __init__(self): - super(ICRARoodCldConfig, self).__init__() + def __init__(self, user=None): + super(ICRARoodCldConfig, self).__init__(user=user) def init_list(self): # TODO please fill in return [self.ACCOUNT, self.LOG_DIR, self.VENV] class GalaxyMWAConfig(DefaultConfig): - def __init__(self): - super(GalaxyMWAConfig, self).__init__() + def __init__(self, user=None): + super(GalaxyMWAConfig, self).__init__(user=user) def init_list(self): return ["mwaops", "/group/mwaops/cwu/dfms/logs"] @@ -131,8 +162,8 @@ class GalaxyASKAPConfig(DefaultConfig): """ VENV = "" - def __init__(self): - super(GalaxyASKAPConfig, self).__init__() + def __init__(self, user=None): + super(GalaxyASKAPConfig, self).__init__(user=user) def init_list(self): return [ @@ -143,8 +174,8 @@ def init_list(self): class MagnusConfig(DefaultConfig): - def __init__(self): - super(MagnusConfig, self).__init__() + def __init__(self, user=None): + super(MagnusConfig, self).__init__(user=user) def init_list(self): return ["pawsey0129", "/group/pawsey0129/daliuge_logs"] @@ -166,8 +197,8 @@ class Setonix411Config(DefaultConfig): MODULES = "" - def __init__(self): - super(Setonix411Config, self).__init__() + def __init__(self, user=None): + super(Setonix411Config, self).__init__(user=user) def init_list(self): return [self.ACCOUNT, f"{self.HOME_DIR}/logs"] @@ -192,7 +223,8 @@ class ConfigFactory: "galaxy": GalaxyASKAPConfig, "setonix": Setonix411Config, "shao": TianHe2Config, - "hyades.icrar.org": ICRARoodConfig, + "hyades": ICRARHyadesConfig, + "ood": ICRARoodConfig, "ood_cloud": ICRARoodCldConfig, } @@ -201,6 +233,7 @@ def available(): return list(ConfigFactory.mapping.keys()) @staticmethod - def create_config(facility=None): + def create_config(facility=None, user=None): facility = facility.lower() if (facility is not None) else facility - return ConfigFactory.mapping.get(facility)() + config = ConfigFactory.mapping.get(facility)(user=user) + return config diff --git a/daliuge-engine/dlg/deploy/create_dlg_job.py b/daliuge-engine/dlg/deploy/create_dlg_job.py index 7f3a2cc40..76753d4d5 100644 --- a/daliuge-engine/dlg/deploy/create_dlg_job.py +++ b/daliuge-engine/dlg/deploy/create_dlg_job.py @@ -650,7 +650,9 @@ def main(): # you can specify: # either a single directory if opts.log_root is None: - config = ConfigFactory.create_config(facility=opts.facility) + config = ConfigFactory.create_config( + facility=opts.facility, user=opts.username + ) log_root = config.getpar("log_root") else: log_root = opts.log_root diff --git a/daliuge-engine/dlg/deploy/slurm_client.py b/daliuge-engine/dlg/deploy/slurm_client.py index 0c4af4190..08e34f402 100644 --- a/daliuge-engine/dlg/deploy/slurm_client.py +++ b/daliuge-engine/dlg/deploy/slurm_client.py @@ -35,6 +35,7 @@ from dlg.deploy.configs import ConfigFactory, init_tpl from dlg.deploy.configs import DEFAULT_MON_PORT, DEFAULT_MON_HOST from dlg.deploy.deployment_utils import find_numislands, label_job_dur +from paramiko.ssh_exception import SSHException class SlurmClient: @@ -78,15 +79,17 @@ def __init__( pip_name=None, username=None, ): - self._config = ConfigFactory.create_config(facility=facility) + self._config = ConfigFactory.create_config(facility=facility, user=username) self.host = self._config.getpar("host") if host is None else host self._acc = self._config.getpar("account") if (acc is None) else acc + self._user = self._config.getpar("user") if (username is None) else username self.dlg_root = self._config.getpar("dlg_root") if not dlg_root else dlg_root self._log_root = ( self._config.getpar("log_root") if (log_root is None) else log_root ) self.modules = self._config.getpar("modules") self.venv = self._config.getpar("venv") + self.exec_prefix = self._config.getpar("exec_prefix") if num_nodes is None: self._num_nodes = 1 else: @@ -172,6 +175,7 @@ def create_job_desc(self, physical_graph_file): ) pardict["MODULES"] = self.modules pardict["DLG_ROOT"] = self.dlg_root + pardict["EXEC_PREFIX"] = self.exec_prefix job_desc = init_tpl.safe_substitute(pardict) return job_desc @@ -200,8 +204,16 @@ def mk_session_dir(self, dlg_root: str = ""): os.makedirs(session_dir) if self._remote: command = f"mkdir -p {session_dir}" - print(f"Creating remote session directory on {self.host}: {command}") - remote.execRemote(self.host, command, username=self.username) + print( + f"Creating remote session directory on {self.username}@{self.host}: {command}" + ) + try: + remote.execRemote(self.host, command, username=self.username) + except (TypeError, SSHException): + print( + f"ERROR: Unable to create {session_dir} on {self.username}@{self.host}" + ) + sys.exit() return session_dir diff --git a/daliuge-engine/run_engine.sh b/daliuge-engine/run_engine.sh index 3fbfa2ef2..7f33a9d9d 100755 --- a/daliuge-engine/run_engine.sh +++ b/daliuge-engine/run_engine.sh @@ -29,7 +29,7 @@ then export VCS_TAG=$2 export C_TAG=$VCS_TAG else - export VCS_TAG=`git describe --tags --abbrev=0 --always|sed s/v//` + export VCS_TAG=`git describe --tags --abbrev=0|sed s/v//` export C_TAG=`git rev-parse --abbrev-ref HEAD | tr '[:upper:]' '[:lower:]'` fi case "$1" in diff --git a/daliuge-translator/build_translator.sh b/daliuge-translator/build_translator.sh index 18a366aaa..05b2d6292 100755 --- a/daliuge-translator/build_translator.sh +++ b/daliuge-translator/build_translator.sh @@ -3,11 +3,8 @@ # branch name or with a release tag depending whether this is a development or deployment # version. -export VCS_TAG=`git describe --tags --always --abbrev=0|sed s/v//` +export VCS_TAG=`git describe --tags --abbrev=0|sed s/v//` export DEV_TAG=`git rev-parse --abbrev-ref HEAD | tr '[:upper:]' '[:lower:]'` -if [ $DEV_TAG=="master" ]; then - VCS_TAG=$DEV_TAG; -fi case "$1" in "dep") diff --git a/daliuge-translator/run_translator.sh b/daliuge-translator/run_translator.sh index ad4ca386e..7a8277a80 100755 --- a/daliuge-translator/run_translator.sh +++ b/daliuge-translator/run_translator.sh @@ -4,33 +4,28 @@ then export VCS_TAG=$2 export C_TAG=$VCS_TAG else - export VCS_TAG=`git describe --tags --abbrev=0 --always|sed s/v//` + export VCS_TAG=`git describe --tags --abbrev=0|sed s/v//` export C_TAG=`git rev-parse --abbrev-ref HEAD | tr '[:upper:]' '[:lower:]'` - if [ $C_TAG=="master" ]; then VCS_TAG=$C_TAG; fi fi case "$1" in "dep") echo "Running Translator deployment version in background..." docker run -h dlg-trans --name daliuge-translator --rm -td -p 8084:8084 icrar/daliuge-translator:${VCS_TAG} - sleep 3 - docker exec -u root daliuge-translator bash -c "service avahi-daemon stop > /dev/null 2>&1 && service dbus restart > /dev/null 2>&1 && service avahi-daemon start > /dev/null 2>&1";; + sleep 3;; "dev") echo "Running Translator development version in background..." docker run -d -h dlg-trans --volume $PWD/dlg/dropmake:/dlg/lib/python3.8/site-packages/dlg/dropmake --name daliuge-translator --rm -t -p 8084:8084 icrar/daliuge-translator:${C_TAG} - sleep 3 - docker exec -u root daliuge-translator bash -c "service avahi-daemon stop > /dev/null 2>&1 && service dbus restart > /dev/null 2>&1 && service avahi-daemon start > /dev/null 2>&1";; - "slim") + sleep 3;; + "slim") echo "Running Translator development version in background..." docker run -d -h dlg-trans --volume $PWD/dlg/dropmake:/dlg/lib/python3.8/site-packages/dlg/dropmake --name daliuge-translator --rm -t -p 8084:8084 icrar/daliuge-translator.slim:${VCS_TAG} - sleep 3 - docker exec -u root daliuge-translator bash -c "service avahi-daemon stop > /dev/null 2>&1 && service dbus restart > /dev/null 2>&1 && service avahi-daemon start > /dev/null 2>&1";; - "casa") + sleep 3;; + "casa") export VCS_TAG=`git rev-parse --abbrev-ref HEAD| tr '[:upper:]' '[:lower:]'`-casa echo "Running Translator development version in foreground..." docker run -h dlg-trans --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} - sleep 3 - docker exec -u root daliuge-translator bash -c "service avahi-daemon stop > /dev/null 2>&1 && service dbus restart > /dev/null 2>&1 && service avahi-daemon start > /dev/null 2>&1";; - *) + sleep 3;; + *) echo "Usage run_translator.sh " exit 0;; esac From 15d4556a8d3cd801cade028bf97ef9d03f97fb22 Mon Sep 17 00:00:00 2001 From: Ryan Bunney Date: Wed, 23 Oct 2024 14:19:36 +0800 Subject: [PATCH 2/4] MPI-Fixes: Fix Setonix deployment username isue --- daliuge-engine/dlg/deploy/configs/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/daliuge-engine/dlg/deploy/configs/__init__.py b/daliuge-engine/dlg/deploy/configs/__init__.py index 59f92dbb8..0429e6466 100644 --- a/daliuge-engine/dlg/deploy/configs/__init__.py +++ b/daliuge-engine/dlg/deploy/configs/__init__.py @@ -190,7 +190,7 @@ class Setonix411Config(DefaultConfig): ACCOUNT = "pawsey0411" USER = os.environ["USER"] if "USER" in os.environ else "" HOME_DIR = f"/scratch/{ACCOUNT}" - DLG_ROOT = f"{HOME_DIR}/{USER}/dlg" + DLG_ROOT = f"{HOME_DIR}/$USER/dlg" LOG_DIR = f"{DLG_ROOT}/log" MODULES = "" VENV = f"source /software/projects/{ACCOUNT}/venv/bin/activate" From b6bd990a692274f4cf2cb093481c5e4ff2528029 Mon Sep 17 00:00:00 2001 From: Ryan Bunney Date: Mon, 4 Nov 2024 11:57:22 +0800 Subject: [PATCH 3/4] MPI Fixes: Revert docker changes --- daliuge-engine/run_engine.sh | 2 +- daliuge-translator/build_translator.sh | 6 +++++- daliuge-translator/run_translator.sh | 7 ++++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/daliuge-engine/run_engine.sh b/daliuge-engine/run_engine.sh index 7f33a9d9d..0186596e3 100755 --- a/daliuge-engine/run_engine.sh +++ b/daliuge-engine/run_engine.sh @@ -29,7 +29,7 @@ then export VCS_TAG=$2 export C_TAG=$VCS_TAG else - export VCS_TAG=`git describe --tags --abbrev=0|sed s/v//` + export VCS_TAG=`git describe --tags --always --abbrev=0|sed s/v//` export C_TAG=`git rev-parse --abbrev-ref HEAD | tr '[:upper:]' '[:lower:]'` fi case "$1" in diff --git a/daliuge-translator/build_translator.sh b/daliuge-translator/build_translator.sh index 05b2d6292..4ee52c121 100755 --- a/daliuge-translator/build_translator.sh +++ b/daliuge-translator/build_translator.sh @@ -3,9 +3,13 @@ # branch name or with a release tag depending whether this is a development or deployment # version. -export VCS_TAG=`git describe --tags --abbrev=0|sed s/v//` +export VCS_TAG=`git describe --tags --always --abbrev=0|sed s/v//` export DEV_TAG=`git rev-parse --abbrev-ref HEAD | tr '[:upper:]' '[:lower:]'` +if [ $DEV_TAG=="master" ]; then + VCS_TAG=$DEV_TAG +fi + case "$1" in "dep") echo "Building daliuge-translator version ${VCS_TAG}" diff --git a/daliuge-translator/run_translator.sh b/daliuge-translator/run_translator.sh index 7a8277a80..e7cbc4dbb 100755 --- a/daliuge-translator/run_translator.sh +++ b/daliuge-translator/run_translator.sh @@ -4,27 +4,32 @@ then export VCS_TAG=$2 export C_TAG=$VCS_TAG else - export VCS_TAG=`git describe --tags --abbrev=0|sed s/v//` + export VCS_TAG=`git describe --tags --always --abbrev=0|sed s/v//` export C_TAG=`git rev-parse --abbrev-ref HEAD | tr '[:upper:]' '[:lower:]'` + if [ $C_TAG=="master" ]; then VCS_TAG=$C_TAG; fi fi case "$1" in "dep") echo "Running Translator deployment version in background..." docker run -h dlg-trans --name daliuge-translator --rm -td -p 8084:8084 icrar/daliuge-translator:${VCS_TAG} sleep 3;; + docker exec -u root daliuge-translator bash -c "service avahi-daemon stop > /dev/null 2>&1 && service dbus restart > /dev/null 2>&1 && service avahi-daemon start > /dev/null 2>&1";; "dev") echo "Running Translator development version in background..." docker run -d -h dlg-trans --volume $PWD/dlg/dropmake:/dlg/lib/python3.8/site-packages/dlg/dropmake --name daliuge-translator --rm -t -p 8084:8084 icrar/daliuge-translator:${C_TAG} sleep 3;; + docker exec -u root daliuge-translator bash -c "service avahi-daemon stop > /dev/null 2>&1 && service dbus restart > /dev/null 2>&1 && service avahi-daemon start > /dev/null 2>&1";; "slim") echo "Running Translator development version in background..." docker run -d -h dlg-trans --volume $PWD/dlg/dropmake:/dlg/lib/python3.8/site-packages/dlg/dropmake --name daliuge-translator --rm -t -p 8084:8084 icrar/daliuge-translator.slim:${VCS_TAG} sleep 3;; + docker exec -u root daliuge-translator bash -c "service avahi-daemon stop > /dev/null 2>&1 && service dbus restart > /dev/null 2>&1 && service avahi-daemon start > /dev/null 2>&1";; "casa") export VCS_TAG=`git rev-parse --abbrev-ref HEAD| tr '[:upper:]' '[:lower:]'`-casa echo "Running Translator development version in foreground..." docker run -h dlg-trans --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} sleep 3;; + docker exec -u root daliuge-translator bash -c "service avahi-daemon stop > /dev/null 2>&1 && service dbus restart > /dev/null 2>&1 && service avahi-daemon start > /dev/null 2>&1";; *) echo "Usage run_translator.sh " exit 0;; From 7db0fe57f2bcb417907541a1b3ba18b2602d8618 Mon Sep 17 00:00:00 2001 From: Ryan Bunney Date: Mon, 4 Nov 2024 12:00:57 +0800 Subject: [PATCH 4/4] MPI Fixes: Revert docker changes --- daliuge-engine/run_engine.sh | 2 +- daliuge-translator/build_translator.sh | 3 +-- daliuge-translator/run_translator.sh | 20 ++++++++++---------- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/daliuge-engine/run_engine.sh b/daliuge-engine/run_engine.sh index 0186596e3..3fbfa2ef2 100755 --- a/daliuge-engine/run_engine.sh +++ b/daliuge-engine/run_engine.sh @@ -29,7 +29,7 @@ then export VCS_TAG=$2 export C_TAG=$VCS_TAG else - export VCS_TAG=`git describe --tags --always --abbrev=0|sed s/v//` + export VCS_TAG=`git describe --tags --abbrev=0 --always|sed s/v//` export C_TAG=`git rev-parse --abbrev-ref HEAD | tr '[:upper:]' '[:lower:]'` fi case "$1" in diff --git a/daliuge-translator/build_translator.sh b/daliuge-translator/build_translator.sh index 4ee52c121..2feeda98b 100755 --- a/daliuge-translator/build_translator.sh +++ b/daliuge-translator/build_translator.sh @@ -5,9 +5,8 @@ export VCS_TAG=`git describe --tags --always --abbrev=0|sed s/v//` export DEV_TAG=`git rev-parse --abbrev-ref HEAD | tr '[:upper:]' '[:lower:]'` - if [ $DEV_TAG=="master" ]; then - VCS_TAG=$DEV_TAG + VCS_TAG=$DEV_TAG; fi case "$1" in diff --git a/daliuge-translator/run_translator.sh b/daliuge-translator/run_translator.sh index e7cbc4dbb..65a378413 100755 --- a/daliuge-translator/run_translator.sh +++ b/daliuge-translator/run_translator.sh @@ -4,32 +4,32 @@ then export VCS_TAG=$2 export C_TAG=$VCS_TAG else - export VCS_TAG=`git describe --tags --always --abbrev=0|sed s/v//` + export VCS_TAG=`git describe --tags --abbrev=0 --always|sed s/v//` export C_TAG=`git rev-parse --abbrev-ref HEAD | tr '[:upper:]' '[:lower:]'` - if [ $C_TAG=="master" ]; then VCS_TAG=$C_TAG; fi + if [ $C_TAG=="master" ]; then VCS_TAG=$C_TAG; fi fi case "$1" in "dep") echo "Running Translator deployment version in background..." docker run -h dlg-trans --name daliuge-translator --rm -td -p 8084:8084 icrar/daliuge-translator:${VCS_TAG} - sleep 3;; - docker exec -u root daliuge-translator bash -c "service avahi-daemon stop > /dev/null 2>&1 && service dbus restart > /dev/null 2>&1 && service avahi-daemon start > /dev/null 2>&1";; + sleep 3 + docker exec -u root daliuge-translator bash -c "service avahi-daemon stop > /dev/null 2>&1 && service dbus restart > /dev/null 2>&1 && service avahi-daemon start > /dev/null 2>&1";; "dev") echo "Running Translator development version in background..." docker run -d -h dlg-trans --volume $PWD/dlg/dropmake:/dlg/lib/python3.8/site-packages/dlg/dropmake --name daliuge-translator --rm -t -p 8084:8084 icrar/daliuge-translator:${C_TAG} - sleep 3;; - docker exec -u root daliuge-translator bash -c "service avahi-daemon stop > /dev/null 2>&1 && service dbus restart > /dev/null 2>&1 && service avahi-daemon start > /dev/null 2>&1";; + sleep 3 + docker exec -u root daliuge-translator bash -c "service avahi-daemon stop > /dev/null 2>&1 && service dbus restart > /dev/null 2>&1 && service avahi-daemon start > /dev/null 2>&1";; "slim") echo "Running Translator development version in background..." docker run -d -h dlg-trans --volume $PWD/dlg/dropmake:/dlg/lib/python3.8/site-packages/dlg/dropmake --name daliuge-translator --rm -t -p 8084:8084 icrar/daliuge-translator.slim:${VCS_TAG} - sleep 3;; - docker exec -u root daliuge-translator bash -c "service avahi-daemon stop > /dev/null 2>&1 && service dbus restart > /dev/null 2>&1 && service avahi-daemon start > /dev/null 2>&1";; + sleep 3 + docker exec -u root daliuge-translator bash -c "service avahi-daemon stop > /dev/null 2>&1 && service dbus restart > /dev/null 2>&1 && service avahi-daemon start > /dev/null 2>&1";; "casa") export VCS_TAG=`git rev-parse --abbrev-ref HEAD| tr '[:upper:]' '[:lower:]'`-casa echo "Running Translator development version in foreground..." docker run -h dlg-trans --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} - sleep 3;; - docker exec -u root daliuge-translator bash -c "service avahi-daemon stop > /dev/null 2>&1 && service dbus restart > /dev/null 2>&1 && service avahi-daemon start > /dev/null 2>&1";; + sleep 3 + docker exec -u root daliuge-translator bash -c "service avahi-daemon stop > /dev/null 2>&1 && service dbus restart > /dev/null 2>&1 && service avahi-daemon start > /dev/null 2>&1";; *) echo "Usage run_translator.sh " exit 0;;