Skip to main content

DiscoveryClient

GitHub source

DiscoveryClient

evo.compute.discovery.DiscoveryClient

List the compute task catalogue for an organization.

Returned tasks are independent copies, so editing them does not affect the cache.

Parameters:

NameTypeDescriptionDefault
connectorAPIConnectorThe API connector to use.required
org_idUUIDThe organization ID.required
cache_ttl_secondsfloatHow long a fetched catalogue is cached before the next call re-fetches it. Pass force_refresh=True to any accessor to re-fetch sooner.DEFAULT_CACHE_TTL_SECONDS

org_id property​

org_id: UUID

The organization ID.

from_context classmethod​

from_context(context: IContext, *, cache_ttl_seconds: float = DEFAULT_CACHE_TTL_SECONDS) -> DiscoveryClient

Create a DiscoveryClient from any real evo.common.IContext.

Parameters:

NameTypeDescriptionDefault
contextIContextThe context to create the client from (provides the connector and org id).required
cache_ttl_secondsfloatThe catalogue cache time-to-live, in seconds.DEFAULT_CACHE_TTL_SECONDS

Returns:

TypeDescription
DiscoveryClientA DiscoveryClient instance.

list_tasks async​

list_tasks(*, force_refresh: bool = False) -> list[TaskResource]

Return the full catalogue of discoverable tasks.

Served from the cache while it is within its TTL; pass force_refresh=True to re-fetch immediately.

Parameters:

NameTypeDescriptionDefault
force_refreshboolRe-fetch the catalogue even if the cache is still valid.False

Returns:

TypeDescription
list[TaskResource]Every advertised task.

get_topics async​

get_topics(*, force_refresh: bool = False) -> list[str]

Return the sorted list of topics that have discoverable tasks.

Parameters:

NameTypeDescriptionDefault
force_refreshboolRe-fetch the catalogue even if the cache is still valid.False

get_topic_tasks async​

get_topic_tasks(topic: str, *, force_refresh: bool = False) -> list[TaskResource]

Return the tasks advertised within a single topic.

Parameters:

NameTypeDescriptionDefault
topicstrThe task topic.required
force_refreshboolRe-fetch the catalogue even if the cache is still valid.False

Returns:

TypeDescription
list[TaskResource]The tasks in the topic (empty if the topic is not advertised).

get_task async​

get_task(topic: str, name: str, *, force_refresh: bool = False) -> TaskResource | None

Return a single task by topic and name, or None if it is not advertised.

Parameters:

NameTypeDescriptionDefault
topicstrThe task topic.required
namestrThe task name as advertised by the platform (e.g. kriging).required
force_refreshboolRe-fetch the catalogue even if the cache is still valid.False

Returns:

TypeDescription
TaskResource | NoneThe matching task, or None.

Was this page helpful?