DiscoveryClient#

class rubin.repertoire.DiscoveryClient(http_client=None, *, base_url=None)#

Bases: object

Client for Phalanx service and dataset discovery.

Services that want to discover Phalanx services and datasets and that are not using the IVOA discovery protocols should use this client. Software running on a Science Pipelines stack container should instead use the client provided by lsst.rsp.

Discovery information is cached inside this client where appropriate. Callers should call the methods on this object each time discovery information is needed and not cache the results locally.

Normally, the environment variable REPERTOIRE_BASE_URL should be set by the Phalanx chart for the application and will be used to locate the base URL of the Repertoire discovery service in the local Phalanx environment.

Parameters:
  • http_client (AsyncClient | None, default: None) – Existing httpx.AsyncClient to use instead of creating a new one. This allows the caller to reuse an existing client and connection pool.

  • base_url (str | None, default: None) – Base URL of Repertoire, overriding the REPERTOIRE_BASE_URL environment variable. If this parameter is not provided and REPERTOIRE_BASE_URL is not set in the environment, RepertoireUrlError will be raised.

Methods Summary

applications()

List applications installed in the local Phalanx environment.

butler_config_for(dataset)

Return the Butler configuration URL for a given dataset.

butler_repositories()

Return the Butler repository mapping for the local environment.

datasets()

List datasets available in the local Phalanx environment.

get_influxdb_connection_info(database, token)

Get connection information for an InfluxDB database.

influxdb_databases()

List InfluxDB databases available in the local Phalanx environment.

url_for_data_service(service, dataset)

Return the base API URL for a given data service.

url_for_internal_service(service)

Return the base API URL for a given internal service.

url_for_ui_service(service)

Return the base URL for a given UI service.

Methods Documentation

async applications()#

List applications installed in the local Phalanx environment.

Returns:

Phalanx application names expected to be deployed in the local environment. This is based on Phalanx configuration as injected into the Repertoire service, not based on what is currently deployed, so some applications may be missing if the environment is out of sync with the configuration.

Return type:

list of str

Raises:

RepertoireError – Raised on error fetching discovery information from Repertoire.

async butler_config_for(dataset)#

Return the Butler configuration URL for a given dataset.

Parameters:

dataset (str) – Short name of a dataset, chosen from the results of datasets.

Returns:

URL to the Butler configuration, or None if that dataset is not recognized or does not have a Butler configuration.

Return type:

str or None

Raises:

RepertoireError – Raised on error fetching discovery information from Repertoire.

async butler_repositories()#

Return the Butler repository mapping for the local environment.

Returns:

Mapping of dataset labels to Butler configuration URLs. This result is suitable for use as the constructor argument to lsst.daf.butler.LabeledButlerFactory.

Return type:

dict of str

Raises:

RepertoireError – Raised on error fetching discovery information from Repertoire.

async datasets()#

List datasets available in the local Phalanx environment.

Returns:

Short identifiers (dp1, for example) of the datasets expected to be available in the local Phalanx environment. These are the valid dataset arguments to butler_config_for and url_for_data_service.

Return type:

list of str

Raises:

RepertoireError – Raised on error fetching discovery information from Repertoire.

async get_influxdb_connection_info(database, token)#

Get connection information for an InfluxDB database.

Parameters:
  • database (str) – Short name of the InfluxDB database. Call influxdb_databases to get the valid values.

  • token (str) – Gafaelfawr token to use for authentication. Database information may only be available to users with specific scopes.

Returns:

Connection information for an InfluxDB database, including credentials, or None if this database was not found in this environment.

Return type:

InfluxDatabaseWithCredentials or None

Raises:

RepertoireError – Raised on error fetching discovery information from Repertoire.

async influxdb_databases()#

List InfluxDB databases available in the local Phalanx environment.

These may or may not be locally hosted, but the credentials and connection information is available to authenticated users.

Returns:

Short identifiers (summit_efd, for example) of the available InfluxDB databases. This string should be passed as the database argument to get_influxdb_connection_info.

Return type:

list of str

Raises:

RepertoireError – Raised on error fetching discovery information from Repertoire.

async url_for_data_service(service, dataset)#

Return the base API URL for a given data service.

Parameters:
  • service (str) – Name of the service.

  • dataset (str) – Dataset that will be queried via the API, chosen from the results of datasets.

Returns:

Base URL of the API, or None if the service or dataset is not available in this environment.

Return type:

str or None

Raises:

RepertoireError – Raised on error fetching discovery information from Repertoire.

async url_for_internal_service(service)#

Return the base API URL for a given internal service.

Parameters:

service (str) – Name of the service.

Returns:

Base URL of the API, or None if the service is not available in this environment.

Return type:

str or None

Raises:

RepertoireError – Raised on error fetching discovery information from Repertoire.

async url_for_ui_service(service)#

Return the base URL for a given UI service.

Parameters:

service (str) – Name of the service.

Returns:

Base URL of the service, or None if the service is not available in this environment.

Return type:

str or None

Raises:

RepertoireError – Raised on error fetching discovery information from Repertoire.