Skip to content

Commit 460da8c

Browse files
committed
Make raw deletion more thorough.
1 parent 6020eb6 commit 460da8c

File tree

3 files changed

+13
-18
lines changed

3 files changed

+13
-18
lines changed

python/activator/activator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -878,7 +878,7 @@ def process_visit(expected_visit: FannedOutVisit):
878878
_get_local_repo().name,
879879
_get_local_cache())
880880
# TODO: pipeline execution requires a clean run until DM-38041.
881-
cleanups.callback(mwi.clean_local_repo, expid_set)
881+
cleanups.callback(mwi.clean_local_repo)
882882
# Copy calibrations for this detector/visit
883883
mwi.prep_butler()
884884

python/activator/middleware_interface.py

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1720,28 +1720,23 @@ def _query_datasets_by_storage_class(self, butler, exposure_ids, collections, st
17201720
) for t in matching_types
17211721
)
17221722

1723-
def clean_local_repo(self, exposure_ids: set[int]) -> None:
1723+
def clean_local_repo(self) -> None:
17241724
"""Remove local repo content that is only needed for a single visit.
17251725
17261726
This includes raws and pipeline outputs.
1727-
1728-
Parameter
1729-
---------
1730-
exposure_ids : `set` [`int`]
1731-
Identifiers of the exposures to be removed.
17321727
"""
17331728
with lsst.utils.timer.time_this(_log, msg="clean_local_repo", level=logging.DEBUG):
17341729
self.butler.registry.refresh()
1735-
if exposure_ids:
1736-
raws = self.butler.query_datasets(
1737-
'raw',
1738-
collections=self.instrument.makeDefaultRawIngestRunName(),
1739-
where=f"exposure in ({', '.join(str(x) for x in exposure_ids)})",
1740-
explain=False, # Raws might not have been ingested.
1741-
instrument=self.visit.instrument,
1742-
detector=self.visit.detector,
1743-
)
1744-
self.butler.pruneDatasets(raws, disassociate=True, unstore=True, purge=True)
1730+
# Clean out raws
1731+
raws = self.butler.query_datasets(
1732+
'raw',
1733+
collections=self.instrument.makeDefaultRawIngestRunName(),
1734+
explain=False, # Raws might not have been ingested.
1735+
instrument=self.visit.instrument,
1736+
detector=self.visit.detector,
1737+
)
1738+
self.butler.pruneDatasets(raws, disassociate=True, unstore=True, purge=True)
1739+
17451740
# Outputs are all in their own runs, so just drop them.
17461741
preload_run = runs.get_preload_run(self.instrument, self._deployment, self._day_obs)
17471742
_remove_run_completely(self.butler, preload_run)

tests/test_middleware_interface.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ def test_clean_local_repo(self):
10191019
self._assert_in_collection(butler, "*", "bias", calib_data_id_2)
10201020
self._assert_in_collection(butler, "*", "bias", calib_data_id_3)
10211021

1022-
self.interface.clean_local_repo({raw_data_id["exposure"]})
1022+
self.interface.clean_local_repo()
10231023
self._assert_not_in_collection(butler, "*", "raw", raw_data_id)
10241024
self._assert_not_in_collection(butler, "*", "src", processed_data_id)
10251025
self._assert_not_in_collection(butler, "*", "calexp", processed_data_id)

0 commit comments

Comments
 (0)