climate_ref.results.executions
#
Find out which diagnostic executions happened, which failed and why, and what files they produced.
ExecutionsReader is reached via Reader.executions.
It returns:
- ExecutionGroupView:
a group, with its newest execution in
latest. - ExecutionView: one execution.
- OutputView: one file or plot an execution produced.
- ExecutionGroupCollection:
a page of groups, with
to_pandas().
A group's newest execution is the one created last.
group and
latest_execution
take it from all of the group's executions.
groups and the counts apply the filter first,
so a group whose newest execution is retracted is dropped,
and a time window, execution_ids or latest_successful can change the pick.
Code that changes groups, such as deleting or requeuing them, uses group_rows. To read results, use groups.
Examples:
Which executions of the ENSO diagnostic failed, and why?
from climate_ref.results import ExecutionGroupFilter, Reader
with Database.from_config(config, read_only=True) as db:
reader = Reader(db)
failing = reader.executions.groups(
ExecutionGroupFilter(provider_slug="pmp", diagnostic_slug="enso_tel", successful=False)
)
print(failing.to_pandas()[["id", "failure_reason", "selectors"]])
ExecutionGroupCollection
#
Bases: Page[ExecutionGroupView]
A page of execution groups.
Iterate it for ExecutionGroupView items,
call to_pandas() for a table, or use len() for the size of the page.
total_count is the number of matching groups before paging.
Examples:
An empty page still gives a DataFrame with the right columns:
>>> from climate_ref.results.executions import ExecutionGroupCollection
>>> page = ExecutionGroupCollection(items=(), total_count=0, offset=0, limit=None)
>>> len(page)
0
>>> list(page.to_pandas().columns[:4])
['id', 'key', 'provider', 'diagnostic']
Source code in packages/climate-ref/src/climate_ref/results/executions.py
to_pandas()
#
Convert to a DataFrame with the same columns as ref executions list-groups.
The columns are id, key, provider, diagnostic, dirty, successful,
failure_reason, created_at, updated_at and selectors.
They are present even when the collection is empty.
Source code in packages/climate-ref/src/climate_ref/results/executions.py
ExecutionGroupView
#
One diagnostic applied to one set of input datasets, with its newest execution if it has one.
For example, the ENSO diagnostic run on ACCESS-CM2 historical data is one group.
Get groups from ExecutionsReader.groups
or ExecutionsReader.group.
successful and failure_reason report on the newest execution.
Examples:
An execution group that has never been run has no newest execution:
>>> import datetime
>>> from climate_ref.results.executions import ExecutionGroupView
>>> group = ExecutionGroupView(
... id=7,
... key="cmip6_ACCESS-CM2_r1i1p1f1",
... diagnostic_slug="enso_tel",
... provider_slug="pmp",
... dirty=False,
... diagnostic_version=1,
... selectors={"cmip6": [["source_id", "ACCESS-CM2"]]},
... created_at=datetime.datetime(2026, 3, 1),
... updated_at=datetime.datetime(2026, 3, 1),
... latest=None,
... )
>>> group.successful is None
True
Source code in packages/climate-ref/src/climate_ref/results/executions.py
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 | |
created_at
instance-attribute
#
Timestamp the group was created.
diagnostic_slug
instance-attribute
#
Owning diagnostic's slug.
diagnostic_version
instance-attribute
#
Diagnostic version this group was executed against.
dirty
instance-attribute
#
Whether the group's inputs have changed, so it needs to be run again.
failure_reason
property
#
Why the newest execution failed, or None. See ExecutionView.failure_reason.
id
instance-attribute
#
Primary key of the underlying ExecutionGroup row.
key
instance-attribute
#
Stable key identifying the group's input-dataset selection.
latest
instance-attribute
#
The group's newest execution, or None if it has never been run.
From groups() this is the newest execution the filter keeps,
which can differ from what
ExecutionsReader.latest_execution
returns, because that ignores retraction and version scope.
With latest_successful=True, a time window or execution_ids it is the newest matching execution.
provider_slug
instance-attribute
#
Owning provider's slug.
selectors
instance-attribute
#
The facet values that selected this group's input datasets, keyed by dataset type.
successful
property
#
Whether the newest execution succeeded, or None if it is still running or there is none.
updated_at
instance-attribute
#
Timestamp the group was last updated.
ExecutionView
#
One execution of a diagnostic.
Get one from ExecutionsReader.execution,
or from latest on an ExecutionGroupView.
Examples:
>>> import datetime
>>> from climate_ref.results.executions import ExecutionView
>>> now = datetime.datetime(2026, 3, 1)
>>> execution = ExecutionView(
... id=42,
... execution_group_id=7,
... successful=False,
... failure_reason="diagnostic_error",
... dataset_hash="abc123",
... retracted=False,
... output_fragment="pmp/enso_tel/ACCESS-CM2_g12_v1_3f9a1c2e/42",
... path=None,
... provider_version="v1.0",
... created_at=now,
... updated_at=now,
... )
>>> execution.successful
False
Source code in packages/climate-ref/src/climate_ref/results/executions.py
created_at
instance-attribute
#
Timestamp the execution was created.
dataset_hash
instance-attribute
#
Hash of the input datasets used for this execution.
execution_group_id
instance-attribute
#
The execution group this execution belongs to.
failure_reason = None
class-attribute
instance-attribute
#
Why a failed execution failed, or None.
This is the value of a ExecutionFailureReason.
id
instance-attribute
#
Primary key of the underlying Execution row.
output_fragment
instance-attribute
#
Directory holding this execution's outputs, relative to the results root.
Pass it to reader.artifacts to get a path on disk.
path
instance-attribute
#
Path to the output bundle, relative to output_fragment, or None if there is none.
provider_version
instance-attribute
#
Version of the diagnostic provider that produced this execution.
retracted
instance-attribute
#
Whether this execution has been retracted.
successful
instance-attribute
#
True or False once the execution has finished, None while it is still running.
updated_at
instance-attribute
#
Timestamp the execution was last updated.
ExecutionsReader
#
Look up executions, their outcomes and the files they produced.
Reach it as Reader(db).executions.
See the module overview for what an execution and a group are.
Examples:
from climate_ref.results import ExecutionGroupFilter, Reader
with Database.from_config(config, read_only=True) as db:
reader = Reader(db)
# Groups whose newest execution failed, 20 at a time
page = reader.executions.groups(ExecutionGroupFilter(successful=False), limit=20)
print(page.total_count)
# One group, its newest execution and the files that execution produced
group = reader.executions.group(page.items[0].id)
if group.latest is not None:
for output in reader.executions.outputs(group.latest.id):
print(output.output_type, output.filename)
Source code in packages/climate-ref/src/climate_ref/results/executions.py
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 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 | |
session
property
#
The database session the queries run in.
execution(execution_id)
#
Look up one execution by id, or None when no execution has that id.
Examples:
with Database.from_config(config, read_only=True) as db:
execution = Reader(db).executions.execution(42)
print(execution.output_fragment)
Source code in packages/climate-ref/src/climate_ref/results/executions.py
group(execution_group_id)
#
Look up one execution group by id, with its newest execution.
Returns:
| Type | Description |
|---|---|
ExecutionGroupView | None
|
|
Examples:
with Database.from_config(config, read_only=True) as db:
group = Reader(db).executions.group(7)
if group is not None:
print(group.provider_slug, group.diagnostic_slug, group.successful)
Source code in packages/climate-ref/src/climate_ref/results/executions.py
group_rows(filters=None)
#
Get matching groups and their newest executions as database rows that code can change.
This is for code that deletes or requeues groups. To read results, use groups instead.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filters
|
ExecutionGroupFilter | None
|
Which groups to return. |
None
|
Returns:
| Type | Description |
|---|---|
list[tuple[ExecutionGroup, Execution | None]]
|
One |
Examples:
from climate_ref.results import ExecutionGroupFilter, Reader
with Database.from_config(config) as db:
for group, latest in Reader(db).executions.group_rows(ExecutionGroupFilter(dirty=True)):
print(group.id, group.diagnostic.slug, latest.successful if latest else None)
Source code in packages/climate-ref/src/climate_ref/results/executions.py
groups(filters=None, *, offset=0, limit=None, with_count=True)
#
Which execution groups match, and how did their newest execution go?
Each group comes with its newest execution, so you can see whether it succeeded and why not. The results are plain objects that stay usable after the database is closed. Code that changes groups uses group_rows.
successful and latest_successful ask different questions.
Say a model's execution failed last week but succeeded the week before.
With successful=False the group matches, because its newest execution failed.
With latest_successful=True the group matches too, but its latest is now
the execution from the week before, because that is the newest one that succeeded.
See ExecutionGroupFilter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filters
|
ExecutionGroupFilter | None
|
Which groups to return. |
None
|
offset
|
int
|
Groups to skip, in id order. |
0
|
limit
|
int | None
|
Maximum groups to return. |
None
|
with_count
|
bool
|
Set |
True
|
Returns:
| Type | Description |
|---|---|
ExecutionGroupCollection
|
The page of groups, ordered by group id so paging is stable.
|
Examples:
The second page of PMP groups whose newest execution failed inside the diagnostic:
from climate_ref.models.execution import ExecutionFailureReason
from climate_ref.results import ExecutionGroupFilter, Reader
filters = ExecutionGroupFilter(
provider_slug="pmp",
successful=False,
failure_reasons=[ExecutionFailureReason.DiagnosticError],
)
with Database.from_config(config, read_only=True) as db:
page = Reader(db).executions.groups(filters, offset=20, limit=20)
print(page.total_count, len(page))
df = page.to_pandas()
Source code in packages/climate-ref/src/climate_ref/results/executions.py
latest_execution(execution_group_id)
#
Find the newest execution of this group, whether or not it succeeded.
The newest execution is the one created last.
To get the newest successful execution instead, filter groups with latest_successful=True.
Returns:
| Type | Description |
|---|---|
ExecutionView | None
|
|
Examples:
with Database.from_config(config, read_only=True) as db:
latest = Reader(db).executions.latest_execution(7)
if latest is not None and latest.successful is False:
print(latest.failure_reason)
Source code in packages/climate-ref/src/climate_ref/results/executions.py
outputs(execution_id)
#
Which plots and data files did an execution produce?
The outputs are ordered by type, then id.
OutputView.filename is None when the output has no file.
Pass output_fragment and filename to reader.artifacts.output_file to get a path on disk.
Examples:
with Database.from_config(config, read_only=True) as db:
for output in Reader(db).executions.outputs(42):
print(output.output_type, output.short_name, output.filename)
Source code in packages/climate-ref/src/climate_ref/results/executions.py
OutputView
#
A file an execution produced, such as a plot or a data file.
Get them from ExecutionsReader.outputs.
Join filename onto the execution's output_fragment to find the file.
Examples:
>>> from climate_ref.results.executions import OutputView
>>> output = OutputView(
... execution_id=42,
... output_type="plot",
... filename="plots/enso_tel.png",
... short_name="enso_tel_plot",
... long_name="ENSO teleconnection",
... description=None,
... dimensions={"source_id": "ACCESS-CM2"},
... )
>>> output.output_type
'plot'
Source code in packages/climate-ref/src/climate_ref/results/executions.py
description
instance-attribute
#
Free-text description of the output.
dimensions
instance-attribute
#
CV dimension values for this output, such as {"source_id": "ACCESS-CM2"}.
execution_id
instance-attribute
#
The execution that registered this output.
filename
instance-attribute
#
Path to the output, relative to the execution's output_fragment.
long_name
instance-attribute
#
Human-readable name for the output.
output_type
instance-attribute
#
The kind of output, such as "plot", "data" or "html".
short_name
instance-attribute
#
Short key of the output, unique for a given execution and output type.