diff --git a/src/lsst/cmservice/common/butler.py b/src/lsst/cmservice/common/butler.py index 953f656f..73ed24fb 100644 --- a/src/lsst/cmservice/common/butler.py +++ b/src/lsst/cmservice/common/butler.py @@ -1,7 +1,7 @@ """Utility functions for working with butler commands""" from lsst.cmservice.common import errors -from lsst.daf.butler import Butler +from lsst.daf.butler import Butler, MissingCollectionError def remove_run_collections( @@ -31,6 +31,8 @@ def remove_run_collections( raise errors.CMNoButlerError(e) from e # pragma: no cover try: # pragma: no cover butler.registry.removeCollection(collection_name) + except MissingCollectionError: + pass except Exception as msg: raise errors.CMButlerCallError(msg) from msg diff --git a/src/lsst/cmservice/handlers/script_handler.py b/src/lsst/cmservice/handlers/script_handler.py index 8fe9ec95..55a23878 100644 --- a/src/lsst/cmservice/handlers/script_handler.py +++ b/src/lsst/cmservice/handlers/script_handler.py @@ -593,7 +593,7 @@ async def _reset_script( if script.stamp_url and os.path.exists(script.stamp_url): os.unlink(script.stamp_url) if to_status.value <= StatusEnum.ready.value: - if script.script_url: + if script.script_url and os.path.exists(script.script_url): os.unlink(script.script_url) update_fields["script_url"] = None update_fields["log_url"] = None