From bf0175d5225ef3f750b5e695a7e46ee52a2e7386 Mon Sep 17 00:00:00 2001 From: Andreas Wicenec Date: Wed, 9 Feb 2022 17:07:45 +0800 Subject: [PATCH] Added bufsize parameter to copyApp and brought back the docker group --- daliuge-engine/dlg/apps/simple.py | 6 +++++- daliuge-engine/docker/prepare_user.py | 2 ++ daliuge-engine/run_engine.sh | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/daliuge-engine/dlg/apps/simple.py b/daliuge-engine/dlg/apps/simple.py index 6e7c360f9..3d54be78c 100644 --- a/daliuge-engine/dlg/apps/simple.py +++ b/daliuge-engine/dlg/apps/simple.py @@ -105,6 +105,8 @@ def run(self): # @param tag daliuge # @param[in] param/appclass Application Class/dlg.apps.simple.CopyApp/String/readonly/ # \~English Application class +# @param[in] param/bufsize buffer size/65536/Integer/readwrite/ +# \~English Application class # @par EAGLE_END class CopyApp(BarrierAppDROP): """ @@ -121,6 +123,8 @@ class CopyApp(BarrierAppDROP): [dlg_streaming_input("binary/*")], ) + _bufsize = dlg_int_param("bufsize", 65536) + def run(self): self.copyAll() @@ -134,7 +138,7 @@ def copyRecursive(self, inputDrop): self.copyRecursive(child) else: for outputDrop in self.outputs: - droputils.copyDropContents(inputDrop, outputDrop) + droputils.copyDropContents(inputDrop, outputDrop, bufsize=self._bufsize) class SleepAndCopyApp(SleepApp, CopyApp): diff --git a/daliuge-engine/docker/prepare_user.py b/daliuge-engine/docker/prepare_user.py index 72cb8e674..1a6b7d529 100644 --- a/daliuge-engine/docker/prepare_user.py +++ b/daliuge-engine/docker/prepare_user.py @@ -39,6 +39,7 @@ # get current user info pw = pwd.getpwuid(os.getuid()) gr = grp.getgrgid(pw.pw_gid) +dgr = grp.getgrnam('docker') with open(os.path.join(workdir, "passwd"), "wt") as file: file.write(open(os.path.join(template_dir, "passwd.template"), "rt").read()) file.write(f"{pw.pw_name}:x:{pw.pw_uid}:{pw.pw_gid}:{pw.pw_gecos}:/:/bin/bash") @@ -46,3 +47,4 @@ file.write(open(os.path.join(template_dir, "group.template"), "rt").read()) file.write(f"{gr.gr_name}:x:{gr.gr_gid}:") +print(dgr.gr_gid) diff --git a/daliuge-engine/run_engine.sh b/daliuge-engine/run_engine.sh index 8841971cc..c281bd585 100755 --- a/daliuge-engine/run_engine.sh +++ b/daliuge-engine/run_engine.sh @@ -14,7 +14,8 @@ common_prep () mkdir -p ${DLG_ROOT}/testdata mkdir -p ${DLG_ROOT}/code # get current user and group id and prepare passwd and group files - python docker/prepare_user.py + DOCKER_GID=`python docker/prepare_user.py` + DOCKER_OPTS=${DOCKER_OPTS}" --group-add ${DOCKER_GID}" DOCKER_OPTS=${DOCKER_OPTS}" -v ${DLG_ROOT}/workspace/settings/passwd:/etc/passwd" DOCKER_OPTS=${DOCKER_OPTS}" -v ${DLG_ROOT}/workspace/settings/group:/etc/group" DOCKER_OPTS=${DOCKER_OPTS}" -v ${PWD}/dlg/manager:/dlg/lib/python3.8/site-packages/dlg/manager"