From d7c65afaf670414a6fafefe0e28cd6f9f49cfa2b Mon Sep 17 00:00:00 2001 From: "David H. Irving" Date: Mon, 14 Oct 2024 10:00:37 -0700 Subject: [PATCH 1/2] Fix use of deprecated Butler.collections property --- python/lsst/ctrl/mpexec/separablePipelineExecutor.py | 8 +++++--- python/lsst/ctrl/mpexec/simple_pipeline_executor.py | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/python/lsst/ctrl/mpexec/separablePipelineExecutor.py b/python/lsst/ctrl/mpexec/separablePipelineExecutor.py index 6e2950e4..033ae5ff 100644 --- a/python/lsst/ctrl/mpexec/separablePipelineExecutor.py +++ b/python/lsst/ctrl/mpexec/separablePipelineExecutor.py @@ -102,8 +102,10 @@ def __init__( resources: lsst.pipe.base.ExecutionResources | None = None, raise_on_partial_outputs: bool = True, ): - self._butler = Butler.from_config(butler=butler, collections=butler.collections, run=butler.run) - if not self._butler.collections: + self._butler = Butler.from_config( + butler=butler, collections=butler.collections.defaults, run=butler.run + ) + if not self._butler.collections.defaults: raise ValueError("Butler must specify input collections for pipeline.") if not self._butler.run: raise ValueError("Butler must specify output run for pipeline.") @@ -215,7 +217,7 @@ class are provided automatically (from explicit arguments to this needed, clients can use `len` to test if the returned graph is empty. """ metadata = { - "input": self._butler.collections, + "input": self._butler.collections.defaults, "output_run": self._butler.run, "skip_existing_in": self._skip_existing_in, "skip_existing": bool(self._skip_existing_in), diff --git a/python/lsst/ctrl/mpexec/simple_pipeline_executor.py b/python/lsst/ctrl/mpexec/simple_pipeline_executor.py index d95c7cd2..8dd8d3ba 100644 --- a/python/lsst/ctrl/mpexec/simple_pipeline_executor.py +++ b/python/lsst/ctrl/mpexec/simple_pipeline_executor.py @@ -339,8 +339,8 @@ def from_pipeline_graph( ``where`` expression, keyed by the identifiers they replace. butler : `~lsst.daf.butler.Butler` Butler that manages all I/O. `prep_butler` can be used to create - one. Must have its `~Butler.run` and `~Butler.collections` not - empty and not `None`. + one. Must have its `~Butler.run` and + `~Butler.collections.defaults` not empty and not `None`. resources : `~lsst.pipe.base.ExecutionResources` The resources available to each quantum being executed. raise_on_partial_outputs : `bool`, optional From 692bbc29bebd512d5143ffce8b99b402c8664cac Mon Sep 17 00:00:00 2001 From: "David H. Irving" Date: Mon, 14 Oct 2024 10:08:02 -0700 Subject: [PATCH 2/2] Replace deprecated regex search with glob --- python/lsst/ctrl/mpexec/cli/script/cleanup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/lsst/ctrl/mpexec/cli/script/cleanup.py b/python/lsst/ctrl/mpexec/cli/script/cleanup.py index 15601218..d84169f4 100644 --- a/python/lsst/ctrl/mpexec/cli/script/cleanup.py +++ b/python/lsst/ctrl/mpexec/cli/script/cleanup.py @@ -26,7 +26,6 @@ # along with this program. If not, see . -import re from typing import Any from lsst.daf.butler import Butler, CollectionType @@ -141,8 +140,9 @@ def cleanup( collection, butler.registry.getCollectionType(collection).name ) return result - regex = re.compile(collection + ".+") - to_consider = set(butler.registry.queryCollections(regex)) + to_keep.add(collection) + glob = collection + "*" + to_consider = set(butler.registry.queryCollections(glob)) to_remove = to_consider - to_keep for r in to_remove: if butler.registry.getCollectionType(r) == CollectionType.RUN: