climate_ref.results.executions
#
Typed, ORM-free surface for execution-group and execution results.
ExecutionsReader is reached via Reader.executions. It wraps the group+latest query (get_execution_group_and_latest_filtered) and the per-(provider, diagnostic) status aggregate mapping ORM rows to frozen DTOs (Data Transfer Objects). These DTOs are detached from the database so outlive the database session.
Two write/recovery paths deliberately stay on the ORM helper instead of this reader:
cli/executions.py::delete_groups(needs live ORM objects to cascade-delete related rows and remove output directories)executor/reingest.py::get_executions_for_reingest(needsinclude_superseded=Trueplus the oldest execution in a group, not this reader's "latest" definition).
A common set of ordering (created_at DESC, id DESC) is used to ensure consistent ordering and tie breaks.
ExecutionGroupCollection
#
An immutable page of execution groups plus collection-level metadata.
Source code in packages/climate-ref/src/climate_ref/results/executions.py
items
instance-attribute
#
The execution groups on this page.
limit
instance-attribute
#
Page size requested, or None when the whole result was returned.
offset
instance-attribute
#
Rows skipped before this page.
total_count
instance-attribute
#
Total execution groups matching the filter before offset/limit.
to_pandas()
#
DataFrame mirroring the list-groups CLI columns.
Columns are emitted explicitly (id, key, provider, diagnostic, dirty, successful,
created_at, updated_at, selectors) even when the collection is empty, so callers can
select columns / build an empty table without special-casing.
Source code in packages/climate-ref/src/climate_ref/results/executions.py
ExecutionGroupFilter
#
Declarative filter over execution groups.
Every field is optional; None means "do not constrain on this axis".
This mirrors exactly what get_execution_group_and_latest_filtered supports --
diagnostic_contains/provider_contains are case-insensitive substring matches (OR-combined),
facets is the selector-facet map consumed by the helper's Python-side matching,
and successful vs latest_successful expose the helper's post-rank / pre-rank success filters.
Exact-match diagnostic_slug/provider_slug are a documented follow-up,
as the underlying helper only does substring matching today,
so adding exact match means extending the helper first.
Source code in packages/climate-ref/src/climate_ref/results/executions.py
diagnostic_contains = attrs.field(default=None, converter=_as_str_tuple)
class-attribute
instance-attribute
#
Case-insensitive substring matches on diagnostic slug (OR-combined).
dirty = None
class-attribute
instance-attribute
#
Constrain on the group's dirty flag.
facets = attrs.field(default=None, converter=_as_facets)
class-attribute
instance-attribute
#
Selector-facet map matched against each group's selectors.
include_superseded = False
class-attribute
instance-attribute
#
Include execution groups whose diagnostic_version is not the diagnostic's promoted version.
latest_successful = None
class-attribute
instance-attribute
#
Pre-rank population filter: change which execution is chosen as "latest" before ranking.
True ranks only over successful executions,
so a group's latest becomes its most recent successful run
(surfacing an earlier success even when a later run failed).
False ranks only over unsuccessful / in-progress runs.
None (default) ranks over all executions.
Composes with successful but answers a different question.
provider_contains = attrs.field(default=None, converter=_as_str_tuple)
class-attribute
instance-attribute
#
Case-insensitive substring matches on provider slug (OR-combined).
successful = None
class-attribute
instance-attribute
#
Post-rank filter on the winning execution: keep a group only if its latest execution matches.
True keeps groups whose latest execution succeeded.
False keeps groups whose latest execution failed, is in progress, or does not exist yet.
This does not change which execution is considered latest -- contrast latest_successful.
ExecutionGroupView
#
An execution group, detached from the ORM, with its per-group latest execution (if any).
Source code in packages/climate-ref/src/climate_ref/results/executions.py
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 is flagged for re-execution (e.g. new data has arrived).
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 most recent execution, or None if it has never been executed.
These groups are ranked by created_at DESC, id DESC.
This matches ExecutionsReader.latest_execution() and the statistics() aggregates.
provider_slug
instance-attribute
#
Owning provider's slug.
selectors
instance-attribute
#
The selector-facet values used to build this group's input-dataset selection.
successful
property
#
Convenience mirror of latest.successful (matches the CLI's successful column).
updated_at
instance-attribute
#
Timestamp the group was last updated.
ExecutionStats
#
Per-(provider, diagnostic) execution status counts, detached from the ORM.
Source code in packages/climate-ref/src/climate_ref/results/executions.py
diagnostic
instance-attribute
#
Diagnostic slug.
dirty
instance-attribute
#
Groups flagged for re-execution.
failed
instance-attribute
#
Groups whose latest execution exists with successful IS False.
not_started
instance-attribute
#
Groups with no execution yet.
provider
instance-attribute
#
Provider slug.
running
instance-attribute
#
Groups whose latest execution exists with successful IS NULL.
successful
instance-attribute
#
Groups whose latest execution exists with successful IS True.
total
instance-attribute
#
Total execution groups counted (at the diagnostic's promoted version).
ExecutionView
#
A single execution, detached from the ORM.
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.
id
instance-attribute
#
Primary key of the underlying Execution row.
output_fragment
instance-attribute
#
Relative directory storing this execution's output, once moved to the final output directory.
path
instance-attribute
#
Path to the output bundle, relative to the diagnostic execution result output directory.
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/False once the execution has finished, None while still running.
updated_at
instance-attribute
#
Timestamp the execution was last updated.
ExecutionsReader
#
Execution-group and execution read domain.
Constructed from a Database, which owns the session and the read-only story. All read methods return detached DTOs that outlive the session.
Source code in packages/climate-ref/src/climate_ref/results/executions.py
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 | |
session
property
#
The underlying database session.
execution(execution_id)
#
Fetch one execution by id, or None when no execution has that id.
Source code in packages/climate-ref/src/climate_ref/results/executions.py
group(execution_group_id)
#
Fetch one execution group by id, with its latest execution resolved.
Returns None when no group has that id.
Source code in packages/climate-ref/src/climate_ref/results/executions.py
groups(filters=None, *, offset=0, limit=None)
#
Query execution groups with their per-group latest execution.
Wraps get_execution_group_and_latest_filtered,
which returns a materialised list.
The facets axis is matched in Python (against each group's selectors),
and the helper materialises unconditionally,
so pagination here is a Python slice over the fully materialised list rather than SQL.
total_count is the post-filter length,
and the results are ordered by id ascending (the group primary key)
before slicing so paging is deterministic even when two groups share a created_at.
Source code in packages/climate-ref/src/climate_ref/results/executions.py
latest_execution(execution_group_id)
#
Return the most recent execution for a group.
Wraps latest_execution_for_group,
which tie-breaks using the same ranking groups() and statistics() use
(created_at DESC, id DESC).
Source code in packages/climate-ref/src/climate_ref/results/executions.py
outputs(execution_id)
#
Execute the select_execution_outputs builder and map rows to OutputView.
Source code in packages/climate-ref/src/climate_ref/results/executions.py
statistics(*, diagnostic_contains=None, provider_contains=None)
#
Execute the select_execution_statistics builder and map rows to ExecutionStats.
Source code in packages/climate-ref/src/climate_ref/results/executions.py
OutputView
#
A single registered execution output, detached from the ORM.
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 associated with this output.
execution_id
instance-attribute
#
The execution that registered this output.
filename
instance-attribute
#
Path to the output, relative to the diagnostic execution result output directory.
long_name
instance-attribute
#
Human-readable name for the output.
output_type
instance-attribute
#
The output's type (e.g. plot, data, HTML), which determines how it is displayed.
short_name
instance-attribute
#
Short key of the output, unique for a given result and output type.
select_execution_outputs(execution_id)
#
Build the Select for one execution's registered ExecutionOutput rows.
Ordered by (output_type, id) for stable, grouped output -- there is no prior consumer
ordering to preserve, since inspect did not list these rows before.
Source code in packages/climate-ref/src/climate_ref/results/executions.py
select_execution_statistics(*, diagnostic_contains=None, provider_contains=None)
#
Build the per-(provider, diagnostic) status-count aggregate Select.
Moved out of cli/executions.py::stats so the aggregate is reusable plumbing.
Only diagnostic_contains/provider_contains are accepted
(not the full ExecutionGroupFilter)
so dirty / successful / facets are never silently ignored
on an aggregate that cannot honour them.
Status definitions (unchanged from the CLI):
running-- latest execution exists andsuccessful IS NULL.failed-- latest execution exists andsuccessful IS False.successful-- latest execution exists andsuccessful IS True.not_started-- no execution exists for the group.dirty-- the group'sdirtyflag is set.
Only execution groups whose diagnostic_version matches the diagnostic's
promoted_version are counted (same promoted-version gate as
get_execution_group_and_latest_filtered).
Source code in packages/climate-ref/src/climate_ref/results/executions.py
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 | |