diff --git a/python/lsst/summit/utils/butlerUtils.py b/python/lsst/summit/utils/butlerUtils.py index 75b0e4a2..aee2a510 100644 --- a/python/lsst/summit/utils/butlerUtils.py +++ b/python/lsst/summit/utils/butlerUtils.py @@ -173,7 +173,8 @@ def makeDefaultButler( Raises ------ FileNotFoundError - Raised if the butler cannot be created. + Raised if the butler cannot be created, because this is the error + when the DAF_BUTLER_REPOSITORY_INDEX is not set correctly. """ SUPPORTED_SITES = [ "summit", @@ -186,7 +187,12 @@ def makeDefaultButler( site = getSite() if site not in SUPPORTED_SITES: - raise ValueError(f"Default butler creation only supported at sites: {SUPPORTED_SITES}, got {site=}") + # This might look like a slightly weird error to raise, but this is + # the same error that's raised when the DAF_BUTLER_REPOSITORY_INDEX + # isn't set, so it's the most appropriate error to raise here, i.e. + # this is what would be raised if this function was allowed to continue + # only this is a less confusing version of it. + raise FileNotFoundError(f"Default butler creation only available at: {SUPPORTED_SITES}, got {site=}") summitLike = site in ["summit", "tucson", "base"] if summitLike: diff --git a/python/lsst/summit/utils/efdUtils.py b/python/lsst/summit/utils/efdUtils.py index 9569352a..d6d3512c 100644 --- a/python/lsst/summit/utils/efdUtils.py +++ b/python/lsst/summit/utils/efdUtils.py @@ -453,10 +453,9 @@ def makeEfdClient(testing: bool | None = False) -> EfdClient: if testing: return EfdClient("usdf_efd") - try: - site = getSite() - except ValueError as e: - raise RuntimeError("Could not create EFD client as the site could not be determined") from e + site = getSite() + if site == "UNKNOWN": + raise RuntimeError("Could not create EFD client as the site could not be determined") if site == "summit": return EfdClient("summit_efd") diff --git a/python/lsst/summit/utils/utils.py b/python/lsst/summit/utils/utils.py index 5adf47cc..4e2b9659 100644 --- a/python/lsst/summit/utils/utils.py +++ b/python/lsst/summit/utils/utils.py @@ -600,11 +600,8 @@ def getSite() -> str: One of: ['tucson', 'summit', 'base', 'staff-rsp', 'rubin-devl', 'jenkins', 'usdf-k8s'] + If the location cannot be determined "UNKOWN" is returned. - Raises - ------ - ValueError - Raised if location cannot be determined. """ # All nublado instances guarantee that EXTERNAL_URL is set and uniquely # identifies it. @@ -647,7 +644,7 @@ def getSite() -> str: return "usdf-k8s" # we have failed - raise ValueError("Location could not be determined") + return "UNKOWN" def getAltAzFromSkyPosition(