Getting information about the Phalanx environment#
Most Repertoire clients should ask directly for the services, datasets, or InfluxDB databases that they want to use.
If the response is None, that service or dataset is not available, and the client can do something appropriate.
However, sometimes a client wants to know more general information about the local environment. For example, mobu uses the name of the environemnt in status reporting and needs the list of Phalanx applications to decide what notebooks to run. Those special-case applications can use the following APIs.
Do not use these APIs for service discovery. Their use should be rare; most clients should use other APIs.
General information about the environment#
To get general information about the local Phalanx environment, call DiscoveryClient.environment.
from rubin.repertoire import DiscoveryClient
discovery = DiscoveryClient()
environment = await discovery.environment()
print("Environment", environment.name)
The result will be an object with various information about the local Phalanx environment, or possibly None if no information is configured.
If not None, the object will have the following keys:
nameA human-readable name for the environment. The result may look like a hostname, since currently Phalanx environments are named that way. However, the caller must not use this as a hostname, use it to form URLs, or otherwise treat it as anything other than a short human-readable name.
titleA short human-readable title for the environment.
title_longA longer (but still brief) title for the environment.
labelThe Phalanx label for the environment. This is the same as the name used for the environment inside the Phalanx repository. Prefer
nameortitlein information presented to users (as opposed to environment administrators), since the label may not be meaningful to a user.descriptionAn extended description of the environment. This will generally be a paragraph with one or more sentences.
docs_urlURL to more documentation about this Phalanx environment.
Note
Earlier versions of the Repertoire client only provided DiscoveryClient.environment_name.
This method is still available, but it is deprecated and will be removed in a future release of Repertoire.
Prefer DiscoveryClient.environment and then use the name attribute of the resulting object.
Listing applications#
To get a list of all Phalanx applications enabled in the local environment, call DiscoveryClient.applications:
from rubin.repertoire import DiscoveryClient
discovery = DiscoveryClient()
applications = await discovery.applications()
The result is a list of Phalanx application names. These are the same names used in the Phalanx applications list, without the description or category.
Phalanx applications are not the same as service names. Many Phalanx applications do not register a service for service discovery, some register multiple services, and in some cases the service name is different from the application name. Only applications that know exactly what this data is for and need to use Phalanx application names specifically should use this method.
Next steps#
Query for service URLs: Finding services
Query for datasets: Listing datasets
Query for InfluxDB databases: Getting InfluxDB connection information