From b9493287ea1cca618c025dba7fd41f74851ee7d3 Mon Sep 17 00:00:00 2001 From: Tim Jenness Date: Thu, 8 Jan 2026 17:07:00 -0700 Subject: [PATCH 1/2] Use the new eups: URI scheme instead of getPackageDir --- python/lsst/ctrl/execute/findPackageFile.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/python/lsst/ctrl/execute/findPackageFile.py b/python/lsst/ctrl/execute/findPackageFile.py index d414211..8cac566 100644 --- a/python/lsst/ctrl/execute/findPackageFile.py +++ b/python/lsst/ctrl/execute/findPackageFile.py @@ -28,7 +28,6 @@ import os import sys -import lsst.utils from lsst.resources import ResourcePath @@ -77,21 +76,17 @@ def find_package_file(filename: str, kind: str = "config", platform: str | None home_dir = os.getenv("HOME", "~") xdg_config_home = os.getenv("XDG_CONFIG_HOME", "~/.config") - try: - platform_pkg_dir = lsst.utils.getPackageDir(f"ctrl_platform_{platform}") - except (LookupError, ValueError): - platform_pkg_dir = None file_candidates = [ ResourcePath(home_dir).join(".lsst").join(_filename), ResourcePath(xdg_config_home).join("lsst").join(_filename), - (ResourcePath(platform_pkg_dir).join("etc").join(kind).join(_filename) if platform_pkg_dir else None), ResourcePath(sys.exec_prefix).join("etc").join(kind).join(_filename), ( ResourcePath(f"resource://lsst.ctrl.platform.{platform}/etc/{kind}/{_filename}") if platform else None ), + (ResourcePath(f"eups://ctrl_platform_{platform}/{kind}/{_filename}") if platform else None), ResourcePath(f"resource://lsst.ctrl.execute/etc/{kind}/{_filename}"), ] try: From 2cacc4fc696fed7ef38767ed0f2d2e4d3a25fdda Mon Sep 17 00:00:00 2001 From: Tim Jenness Date: Fri, 9 Jan 2026 12:57:39 -0700 Subject: [PATCH 2/2] Simplify config loading now that configs can load ResourcePath --- python/lsst/ctrl/execute/allocator.py | 4 ++-- python/lsst/ctrl/execute/condorInfoConfig.py | 2 +- python/lsst/ctrl/execute/libexec/allocateNodes.py | 2 +- python/lsst/ctrl/execute/qCommand.py | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/python/lsst/ctrl/execute/allocator.py b/python/lsst/ctrl/execute/allocator.py index 4f457c7..f0a17ea 100644 --- a/python/lsst/ctrl/execute/allocator.py +++ b/python/lsst/ctrl/execute/allocator.py @@ -76,7 +76,7 @@ def __init__( self.configuration = configuration condorInfoConfig = CondorInfoConfig() - condorInfoConfig.loadFromStream(ResourcePath(condorInfoFileName).read()) + condorInfoConfig.load(condorInfoFileName) self.platform = platform @@ -164,7 +164,7 @@ def loadAllocationConfig(self, name: ResourcePathExpression, suffix): if not (name_ := ResourcePath(name)).exists(): raise RuntimeError(f"{name_} was not found.") allocationConfig = AllocationConfig() - allocationConfig.loadFromStream(name_.read()) + allocationConfig.load(name_) self.defaults["QUEUE"] = allocationConfig.platform.queue self.defaults["EMAIL_NOTIFICATION"] = allocationConfig.platform.email diff --git a/python/lsst/ctrl/execute/condorInfoConfig.py b/python/lsst/ctrl/execute/condorInfoConfig.py index 203801c..de747a9 100644 --- a/python/lsst/ctrl/execute/condorInfoConfig.py +++ b/python/lsst/ctrl/execute/condorInfoConfig.py @@ -62,7 +62,7 @@ class CondorInfoConfig(pexConfig.Config): if __name__ == "__main__": config = CondorInfoConfig() filename = find_package_file("condor-info.py") - config.loadFromStream(filename.read()) + config.load(filename) for i in config.platform: print(i) diff --git a/python/lsst/ctrl/execute/libexec/allocateNodes.py b/python/lsst/ctrl/execute/libexec/allocateNodes.py index b2d8a20..1eb2dcb 100755 --- a/python/lsst/ctrl/execute/libexec/allocateNodes.py +++ b/python/lsst/ctrl/execute/libexec/allocateNodes.py @@ -71,7 +71,7 @@ def main(): # load the CondorConfig file execConfigName = find_package_file("execConfig.py", platform=platform) configuration = CondorConfig() - configuration.loadFromStream(execConfigName.read()) + configuration.load(execConfigName) # create the plugin class schedulerName = configuration.platform.scheduler diff --git a/python/lsst/ctrl/execute/qCommand.py b/python/lsst/ctrl/execute/qCommand.py index 1257d7c..5064fce 100644 --- a/python/lsst/ctrl/execute/qCommand.py +++ b/python/lsst/ctrl/execute/qCommand.py @@ -46,12 +46,12 @@ def __init__(self, platform: str): configFileName = find_package_file("condor-info.py") condorInfoConfig = CondorInfoConfig() - condorInfoConfig.loadFromStream(configFileName.read()) + condorInfoConfig.load(configFileName) configName = find_package_file("pbsConfig.py", platform=platform) allocationConfig = AllocationConfig() - allocationConfig.loadFromStream(configName.read()) + allocationConfig.load(configName) self.userName = condorInfoConfig.platform[platform].user.name