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

Fix startup error when databroker is not present on HXN/CSX machines #86

Merged
merged 3 commits into from
Feb 24, 2020

Conversation

leofang
Copy link
Collaborator

@leofang leofang commented Feb 14, 2020

Close #73. See #73 (comment) for a reproducer.

@leofang leofang added this to the v1.4.0 milestone Feb 14, 2020
Copy link
Member

@mrakitin mrakitin left a comment

Choose a reason for hiding this comment

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

Looks good. Suggested to correct the exception message a bit.

try:
import nsls2ptycho.core.HXN_databroker as hxn_databroker
except ImportError:
raise RuntimeError("[WARNING] Databroker is not found and so disabled.")
Copy link
Member

Choose a reason for hiding this comment

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

I think it should have a type of "Error" as it's rising. Same below.

Suggested change
raise RuntimeError("[WARNING] Databroker is not found and so disabled.")
raise RuntimeError("[Error] Databroker is not found and so disabled.")

Copy link
Collaborator Author

@leofang leofang Feb 14, 2020

Choose a reason for hiding this comment

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

Thanks Maksim! It's better be a warning I think, because this "error" is immediately caught by the outer try-except and simply printed (at the start time of GUI):

except RuntimeError as ex:
print(ex, file=sys.stderr)

Databroker is not a hard dependency after all.

@leofang
Copy link
Collaborator Author

leofang commented Feb 24, 2020

The fix is simplified: We just need to catch ImportError. Merging at will.

@leofang leofang merged commit d044fef into NSLS-II:master Feb 24, 2020
@leofang leofang deleted the fix_databroker branch February 24, 2020 17:10
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.

Avoid crash when databroker is not present
2 participants