Details
-
Type:
Bug
-
Status: To Do
-
Resolution: Unresolved
-
Fix Version/s: None
-
Component/s: daf_butler
-
Labels:None
-
Team:Data Release Production
-
Urgent?:No
Description
Calling lsst.daf.butler.Registry.queryCollections with the name of a collection that is not present raises MissingCollectionError. From the documentation, I expect it to return an iterator over an empty iterable instead.
Minimal example:
from lsst.daf.butler import Butler
|
butler = Butler(Butler.makeRepo("foo"))
|
list(butler.registry.queryCollections("collected"))
|
The same behavior occurs when passing ["collected"]. Passing re.compile("collected") returns an empty iterator, as expected. I have not tested a tuple or a mapping, since I'm not sure how to construct a valid example.
Attachments
Issue Links
- relates to
-
DM-21915 Support Gen 3 ingestion of ap_verify datasets
- Done
Seeing the exact call makes it clear what's going on, and I suppose my answer about whether this is expected behavior would change. But it's still worth discussing whether it's desirable behavior - I agree that an empty iterator for this input is more intuitive. But in most similar interfaces where collection expressions can be passed (generally in searches for datasets across multiple collections), I think getting this exception is clearly more desirable than an empty iterator of datasets (and that's why the code does raise; it's the same logic under the hood). Is consistency between those interfaces enough to make it a good idea to keep the raise?