From 30c4c7857ec8a1e041c66b3a15a92c9c6bc7d678 Mon Sep 17 00:00:00 2001 From: Nicholas Pritchard <21726929@student.uwa.edu.au> Date: Tue, 11 Jan 2022 09:58:25 +0800 Subject: [PATCH] Adds SharedMemoryDROP case for use without session present. --- daliuge-engine/dlg/drop.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/daliuge-engine/dlg/drop.py b/daliuge-engine/dlg/drop.py index fd0db494f..5e9640178 100644 --- a/daliuge-engine/dlg/drop.py +++ b/daliuge-engine/dlg/drop.py @@ -22,7 +22,7 @@ """ Module containing the core DROP classes. """ - +import string from abc import ABCMeta, abstractmethod import ast import base64 @@ -1471,8 +1471,14 @@ def initialize(self, **kwargs): self._buf = io.BytesIO(*args) def getIO(self): - if hasattr(self, '_sessID') and sys.version_info >= (3, 8): - return SharedMemoryIO(self.oid, self._sessID) + print(sys.version_info) + if sys.version_info >= (3, 8): + if hasattr(self, '_sessID'): + return SharedMemoryIO(self.oid, self._sessID) + else: + # Using Drop without manager, just generate a random name. + sess_id = ''.join(random.choices(string.ascii_uppercase + string.digits, k=10)) + return SharedMemoryIO(self.oid, sess_id) else: raise NotImplementedError("Shared memory is only available with Python >= 3.8") @@ -2176,6 +2182,7 @@ def getIO(self): def dataURL(self): return "plasmaflight://%s" % (binascii.hexlify(self.object_id).decode("ascii")) + ## # @brief ParameterSet # @details A set of parameters, wholly specified in EAGLE