Skip to content

Commit

Permalink
Changes to DLM for control of EHT data drop
Browse files Browse the repository at this point in the history
  • Loading branch information
awicenec committed Oct 7, 2022
1 parent cceeed7 commit c4f4c65
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
11 changes: 11 additions & 0 deletions daliuge-engine/dlg/data/drops/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,17 @@ class FileDROP(DataDROP, PathBasedDrop):
delete_parent_directory = dlg_bool_param("delete_parent_directory", False)
check_filepath_exists = dlg_bool_param("check_filepath_exists", False)

# Make sure files are not deleted by default and certainly not in they are
# marked as precious
def __init__(self, *args, **kwargs):
if "precious" not in kwargs:
kwargs["precious"] = True
if "expireAfterUse" not in kwargs:
kwargs["expireAfterUse"] = False
if kwargs["precious"]: kwargs["expireAfterUse"] = False
super().__init__(*args, **kwargs)


def sanitize_paths(self, filepath, dirname):

# first replace any ENV_VARS on the names
Expand Down
2 changes: 2 additions & 0 deletions daliuge-engine/dlg/data/drops/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ def __init__(self, *args, **kwargs):
kwargs["precious"] = False
if "expireAfterUse" not in kwargs:
kwargs["expireAfterUse"] = True
if kwargs["precious"]:
kwargs["expireAfterUse"] = False
super().__init__(*args, **kwargs)

def initialize(self, **kwargs):
Expand Down
9 changes: 6 additions & 3 deletions daliuge-engine/dlg/drop.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ def __init__(self, oid, uid, **kwargs):
"but they are mutually exclusive" % (self,),
)

self._expireAfterUse = self._popArg(kwargs, "expireAfterUse", True)
self._expireAfterUse = self._popArg(kwargs, "expireAfterUse", False)
self._expirationDate = -1
if not self._expireAfterUse:
lifespan = float(self._popArg(kwargs, "lifespan", -1))
Expand All @@ -348,8 +348,11 @@ def __init__(self, oid, uid, **kwargs):
if "expectedSize" in kwargs and kwargs["expectedSize"]:
self._expectedSize = int(kwargs.pop("expectedSize"))

# All DROPs are precious unless stated otherwise; used for replication
self._precious = self._popArg(kwargs, "precious", True)
# No DROP is precious unless stated otherwise; used for replication
self._precious = self._popArg(kwargs, "precious", False)
# If DROP is precious, don't expire (delete) it.
if self._precious:
self._expireAfterUse = False

# Useful to have access to all EAGLE parameters without a prior knowledge
self._parameters = dict(kwargs)
Expand Down
2 changes: 1 addition & 1 deletion daliuge-engine/dlg/lifecycle/dlm.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def expireCompletedDrops(self):

# Expire-after-use: mark as expired if all consumers
# are finished using this DROP
if drop.expireAfterUse:
if not drop.precious and drop.expireAfterUse:
allDone = all(
c.execStatus in [AppDROPStates.FINISHED, AppDROPStates.ERROR]
for c in drop.consumers
Expand Down

0 comments on commit c4f4c65

Please sign in to comment.