Skip to content

Commit

Permalink
Merge pull request #3480 from broadinstitute/add-hail-status-check
Browse files Browse the repository at this point in the history
Add hail backend - intitial status check
  • Loading branch information
hanars authored Jul 19, 2023
2 parents 37535d1 + f5aacfc commit 1f1aca9
Show file tree
Hide file tree
Showing 8 changed files with 114 additions and 0 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ static/*
!static/images/*
deploy/*
!deploy/docker/seqr/*
hail_search/*
.git
.vscode
.idea
15 changes: 15 additions & 0 deletions .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,21 @@ jobs:
coverage run --source="./matchmaker","./seqr","./reference_data","./panelapp" --omit="*/migrations/*","*/apps.py" manage.py test -p '*_tests.py' -v 2 reference_data seqr matchmaker panelapp
coverage report --fail-under=99
hail_search:
runs-on: ubuntu-latest
container: hailgenetics/hail:0.2.115

steps:
- uses: actions/checkout@v2
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip wheel
pip install -r hail_search/requirements-test.txt
- name: Run coverage tests
run: |
coverage run --source="./hail_search" --omit="./hail_search/__main__.py" -m pytest hail_search/
coverage report --fail-under=99
nodejs:
runs-on: ubuntu-latest

Expand Down
Empty file added hail_search/__init__.py
Empty file.
16 changes: 16 additions & 0 deletions hail_search/__main__.py
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()
2 changes: 2 additions & 0 deletions hail_search/requirements-test.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
coverage<5.2
pytest-aiohttp
48 changes: 48 additions & 0 deletions hail_search/requirements-test.txt
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
15 changes: 15 additions & 0 deletions hail_search/test_search.py
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})
17 changes: 17 additions & 0 deletions hail_search/web_app.py
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

0 comments on commit 1f1aca9

Please sign in to comment.