-
Notifications
You must be signed in to change notification settings - Fork 89
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
Add hail backend - intitial status check #3480
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
6ce744a
add hail search status endpoint
hanars 1c0d173
add unit tests
hanars 31b1204
add hail to test
hanars 39f7289
fix python name
hanars ab42838
actually fix python name
hanars 84e6bf9
checkout code
hanars 31bfc0d
add docker ignore
hanars f5aacfc
codacy fixes
hanars 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 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 |
---|---|---|
|
@@ -5,6 +5,7 @@ static/* | |
!static/images/* | ||
deploy/* | ||
!deploy/docker/seqr/* | ||
hail_search/* | ||
.git | ||
.vscode | ||
.idea |
This file contains 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
Empty file.
This file contains 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,16 @@ | ||
from aiohttp import web | ||
|
||
from hail_search.web_app import init_web_app | ||
|
||
|
||
def run(): | ||
app = init_web_app() | ||
web.run_app( | ||
app, | ||
host='0.0.0.0', # nosec | ||
port=5000, | ||
access_log_format='%{From}i "%r" %s %Tfs', | ||
) | ||
|
||
|
||
run() |
This file contains 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,2 @@ | ||
coverage<5.2 | ||
pytest-aiohttp |
This file contains 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,48 @@ | ||
# | ||
# This file is autogenerated by pip-compile with Python 3.9 | ||
# To update, run: | ||
# | ||
# pip-compile hail_search/requirements-test.in | ||
# | ||
aiohttp==3.8.4 | ||
# via pytest-aiohttp | ||
aiosignal==1.3.1 | ||
# via aiohttp | ||
async-timeout==4.0.2 | ||
# via aiohttp | ||
attrs==23.1.0 | ||
# via aiohttp | ||
charset-normalizer==3.2.0 | ||
# via aiohttp | ||
coverage==5.1 | ||
# via -r hail_search/requirements-test.in | ||
exceptiongroup==1.1.2 | ||
# via pytest | ||
frozenlist==1.3.3 | ||
# via | ||
# aiohttp | ||
# aiosignal | ||
idna==3.4 | ||
# via yarl | ||
iniconfig==2.0.0 | ||
# via pytest | ||
multidict==6.0.4 | ||
# via | ||
# aiohttp | ||
# yarl | ||
packaging==23.1 | ||
# via pytest | ||
pluggy==1.2.0 | ||
# via pytest | ||
pytest==7.4.0 | ||
# via | ||
# pytest-aiohttp | ||
# pytest-asyncio | ||
pytest-aiohttp==1.0.4 | ||
# via -r hail_search/requirements-test.in | ||
pytest-asyncio==0.21.0 | ||
# via pytest-aiohttp | ||
tomli==2.0.1 | ||
# via pytest | ||
yarl==1.9.2 | ||
# via aiohttp |
This file contains 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,15 @@ | ||
from aiohttp.test_utils import AioHTTPTestCase | ||
|
||
from hail_search.web_app import init_web_app | ||
|
||
|
||
class HailSearchTestCase(AioHTTPTestCase): | ||
|
||
async def get_application(self): | ||
return init_web_app() | ||
|
||
async def test_status(self): | ||
async with self.client.request('GET', '/status') as resp: | ||
self.assertEqual(resp.status, 200) | ||
resp_json = await resp.json() | ||
self.assertDictEqual(resp_json, {'success': True}) |
This file contains 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,17 @@ | ||
from aiohttp import web | ||
import hail as hl | ||
import logging | ||
|
||
|
||
async def status(request: web.Request) -> web.Response: | ||
return web.json_response({'success': True}) | ||
|
||
|
||
def init_web_app(): | ||
logging.basicConfig(level=logging.INFO) | ||
hl.init() | ||
app = web.Application() | ||
app.add_routes([ | ||
web.get('/status', status), | ||
]) | ||
return app |
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.
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.
It looks like a backend service web app without authentication support. It should not be accessible from external.
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.
Correct. The hail backend service will only be accessible via an internal, unauthenticated kubernetes service, so that only seqr can access it. Actually setting up the deployment is out of scope of this PR, but you can see the kubernetes yaml that I used to get this working in a test environment here: https://github.com/broadinstitute/seqr/blob/62084009dd60a35eef1c85608ad0c8a3e2a90cf8/deploy/kubectl_helpers/utils/hail-search.yaml