GitHub source

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:

Name Type Description Default
connector APIConnector

The API connector to use.

required
org_id UUID

The organization ID.

required
cache_ttl_seconds float

How 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:

Name Type Description Default
context IContext

The context to create the client from (provides the connector and org id).

required
cache_ttl_seconds float

The catalogue cache time-to-live, in seconds.

DEFAULT_CACHE_TTL_SECONDS

Returns:

Type Description
DiscoveryClient

A 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:

Name Type Description Default
force_refresh bool

Re-fetch the catalogue even if the cache is still valid.

False

Returns:

Type Description
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:

Name Type Description Default
force_refresh bool

Re-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:

Name Type Description Default
topic str

The task topic.

required
force_refresh bool

Re-fetch the catalogue even if the cache is still valid.

False

Returns:

Type Description
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:

Name Type Description Default
topic str

The task topic.

required
name str

The task name as advertised by the platform (e.g. kriging).

required
force_refresh bool

Re-fetch the catalogue even if the cache is still valid.

False

Returns:

Type Description
TaskResource | None

The matching task, or None.