Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-24851: Update to use the new Butler.getURIs API #52

Merged
merged 2 commits into from
May 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
_build.*
.sconsign.dblite
config.log
.sconf_temp
Expand Down
22 changes: 11 additions & 11 deletions python/lsst/ctrl/mpexec/cmdLineFwk.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
Butler,
CollectionSearch,
CollectionType,
DatasetRef,
DatasetTypeRestriction,
Registry,
)
Expand Down Expand Up @@ -875,6 +874,15 @@ def _showWorkflow(self, graph, args):
args : `argparse.Namespace`
Parsed command line
"""
def dumpURIs(thisRef):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did check to see if missed updating test to match new output format, but showWorkflow doesn't have a unit test for technical reasons.

primary, components = butler.getURIs(thisRef, predict=True, run="TBD")
if primary:
print(f" {primary}")
else:
print(f" (disassembled artifact)")
for compName, compUri in components.items():
print(f" {compName}: {compUri}")

butler = _ButlerFactory.makeReadButler(args)
hashToParent = {}
for iq, (taskDef, quantum) in enumerate(graph.quanta()):
Expand All @@ -883,19 +891,11 @@ def _showWorkflow(self, graph, args):
print(" inputs:")
for key, refs in quantum.predictedInputs.items():
for ref in refs:
if butler.datastore.exists(ref):
print(" {}".format(butler.datastore.getUri(ref)))
else:
fakeRef = DatasetRef(ref.datasetType, ref.dataId)
print(" {}".format(butler.datastore.getUri(fakeRef, predict=True)))
dumpURIs(ref)
print(" outputs:")
for key, refs in quantum.outputs.items():
for ref in refs:
if butler.datastore.exists(ref):
print(" {}".format(butler.datastore.getUri(ref)))
else:
fakeRef = DatasetRef(ref.datasetType, ref.dataId)
print(" {}".format(butler.datastore.getUri(fakeRef, predict=True)))
dumpURIs(ref)
# Store hash to figure out dependency
dhash = hash((key, ref.dataId))
hashToParent[dhash] = iq
Expand Down