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
) – Existinghttpx.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 theREPERTOIRE_BASE_URL
environment variable. If this parameter is not provided andREPERTOIRE_BASE_URL
is not set in the environment,RepertoireUrlError
will be raised.
Methods Summary
List applications installed in the local Phalanx environment.
butler_config_for
(dataset)Return the Butler configuration URL for a given dataset.
Return the Butler repository mapping for the local environment.
datasets
()List datasets 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:
- 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 ofdatasets
.- 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:
- 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 tobutler_config_for
andurl_for_data_service
.- Return type:
- 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:
- 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.