uniqc.backend_registry module#

Backend registry: fetches, normalises, and caches platform backends.

This module is the central orchestrator for the uniqc backend command. It: 1. Calls each platform’s list_backends() adapter method (or cache). 2. Normalises the raw platform data into BackendInfo objects. 3. Persists the normalised list to the disk cache. 4. Provides query helpers (get_backend_info, find_backend).

uniqc.backend_registry.fetch_all_backends(force_refresh=False)[source]#

Fetch backends from all configured platforms.

Parameters:

force_refresh (bool) – Bypass the cache TTL for all platforms.

Returns:

Dict mapping Platform to its list of BackendInfo objects. Platforms that fail are omitted with a warning.

Return type:

dict[Platform, list[BackendInfo]]

uniqc.backend_registry.fetch_platform_backends(platform, force_refresh=False)[source]#

Fetch and normalise backends for one platform.

Parameters:
  • platform (Platform) – The platform to fetch backends for.

  • force_refresh (bool) – If True, bypass the cache TTL check.

Returns:

A tuple of (backends, fetched_newly) where fetched_newly is True if the data was fetched from the network (vs. served from cache).

Return type:

tuple[list[BackendInfo], bool]

uniqc.backend_registry.find_backend(identifier)[source]#

Find a backend by its identifier.

Supports two forms:
  • platform:name (e.g. originq:HanYuan_01)

  • bare name (searches all platforms)

Parameters:

identifier (str) – Backend identifier.

Returns:

The matching BackendInfo object.

Raises:

ValueError – If the backend is not found or the identifier format is invalid.

Return type:

BackendInfo