Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-46599: Stop using deprecated Butler methods #311

Merged
merged 2 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions python/lsst/ctrl/mpexec/cli/script/cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.


import re
from typing import Any

from lsst.daf.butler import Butler, CollectionType
Expand Down Expand Up @@ -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:
Expand Down
8 changes: 5 additions & 3 deletions python/lsst/ctrl/mpexec/separablePipelineExecutor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down Expand Up @@ -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),
Expand Down
4 changes: 2 additions & 2 deletions python/lsst/ctrl/mpexec/simple_pipeline_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading