Skip to content

Commit

Permalink
Adds support for custom application arguments included in reproducibi…
Browse files Browse the repository at this point in the history
…lity data.
  • Loading branch information
pritchardn committed Jun 1, 2022
1 parent 341bbe0 commit dd123f5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 18 deletions.
9 changes: 4 additions & 5 deletions daliuge-common/dlg/common/reproducibility/reproducibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,13 @@ def accumulate_lg_drop_data(drop: dict, level: ReproducibilityFlags):
raise NotImplementedError(
f"Reproducibility level {level.name} not yet supported"
)
category_type = drop.get(
"categoryType", ""
) # Made conditional to support older graphs
category = drop.get("category", "")

# Cheeky way to get field list into dicts. map(dict, drop...) makes a copy
fields = {e.pop("name"): e["value"] for e in map(dict, drop["fields"])}
lg_fields = lg_block_fields(category_type, category, level)
fields = {e.pop("name"): e["value"] for e in map(dict, drop.get("fields", {}))}
app_fields = {e.pop("name"): e["value"] for e in map(dict, drop.get("applicationArgs", {}))}
fields.update(app_fields)
lg_fields = lg_block_fields(category, level, app_fields.keys())
data = extract_fields(fields, lg_fields)
return data

Expand Down
24 changes: 11 additions & 13 deletions daliuge-common/dlg/common/reproducibility/reproducibility_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,13 @@ def lgt_block_fields(rmode: ReproducibilityFlags):
return data


def lg_block_fields(
category: Categories, category_type: str, rmode: ReproducibilityFlags
):
def lg_block_fields(category_type: str, rmode: ReproducibilityFlags, custom_fields=None):
"""
Collects dict of fields and operations for all drop types at the lg layer for
the supplied reproducibility standard.
:param category: The broad type of drop
:param category_type: The specific type of drop
:param rmode: The reproducibility level in question
:param custom_fields: Additional application args (used in custom components)
:return: Dictionary of <str, FieldOp> pairs
"""
data = {}
Expand All @@ -104,15 +102,12 @@ def lg_block_fields(
ReproducibilityFlags.REPLICATE_SCI,
):
return data
# Drop category considerations
if category == "Application":
data["execution_time"] = FieldOps.STORE
data["num_cpus"] = FieldOps.STORE
elif category == "Group":
data["inputApplicationName"] = FieldOps.STORE
data["inputApplicationType"] = FieldOps.STORE
elif category == Categories.DATA: # An anomaly, I know
data["data_volume"] = FieldOps.STORE
# Drop category considerations - Just try to get everything we can, will be filtered later
data["execution_time"] = FieldOps.STORE
data["num_cpus"] = FieldOps.STORE
data["inputApplicationName"] = FieldOps.STORE
data["inputApplicationType"] = FieldOps.STORE
data["data_volume"] = FieldOps.STORE

# Drop type considerations
if category_type == Categories.START:
Expand Down Expand Up @@ -188,6 +183,9 @@ def lg_block_fields(
data["libpath"] = FieldOps.STORE
elif category_type == Categories.DYNLIB_PROC_APP:
data["libpath"] = FieldOps.STORE
if custom_fields is not None:
for name in custom_fields:
data[name] = FieldOps.STORE
return data


Expand Down

0 comments on commit dd123f5

Please sign in to comment.