Skip to content

Commit

Permalink
replace dataid.full with dataid.mapping. register datasettype once in…
Browse files Browse the repository at this point in the history
…stead of loop
  • Loading branch information
jsv1206 committed Jan 16, 2024
1 parent d2c3565 commit 4710dd6
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2,916 deletions.
13 changes: 7 additions & 6 deletions src/move_embargo_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def parse_args():
).expanded()

if namespace.log == "True":
ids_to_move = [dt.dataId.full["exposure"] for dt in datasetRefs_exposure]
ids_to_move = [dt.dataId.mapping["exposure"] for dt in datasetRefs_exposure]
logger.info("exposure ids to move: %s", ids_to_move)

# raw dtype requires special handling for the transfer,
Expand Down Expand Up @@ -214,10 +214,11 @@ def parse_args():
lsst.daf.butler.FileDataset(new_dest_uri, key)
)

for i, ref in enumerate(datasetRefs_exposure):
# dest_butler.registry.registerDatasetType(datasetRefs[0].datasetType)
dest_butler.registry.registerDatasetType(ref.datasetType)
dest_butler.registry.registerRun(ref.run)
# register datasettype and collection run only once
dest_butler.registry.registerDatasetType(
list(datasetRefs_exposure)[0].datasetType
)
dest_butler.registry.registerRun(list(datasetRefs_exposure)[0].run)

# ingest to the destination butler
dest_butler.transfer_dimension_records_from(
Expand All @@ -235,7 +236,7 @@ def parse_args():
)
if namespace.log == "True":
ids_moved = [
dt.dataId.full["exposure"]
dt.dataId.mapping["exposure"]
for dt in dest_registry.queryDatasets(
datasetType=datalist_exposure, collections=collections_exposure
)
Expand Down
Loading

0 comments on commit 4710dd6

Please sign in to comment.