Skip to content

Commit e00a61a

Browse files
committed
add customized fields and fix typos
1 parent 6b3a556 commit e00a61a

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed

pydra/engine/audit.py

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ def start_audit(self, odir):
6262
start_message = {
6363
"@id": self.aid,
6464
"@type": "task",
65-
"startedAtTime": now(),
66-
"executedBy": user_id,
65+
"StartedAtTime": now(),
6766
}
6867

6968
os.chdir(self.odir)
@@ -84,7 +83,7 @@ def monitor(self):
8483
{
8584
"@id": self.mid,
8685
"@type": "monitor",
87-
"startedAtTime": now(),
86+
"StartedAtTime": now(),
8887
"wasStartedBy": self.aid,
8988
},
9089
AuditFlag.PROV,
@@ -97,7 +96,7 @@ def finalize_audit(self, result):
9796
result.runtime = gather_runtime_info(self.resource_monitor.fname)
9897
if self.audit_check(AuditFlag.PROV):
9998
self.audit_message(
100-
{"@id": self.mid, "endedAtTime": now(), "wasEndedBy": self.aid},
99+
{"@id": self.mid, "EndedAtTime": now(), "wasEndedBy": self.aid},
101100
AuditFlag.PROV,
102101
)
103102
# audit resources/runtime information
@@ -107,14 +106,14 @@ def finalize_audit(self, result):
107106
**{
108107
"@id": self.eid,
109108
"@type": "runtime",
110-
"prov:wasGeneratedBy": self.aid,
109+
"GeneratedBy": self.aid,
111110
}
112111
)
113112
self.audit_message(entity, AuditFlag.PROV)
114113
self.audit_message(
115114
{
116115
"@type": "prov:Generation",
117-
"entity_generated": self.eid,
116+
"runtime": self.eid,
118117
"hadActivity": self.mid,
119118
},
120119
AuditFlag.PROV,
@@ -123,7 +122,7 @@ def finalize_audit(self, result):
123122
if self.audit_check(AuditFlag.PROV):
124123
# audit outputs
125124
self.audit_message(
126-
{"@id": self.aid, "endedAtTime": now(), "errored": result.errored},
125+
{"@id": self.aid, "EndedAtTime": now(), "errored": result.errored},
127126
AuditFlag.PROV,
128127
)
129128

@@ -181,6 +180,8 @@ def audit_task(self, task):
181180

182181
label = task.name
183182

183+
# YC: currently command only support shellcommand task
184+
# we can make function itself a command too
184185
command = task.cmdline if hasattr(task.inputs, "executable") else None
185186
attr_list = attr_fields(task.inputs)
186187
for attrs in attr_list:
@@ -224,7 +225,15 @@ def audit_task(self, task):
224225
"Label": label,
225226
"Command": command,
226227
"StartedAtTime": now(),
227-
"AssociatedWith": version_cmd,
228+
"AssociatedWith":
229+
{
230+
"@id": self.aid,
231+
# YC: need to add Label, which should be
232+
# the software name in a shellcommand task
233+
# the function's package in a function task
234+
# else be python
235+
"Version": version_cmd
236+
},
228237
}
229238

230239
self.audit_message(start_message, AuditFlag.PROV)

pydra/schema/context.jsonld

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,15 @@
3636
"@id": "pydra:cpu_peak_percent",
3737
"@type": "xsd:float"
3838
},
39+
"wasStartedBy": {
40+
"@id": "uid"
41+
},
42+
"wasEndedBy": {
43+
"@id": "uid"
44+
},
45+
"hadActivity": {
46+
"@id": "uid"
47+
},
3948
"errored": {
4049
"@id": "pydra:errored",
4150
"@type": "xsd:boolean"

0 commit comments

Comments
 (0)