Provenance¶
provenance
¶
Provenance of experiment runs: W3C PROV and Workflow Run RO-Crate.
A run's record says which program ran, on which data, under which
configuration, and what it produced. prov_document states this in the
W3C PROV data model, serialized as PROV-JSON: one bundle per run, in which
the run is an activity that used the program, its source files, its data,
and its configuration (entities), was associated with the quivers engine
(a software agent), and generated the result, which was derived from
the program and the data. Every entity carries its content hash; a source
file also carries its Software Heritage identifier (SWHID), the intrinsic
identifier under which the archive serves the file once it is archived.
write_crate packages an experiment as a Workflow Run RO-Crate: the module
declaring the experiment is the crate's main workflow (its formal
parameters are the names the experiment gives values to), every run is a
CreateAction whose instrument is the workflow, whose objects are the
data files and values it used, and whose results are its record and its
PROV document, and the root dataset conforms to the Process Run Crate,
Workflow Run Crate, and Workflow RO-Crate profiles.
PROV_NAMESPACE
module-attribute
¶
The namespace of the qvr: attributes and types of a PROV document.
RUN_NAMESPACE
module-attribute
¶
The namespace of a PROV document's identifiers: a run's hash names it.
RO_CRATE_CONTEXT
module-attribute
¶
The JSON-LD context of the crate's metadata.
CRATE_PROFILES
module-attribute
¶
CRATE_PROFILES = ('https://w3id.org/ro/wfrun/process/0.5', 'https://w3id.org/ro/wfrun/workflow/0.5', 'https://w3id.org/workflowhub/workflow-ro-crate/1.0')
The profiles a crate's root dataset conforms to.
FORMAL_PARAMETER_PROFILE
module-attribute
¶
The Bioschemas profile each input and output parameter of a crate conforms to.
COMPUTATIONAL_WORKFLOW_PROFILE
module-attribute
¶
COMPUTATIONAL_WORKFLOW_PROFILE = 'https://bioschemas.org/profiles/ComputationalWorkflow/1.0-RELEASE'
The Bioschemas profile a crate's main workflow entity conforms to.
outputs_digest
¶
outputs_digest(record: JsonValue) -> str
The content hash of a record's outputs.
| PARAMETER | DESCRIPTION |
|---|---|
record
|
A run record.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
The digest of the outputs' canonical JSON. |
| RAISES | DESCRIPTION |
|---|---|
ExperimentError
|
If the record has no outputs. |
Source code in src/quivers/experiments/provenance.py
prov_document
¶
The W3C PROV account of one run, as a PROV-JSON document.
| PARAMETER | DESCRIPTION |
|---|---|
record
|
A run record (
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[str, JsonValue]
|
A PROV-JSON document holding one bundle, named by the run's hash, with the run activity, its entities and agent, and the relations between them. |
| RAISES | DESCRIPTION |
|---|---|
ExperimentError
|
If the record is malformed. |
Source code in src/quivers/experiments/provenance.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | |
write_crate
¶
write_crate(records: Sequence[JsonValue], *, file: str | Path, directory: str | Path) -> Path
Package an experiment's runs as a Workflow Run RO-Crate.
| PARAMETER | DESCRIPTION |
|---|---|
records
|
The run records of one experiment (its points).
TYPE:
|
file
|
The module file declaring the experiment; the paths a record names are relative to its directory.
TYPE:
|
directory
|
Where the crate is written; created if absent.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
Path
|
The crate's |
| RAISES | DESCRIPTION |
|---|---|
ExperimentError
|
If there are no records, they belong to different experiments, or a record is malformed. |
OSError
|
If a source or data file cannot be copied. |
Source code in src/quivers/experiments/provenance.py
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 | |