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

Issue a warning when generated QuantumGraph is empty (DM-19372) #18

Merged
merged 2 commits into from Apr 19, 2019

Conversation

andy-slac
Copy link
Collaborator

No description provided.

# count quanta in graph and give a warning if it's empty
nQuanta = sum(1 for q in qgraph.quanta())
if nQuanta == 0:
warnings.warn("QuantumGraph is empty", stacklevel=2)
Copy link
Contributor

Choose a reason for hiding this comment

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

Works great. Does the output of warnings.warn also go through the logging module?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It can be (as you have found already) redirected to logging with logging.captureWarnings. We probably want to add this to pipetask as default settings, I think it's trivial change and can be done on this ticket too.

@andy-slac andy-slac merged commit 8163d2e into master Apr 19, 2019
@timj timj deleted the tickets/DM-19372 branch April 23, 2020 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants