-
Notifications
You must be signed in to change notification settings - Fork 236
Properly handle multiple requests to threaded REST API #3974
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
Merged
sphuber
merged 2 commits into
aiidateam:develop
from
CasperWA:fix_3743_handle_threads_rest_api
May 11, 2020
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| """pytest fixtures for use with the aiida.restapi tests""" | ||
| import pytest | ||
|
|
||
|
|
||
| @pytest.fixture(scope='function') | ||
| def restapi_server(): | ||
| """Make REST API server""" | ||
| from werkzeug.serving import make_server | ||
|
|
||
| from aiida.restapi.common.config import CLI_DEFAULTS | ||
| from aiida.restapi.run_api import configure_api | ||
|
|
||
| def _restapi_server(restapi=None): | ||
| if restapi is None: | ||
| flask_restapi = configure_api() | ||
| else: | ||
| flask_restapi = configure_api(flask_api=restapi) | ||
|
|
||
| return make_server( | ||
| host=CLI_DEFAULTS['HOST_NAME'], | ||
| port=int(CLI_DEFAULTS['PORT']), | ||
| app=flask_restapi.app, | ||
| threaded=True, | ||
| processes=1, | ||
| request_handler=None, | ||
| passthrough_errors=True, | ||
| ssl_context=None, | ||
| fd=None | ||
| ) | ||
|
|
||
| return _restapi_server | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def server_url(): | ||
| from aiida.restapi.common.config import CLI_DEFAULTS, API_CONFIG | ||
|
|
||
| return 'http://{hostname}:{port}{api}'.format( | ||
| hostname=CLI_DEFAULTS['HOST_NAME'], port=CLI_DEFAULTS['PORT'], api=API_CONFIG['PREFIX'] | ||
| ) | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def restrict_sqlalchemy_queuepool(aiida_profile): | ||
| """Create special SQLAlchemy engine for use with QueryBuilder - backend-agnostic""" | ||
| from aiida.manage.manager import get_manager | ||
|
|
||
| backend_manager = get_manager().get_backend_manager() | ||
| backend_manager.reset_backend_environment() | ||
| backend_manager.load_backend_environment(aiida_profile, pool_timeout=1, max_overflow=0) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.