Skip to content

Commit 7d3845e

Browse files
Ryan CaliRyan Cali
authored andcommitted
Updated entity_message to be collected per input
1 parent 9be04d2 commit 7d3845e

File tree

2 files changed

+16
-17
lines changed

2 files changed

+16
-17
lines changed

pydra/engine/audit.py

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -182,19 +182,24 @@ def audit_task(self, task):
182182
else:
183183
command = None
184184

185-
path_hash_dict = {}
186-
187185
attr_list = attr_fields(task.inputs)
188186
for attrs in attr_list:
189187
if attrs.type in [File, Directory]:
190188
input_name = attrs.name
191189
input_path = os.path.abspath(getattr(task.inputs, input_name))
192190
file_hash = hash_file(input_path)
193-
path_hash_dict[input_path] = file_hash
191+
entity_id = f"uid:{gen_uuid()}"
192+
entity_message = {
193+
"@id": entity_id,
194+
"Label": print(entity_label),
195+
"AtLocation": input_path,
196+
"GeneratedBy": "test",
197+
"@type": "input",
198+
"digest": file_hash
199+
}
200+
self.audit_message(entity_message, AuditFlag.PROV)
201+
194202

195-
# get the hash for the output
196-
input_paths = list(path_hash_dict.keys())
197-
input_paths_hash = list(path_hash_dict.values())
198203

199204
if command is not None:
200205
cmd_name = command.split()[0]
@@ -222,15 +227,9 @@ def audit_task(self, task):
222227
"StartedAtTime": now(),
223228
"AssociatedWith": version_cmd,
224229
}
225-
entity_id = f"uid:{gen_uuid()}"
226-
entity_message = {
227-
"@id": entity_id,
228-
"Label": print(entity_label),
229-
"AtLocation": input_paths, #
230-
"GeneratedBy": "test",
231-
"@type": "input",
232-
"digest": input_paths_hash,
233-
}
230+
231+
234232

235233
self.audit_message(start_message, AuditFlag.PROV)
236-
self.audit_message(entity_message, AuditFlag.PROV)
234+
235+

pydra/engine/tests/test_task.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1264,7 +1264,7 @@ def testfunc(a: int, b: float = 0.1) -> ty.NamedTuple("Output", [("out", float)]
12641264
from glob import glob
12651265

12661266
assert len(glob(str(tmpdir / funky.checksum / "proc*.log"))) == 1
1267-
assert len(glob(str(message_path / "*.jsonld"))) == 8
1267+
assert len(glob(str(message_path / "*.jsonld"))) == 7
12681268

12691269
# commented out to speed up testing
12701270
collect_messages(tmpdir / funky.checksum, message_path, ld_op="compact")

0 commit comments

Comments
 (0)