Hi Tim,
Thank you for your answer and for proposing a solution. I have been using the commented command to access the DatasetTypes, etc., as you suggested.
However, I am still encountering the same error message:
TypeError: 'Sentinel' object is not iterable
Initially, this happened when running
butler query-* commands
Now it also appears when executing processing-related commands, for example:
!butler register-instrument ./local_butler lsst.obs.lsst.LsstComCam
I am also seeing similar failures when running pipeline tasks such as:
• makeDirectWarp
• assembleDeepCoadd
For reference, here is the routine I am using to register instruments from a remote repository:
def instrument_register_from_remote(
local_repo: str,
remote_repo: str,
instruments: set[str],
remote_collection: str = "LSSTComCam/DP1",
logger: logging.Logger = None,
) -> bool:
"""
Register instruments in the local Butler repo using definitions
retrieved from a remote repo.
Parameters
----------
instruments: set of instrument names (strings)
remote_collection: collection to open the remote Butler with
"""
if not instruments: raise RuntimeError("No instrument names provided.")
if logger: logger.info(f"Detected instruments to register: {sorted(instruments)}")
if logger: logger.info(f"Opening remote Butler: {remote_repo} (collections={remote_collection})")
remote = Butler(remote_repo, collections=remote_collection)
# Get instrument records from remote registry
remote_inst_records = [
rec for rec in remote.registry.queryDimensionRecords("instrument")
if rec.name in instruments
]
found_names = {rec.name for rec in remote_inst_records}
missing = instruments - found_names
if missing and logger:
logger.warning(f"Some instruments not found in remote registry: {sorted(missing)}")
# still continue with those found; you can choose to raise instead
# Full instrument class names (e.g., lsst.obs.lsst.LsstCam)
instrument_full = [rec.class_name for rec in remote_inst_records]
if logger:
logger.debug(f"Instrument classes from remote: {instrument_full}")
# Local registry
local_registry = Butler(local_repo).registry
local_instrument_names = {rec.name for rec in local_registry.queryDimensionRecords("instrument")}
for rec, class_name in zip(remote_inst_records, instrument_full):
if rec.name in local_instrument_names:
if logger:
logger.info(f"Instrument '{rec.name}' already registered locally — skipping.")
continue
cmd = ["butler", "register-instrument", local_repo, class_name]
_run(cmd, logger=logger)
if logger:
logger.info(f"Registered instrument '{rec.name}' -> {class_name}")
return True
This workflow was working perfectly last week. The error only started appearing after the most recent platform update.
I am wondering whether this is:
1. Related to the problem you mentioned, or
2. Related to the intermittent catalog query issues previously mentioned on https://data.lsst.cloud/.
Would you recommend waiting for the next platform update, or is there a known workaround for this version?
Thanks again for your help.