Skip to content

Add a discovery client for compute tasks - #387

Merged
amirabbas-jalali-bentley merged 4 commits into
SeequentEvo:mainfrom
amirabbas-jalali-bentley:add-compute-task-discovery-client
Oct 29, 2026
Merged

amirabbas-jalali-bentley merged 4 commits into
SeequentEvo:mainfrom
amirabbas-jalali-bentley:add-compute-task-discovery-client

Conversation

@amirabbas-jalali-bentley

Copy link
Copy Markdown
Contributor

Description

The compute platform lists the tasks an organization can run at GET /compute/orgs/{org_id}/tasks, with each task's version, preview flag and the JSON Schemas of its parameters and results. The SDK had no way to read that list. This adds DiscoveryClient for it.

Changes

  • DiscoveryClient (exported from evo.compute, with a from_context constructor) fetches every page of the listing with details=true and caches the combined catalogue for cache_ttl_seconds (300 by default). Concurrent calls on a cold cache share a single fetch.
  • list_tasks, get_topics, get_topic_tasks and get_task read from that cache. Each takes force_refresh=True to fetch again straight away.
  • Tasks are returned as TaskResource models, also exported. Fields the service adds later are kept rather than dropped.
  • DiscoveryApi wraps the endpoint, including its topic, name, key, limit and offset filters. It is written by hand in the same style as the generated JobsApi and TasksApi.
  • DiscoveryClient is added to the API client list for the docs.
from evo.compute import DiscoveryClient

discovery = DiscoveryClient.from_context(manager)

print(await discovery.get_topics())
for task in await discovery.get_topic_tasks("geostatistics"):
    print(task.name, task.version)

kriging = await discovery.get_task("geostatistics", "kriging")  # None if it isn't listed

No breaking changes; this only adds new classes.

Testing

  • New tests run the client against a mocked discovery endpoint: the request it sends, parsing, pagination (including a page without a total), cache expiry, force_refresh, a single fetch for concurrent cold calls, the accessors and from_context.
  • evo-compute tests: 516 passed (15 new). ruff check and ruff format --check are clean.

Checklist

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

DiscoveryClient lists the compute tasks available to an organization,
with each task's parameter and result schemas, through
GET /compute/orgs/{org_id}/tasks. It follows the paginated listing to
the end and caches the catalogue for a configurable time. get_topics,
get_topic_tasks and get_task read from the same cache, and every
accessor takes force_refresh.

DiscoveryApi wraps the endpoint by hand, in the same style as the
generated JobsApi and TasksApi.
Comment thread mkdocs/site/packages/evo-compute/index.html

@PaulCaygill-Seequent PaulCaygill-Seequent left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems fine, can't see any issues with what you've done.

I don't really see why we need so many variations on the "get the response filtered this way", when a user could simply call list_tasks and then filter them themselves with some very simple python code. It's not technically a real issue, just an observation that we're making the client quite verbose - I think it's fine regardless

Comment thread packages/evo-compute/src/evo/compute/discovery.py

@aminabedi-bentley aminabedi-bentley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor comment and one major docs issue pointed out.
Otherwise LGTM!

@amirabbas-jalali-bentley

Copy link
Copy Markdown
Contributor Author

seems fine, can't see any issues with what you've done.

I don't really see why we need so many variations on the "get the response filtered this way", when a user could simply call list_tasks and then filter them themselves with some very simple python code. It's not technically a real issue, just an observation that we're making the client quite verbose - I think it's fine regardless

Fair point. These are convenience methods for common lookups.
Callers can still use list_tasks and filter directly. I’ve kept them small, and they all share the same cached catalogue.

@amirabbas-jalali-bentley
amirabbas-jalali-bentley merged commit 45f8748 into SeequentEvo:main Oct 29, 2026
16 checks passed
@amirabbas-jalali-bentley
amirabbas-jalali-bentley deleted the add-compute-task-discovery-client branch October 29, 2026 16:46
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.

4 participants