Skip to content

Commit

Permalink
Reorganize loops to more properly use new Quantum Graph
Browse files Browse the repository at this point in the history
  • Loading branch information
timj committed Oct 19, 2020
1 parent 9db35ce commit 6e10747
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions bin.src/exportGraphInputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,24 +49,22 @@
with butler.export(directory=args.output, format="yaml", transfer="auto") as export:
items = []
for quantum_node in graph:
for key, value in quantum_node.quantum.inputs.items():
for dataset in value:
if dataset.datasetType.name not in dataset_types_to_exclude:
# The quantum graph doesn't know the ID of the
# real dataset so convert to a real ref
found = set(butler.registry.queryDatasets(dataset.datasetType.name,
collections=...,
dataId=dataset.dataId))
for datasetType, refs in quantum_node.quantum.inputs.items():
if datasetType.name not in dataset_types_to_exclude:
# The quantum graph doesn't know the ID of the
# real dataset so convert to a real ref
for ref in refs:
found = set(butler.registry.queryDatasets(datasetType, collections=...,
dataId=ref.dataId))
items.extend(found)
export.saveDatasets(items)
export.saveCollection("HSC/calib")

# This is solely to export the raw files. We do not need the yaml
with butler.export(directory=args.output, filename="junk.yaml", format="yaml", transfer="auto") as export:
items = []
for quantum_node in graph:
for key, value in quantum_node.quantum.inputs.items():
for dataset in value:
if dataset.datasetType.name in ("raw",):
items.append(dataset)
for quantum in graph.findQuantaWithDSType("raw"):
# Verify that raw is an input and not an output
if "raw" in quantum.inputs:
items.extend(quantum.inputs["raw"])
export.saveDatasets(items)

0 comments on commit 6e10747

Please sign in to comment.