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
insert reading of default optimade_config.json in example run script run.sh #627
insert reading of default optimade_config.json in example run script run.sh #627
Conversation
Codecov Report
@@ Coverage Diff @@
## master #627 +/- ##
=======================================
Coverage 93.27% 93.27%
=======================================
Files 60 60
Lines 3256 3256
=======================================
Hits 3037 3037
Misses 219 219
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this @rartino! I just have a minor tweak to only use the demo value if the env var hasn't been set so that run.sh
can still be used generally.
Please let us know if you run into any other problems!
Co-authored-by: Matthew Evans <7916000+ml-evs@users.noreply.github.com>
It may be an idea to document somewhere, perhaps in a comment in run.sh and/or in a comment in (On the other hand, the most crucial config setting to override is the one that points to the config file to read, which is now at least explicitly demonstrated in |
We have this section in our documentation (https://www.optimade.org/optimade-python-tools/configuration/#environment-variables) but perhaps it would be nice to link to it in the script itself, I agree the distinction between uvicorn flags/OPTIMADE options is a bit confusing. A docs overhaul is bubbling up to the top of my priorities for this package... |
Yeah, an overhaul/update and some PR for it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, this. Thanks @rartino !
Ah, thanks, I had indeed missed this. In fact, I had missed that there was a pre-rendered version of the full docs at https://www.optimade.org/optimade-python-tools/, (but I see I could have picked up the configuration info from reading `docs/configuration.md".) Perhaps in the overhaul of the docs once could consider a slightly more prominent link to https://www.optimade.org/optimade-python-tools/ in the README.md to help direct those who glances over it, e.g. as:
(But I see how this link gets a bit weird if you want the first page of the website to be rendered from the README.md, hmm...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again @rartino, this is really helpful.
I just added a link to the config docs in the fallback print out so hopefully that is clearer too.
This tiny fix resolves a stumbling block for new users trying out optimade-python-tools.
Without this fix, someone downloading optimade-python-tools and executing
./run.sh
to try it out gets a server that otherwise works, but reports a 501 internal server error upon accessing the/structures
endpoint without a a clear error description pointing the user what to do. Enabling debug mode explains that the error is a pydantic validation error due to missing chemical formula fields.The issue is that the test data in
optimade/server/data/test_structures.json
absolutely needs the aliases mapping set up in the config file distributed with optimade-python-tools in/optimade_config.json
. Hence, it is not possible to start a demo server without also reading that config file.While one could consider other solutions (e.g., changing the default config hardcoded inside the python files), I think it is the expected behavior that the default example run script uses the included example config file, so that edits in that file are reflected by the running server.