Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP - BEP 028 prov #750

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions pydra/engine/audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@
start_message = {
"@id": self.aid,
"@type": "job",
"startedAtTime": now(),
"executedBy": user_id,
"StartedAtTime": now(),
}

os.chdir(self.odir)
Expand All @@ -88,7 +87,7 @@
{
"@id": self.mid,
"@type": "monitor",
"startedAtTime": now(),
"StartedAtTime": now(),
"wasStartedBy": self.aid,
},
AuditFlag.PROV,
Expand All @@ -103,7 +102,7 @@
result.runtime = gather_runtime_info(self.resource_monitor.fname)
if self.audit_check(AuditFlag.PROV):
self.audit_message(
{"@id": self.mid, "endedAtTime": now(), "wasEndedBy": self.aid},
{"@id": self.mid, "EndedAtTime": now(), "wasEndedBy": self.aid},
AuditFlag.PROV,
)
# audit resources/runtime information
Expand All @@ -113,14 +112,14 @@
**{
"@id": self.eid,
"@type": "runtime",
"prov:wasGeneratedBy": self.aid,
"GeneratedBy": self.aid,
}
)
self.audit_message(entity, AuditFlag.PROV)
self.audit_message(
{
"@type": "prov:Generation",
"entity_generated": self.eid,
"runtime": self.eid,
"hadActivity": self.mid,
},
AuditFlag.PROV,
Expand All @@ -129,7 +128,7 @@
if self.audit_check(AuditFlag.PROV):
# audit outputs
self.audit_message(
{"@id": self.aid, "endedAtTime": now(), "errored": result.errored},
{"@id": self.aid, "EndedAtTime": now(), "errored": result.errored},
AuditFlag.PROV,
)

Expand Down Expand Up @@ -188,8 +187,10 @@

label = job.name

# YC: currently command only support shellcommand task
# we can make function itself a command too
command = job.task.cmdline if hasattr(job.task, "executable") else None
attr_list = task_fields(job.task)
attr_list = attr_fields(task.inputs)

Check warning on line 193 in pydra/engine/audit.py

View check run for this annotation

Codecov / codecov/patch

pydra/engine/audit.py#L193

Added line #L193 was not covered by tests
for attrs in attr_list:
input_name = attrs.name
value = job.inputs[input_name]
Expand Down Expand Up @@ -231,7 +232,14 @@
"Label": label,
"Command": command,
"StartedAtTime": now(),
"AssociatedWith": version_cmd,
"AssociatedWith": {
"@id": self.aid,
# YC: need to add Label, which should be
# the software name in a shellcommand task
# the function's package in a function task
# else be python
"Version": version_cmd,
},
}

self.audit_message(start_message, AuditFlag.PROV)
15 changes: 10 additions & 5 deletions pydra/schema/context.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"@container": "@type"
}
},
"https://raw.githubusercontent.com/openprov/prov-jsonld/69964ed16818f78dc5f71bdf97add026288291d4/context.json",
"https://raw.githubusercontent.com/bids-standard/BEP028_BIDSprov/master/context.json",
{
"pydra": "http://s.pydra.org/",
"uid": "pydra:id/",
Expand All @@ -24,10 +24,6 @@
"@id": "pydra:runtimeInformation",
"@type": "@vocab"
},
"prov:wasGeneratedBy": {
"@id": "prov:wasGeneratedBy",
"@type": "@vocab"
},
"rss_peak_gb": {
"@id": "pydra:rss_peak_gb",
"@type": "xsd:float"
Expand All @@ -40,6 +36,15 @@
"@id": "pydra:cpu_peak_percent",
"@type": "xsd:float"
},
"wasStartedBy": {
"@id": "uid"
},
"wasEndedBy": {
"@id": "uid"
},
"hadActivity": {
"@id": "uid"
},
"errored": {
"@id": "pydra:errored",
"@type": "xsd:boolean"
Expand Down
Loading