Skip to content

Commit

Permalink
Move butler constructor inside if statement
Browse files Browse the repository at this point in the history
The created butler is only used if purge_run is True.
  • Loading branch information
timj committed Jan 17, 2024
1 parent 9e43e25 commit 93db817
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions python/lsst/daf/butler/script/_pruneDatasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,9 @@ def pruneDatasets(
if not collections:
return PruneDatasetsResult(state=PruneDatasetsResult.State.ERR_NO_COLLECTION_RESTRICTION)

butler = Butler.from_config(repo)

# If purging, verify that the collection to purge is RUN type collection.
if purge_run:
butler = Butler.from_config(repo, without_datastore=True)
collectionType = butler.registry.getCollectionType(purge_run)
if collectionType is not CollectionType.RUN:
return PruneDatasetsResult(
Expand Down

0 comments on commit 93db817

Please sign in to comment.