Skip to content

Use custom runners for compute tasks and honor schema extra-field rules - #410

Draft
amirabbas-jalali-bentley wants to merge 2 commits into
SeequentEvo:add-compute-engine-type-stubsfrom
amirabbas-jalali-bentley:add-custom-compute-task-runners
Draft

amirabbas-jalali-bentley wants to merge 2 commits into
SeequentEvo:add-compute-engine-type-stubsfrom
amirabbas-jalali-bentley:add-custom-compute-task-runners

Conversation

@amirabbas-jalali-bentley

@amirabbas-jalali-bentley amirabbas-jalali-bentley commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Description

Part 5 of 6 in the generic compute engine series (stacked on #395 -> #407 -> #408 -> #409, targeting add-compute-engine-type-stubs).

Most compute tasks need no task-specific client code beyond their published JSON Schemas, while a few tasks have cross-field invariants JSON Schema cannot express, folded filter/diagnostic parameters, or rich result helpers. This PR adds the evo.compute.overrides seam so those tasks plug into ComputeClient (both client.<topic>.<task>.run(...) and client.arun(...)) while still routing discovery, validation, reference resolution, and submission through the shared engine, and refines unknown/extra-field handling to follow each schema's additionalProperties rule.

Changes

  • Custom runner seam (evo.compute.overrides):
    • load_override(topic, task) resolves evo.compute.overrides.<topic>.<task> on demand without touching the network on attribute access, and overridden_tasks() enumerates packaged overrides for _stubgen so engine.pyi imports the custom runner's signature directly instead of emitting a duplicate generated stub.
    • Both client.<topic>.<task>.run(...) and client.arun(topic, task, parameters) dispatch through the override when registered.
  • Worked Kriging custom runner (evo.compute.overrides.geostatistics.kriging.KrigingOverride):
    • Preserves KrigingParameters ergonomics (source_filter, target_filter, diagnostics, search / neighborhood, method / kriging_method, and block_discretization / block_discretisation adaptation to the live catalogue's parameter spelling), returns native KrigingResult, and enforces cross-field checks (preventing target updates from overwriting the source attribute on the same object, and checking min_samples <= max_samples).
  • Schema-driven extra-field policy:
    • Objects declaring additionalProperties: false reject unknown fields with ParameterValidationError; schema-valued additionalProperties validate unknown values; additionalProperties: true accepts them silently; and unspecified additionalProperties log a warning on compute.validation and forward values unchanged so newer service fields are never silently dropped.

No breaking changes to existing evo.compute.tasks APIs.

Testing

  • test_overrides.py (31 tests) verifies three-way payload parity across KrigingRunner, KrigingOverride, and generic _run_generic, cross-field refusal rules (including case/fragment-varied ObjectReference spellings), arun parity, and parameter-spelling adaptation.
  • Additional tests in test_engine.py, test_validation.py, and test_stubgen.py cover extra-field policies across nested containers and stub generation for overridden tasks.
  • evo-compute tests: 825 passed, 2 skipped (49 new, 670 subtests). ruff check, ruff format --check, mypy, pyright, and pre-commit hooks pass.

Checklist

  • I have read the contributing guide and the code of conduct

Add the evo.compute.overrides seam and a Kriging custom runner so tasks
with cross-field checks, folded filter/diagnostic parameters, or rich
result wrappers share ComputeClient's discovery, validation, and
reference resolution while keeping their native surface across both
attribute access and arun().

Also align unknown-field handling with each schema's
additionalProperties rule and update generated stubs accordingly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant