Repository navigation
Add a discovery client for compute tasks - #387
amirabbas-jalali-bentley merged 4 commits into
Conversation
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.
PaulCaygill-Seequent
left a comment
There was a problem hiding this comment.
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
aminabedi-bentley
left a comment
There was a problem hiding this comment.
One minor comment and one major docs issue pointed out.
Otherwise LGTM!
Fair point. These are convenience methods for common lookups. |
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 addsDiscoveryClientfor it.Changes
DiscoveryClient(exported fromevo.compute, with afrom_contextconstructor) fetches every page of the listing withdetails=trueand caches the combined catalogue forcache_ttl_seconds(300 by default). Concurrent calls on a cold cache share a single fetch.list_tasks,get_topics,get_topic_tasksandget_taskread from that cache. Each takesforce_refresh=Trueto fetch again straight away.TaskResourcemodels, also exported. Fields the service adds later are kept rather than dropped.DiscoveryApiwraps the endpoint, including itstopic,name,key,limitandoffsetfilters. It is written by hand in the same style as the generatedJobsApiandTasksApi.DiscoveryClientis added to the API client list for the docs.No breaking changes; this only adds new classes.
Testing
total), cache expiry,force_refresh, a single fetch for concurrent cold calls, the accessors andfrom_context.evo-computetests: 516 passed (15 new).ruff checkandruff format --checkare clean.Checklist