Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make "/butler" URL prefix variable in client
Browse files Browse the repository at this point in the history
For phalanx deployments, all butler servers will have the same hostname but live under different paths.
dhirving committed Nov 3, 2023
1 parent 4e3b9b2 commit c089ce9
Showing 2 changed files with 7 additions and 8 deletions.
14 changes: 6 additions & 8 deletions python/lsst/daf/butler/remote_butler/_remote_butler.py
Original file line number Diff line number Diff line change
@@ -77,9 +77,9 @@ def __init__(
butler_config = ButlerConfig(config, searchPaths, without_datastore=True)
# There is a convention in Butler config files where <butlerRoot> in a
# configuration option refers to the directory containing the
# configuration file. We allow this for the remote butler's URL so
# configuration file. We allow this for the remote butler's URL so
# that the server doesn't have to know which hostname it is being
# accessed from
# accessed from.
server_url_key = ("remote_butler", "url")
if server_url_key in butler_config:
butler_config[server_url_key] = replaceRoot(
@@ -441,20 +441,18 @@ def pruneDatasets(
raise NotImplementedError()

def _get_url(self, path: str, version: str = "v1") -> str:
"""Form the complete path to an endpoint on the server
"""Form the complete path to an endpoint on the server.
Parameters
----------
path : `str`
The relative path to the server endpoint. Should not include the
"/butler" prefix.
The relative path to the server endpoint.
version : `str`, optional
Version string to prepend to path. Defaults to "v1".
Returns
-------
path : `str`
The full path to the endpoint
The full path to the endpoint.
"""
prefix = "butler"
return f"{prefix}/{version}/{path}"
return f"{version}/{path}"
1 change: 1 addition & 0 deletions tests/test_server.py
Original file line number Diff line number Diff line change
@@ -85,6 +85,7 @@ def create_factory_dependency():

# Set up the RemoteButler that will connect to the server
cls.client = TestClient(app)
cls.client.base_url = "http://text.example/butler/"
cls.butler = _make_remote_butler(cls.client)

# Populate the test server.

0 comments on commit c089ce9

Please sign in to comment.