Skip to content

Commit

Permalink
Merge pull request #19 from bento-platform/backwards-compatible-moder…
Browse files Browse the repository at this point in the history
…nize

Update CI action versions, dependencies, and service-info
  • Loading branch information
davidlougheed authored Jan 20, 2023
2 parents 7fb6643 + 6c03f53 commit 2fb7f19
Show file tree
Hide file tree
Showing 12 changed files with 1,092 additions and 657 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
uses: actions/checkout@v3

- name: Run Bento build action
uses: bento-platform/bento_build_action@v0.6
uses: bento-platform/bento_build_action@v0.9.3
with:
registry: ghcr.io
registry-username: ${{ github.actor }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- name: Install flake8
run: pip install flake8
- name: Run linter
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
matrix:
python-version: [ "3.8", "3.10" ]
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v2
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
name: Set up Python
with:
python-version: ${{ matrix.python-version }}
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM ghcr.io/bento-platform/bento_base_image:python-debian-latest

# Use uvicorn (instead of hypercorn) in production since I've found
# multiple benchmarks showing it to be faster - David L
RUN pip install --no-cache-dir poetry==1.2.2 "uvicorn[standard]==0.20.0"
RUN pip install --no-cache-dir poetry==1.3.2 "uvicorn[standard]==0.20.0"

# Backwards-compatible with old BentoV2 container layout
WORKDIR /drop-box
Expand Down
2 changes: 1 addition & 1 deletion bento_drop_box_service/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
BENTO_DEBUG=os.environ.get(
"CHORD_DEBUG", os.environ.get("BENTO_DEBUG", os.environ.get("QUART_ENV", "production"))
).strip().lower() in ("true", "1", "development"),
SERVICE_ID=os.environ.get("SERVICE_ID", SERVICE_TYPE),
SERVICE_ID=os.environ.get("SERVICE_ID", str(":".join(list(SERVICE_TYPE.values())[:2]))),
SERVICE_DATA_SOURCE="minio" if MINIO_URL else "local",
SERVICE_DATA=None if MINIO_URL else SERVICE_DATA,
MINIO_URL=MINIO_URL,
Expand Down
4 changes: 3 additions & 1 deletion bento_drop_box_service/constants.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
from bento_drop_box_service import __version__

__all__ = [
"BENTO_SERVICE_KIND",
"SERVICE_NAME",
"SERVICE_TYPE",
]

BENTO_SERVICE_KIND = "drop-box"
SERVICE_NAME = "Bento Drop Box Service"
SERVICE_TYPE = {
"group": "ca.c3g.bento",
"artifact": "drop-box",
"artifact": BENTO_SERVICE_KIND,
"version": __version__,
}
18 changes: 12 additions & 6 deletions bento_drop_box_service/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
quart_bad_request_error,
quart_internal_server_error
)
from bento_lib.types import GA4GHServiceInfo
from bento_drop_box_service import __version__
from bento_drop_box_service.backend import get_backend
from bento_drop_box_service.constants import SERVICE_NAME, SERVICE_TYPE
from bento_drop_box_service.constants import BENTO_SERVICE_KIND, SERVICE_NAME, SERVICE_TYPE


drop_box_service = Blueprint("drop_box_service", __name__)
Expand Down Expand Up @@ -48,16 +49,21 @@ async def drop_box_retrieve(path) -> Response:
@drop_box_service.route("/service-info", methods=["GET"])
async def service_info() -> Response:
# Spec: https://github.com/ga4gh-discovery/ga4gh-service-info
return jsonify({
# Do a little type checking
info: GA4GHServiceInfo = {
"id": current_app.config["SERVICE_ID"],
"name": SERVICE_NAME,
"type": SERVICE_TYPE,
"description": "Drop box service for a Bento platform node.",
"organization": {
"name": "C3G",
"url": "http://www.computationalgenomics.ca"
"url": "https://www.computationalgenomics.ca"
},
"contactUrl": "mailto:[email protected].ca",
"contactUrl": "mailto:info@c3g.ca",
"version": __version__,
"env": "dev" if current_app.config["BENTO_DEBUG"] else "prod",
})
"environment": "dev" if current_app.config["BENTO_DEBUG"] else "prod",
"bento": {
"serviceKind": BENTO_SERVICE_KIND,
},
}
return jsonify(info)
2 changes: 1 addition & 1 deletion dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
FROM ghcr.io/bento-platform/bento_base_image:python-debian-latest

RUN pip install --no-cache-dir poetry==1.2.2 "uvicorn[standard]==0.20.0"
RUN pip install --no-cache-dir poetry==1.3.2 "uvicorn[standard]==0.20.0"

# Backwards-compatible with old BentoV2 container layout
WORKDIR /drop-box
Expand Down
Empty file modified entrypoint.dev.sh
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion entrypoint.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

if [ -z "${INTERNAL_PORT}" ]; then
# Set default internal port to 5000
INTERNAL_PORT=5000
export INTERNAL_PORT=5000
fi

uvicorn bento_drop_box_service.app:application \
Expand Down
1,701 changes: 1,064 additions & 637 deletions poetry.lock

Large diffs are not rendered by default.

10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "bento_drop_box_service"
version = "0.6.0"
version = "0.7.0"
description = "Drop box and basic file management service for the Bento platform."
authors = ["David Lougheed <[email protected]>", "Simon Chénard <[email protected]>"]
readme = "README.md"
packages = [{include = "bento_drop_box_service"}]
repository = "https://github.com/bento-platform/bento_service_registry"
repository = "https://github.com/bento-platform/bento_drop_box_service"
license = "LGPL-3.0-only"
classifiers = [
"Programming Language :: Python :: 3",
Expand All @@ -21,16 +21,16 @@ classifiers = [
python = "^3.8"
boto3 = "^1.26.4"
quart = "^0.18.3"
bento-lib = {extras = ["quart"], version = "^4.1.0"}
bento-lib = {extras = ["quart"], version = "^5.2.0"}
aiofiles = "^22.1.0"

[tool.poetry.group.dev.dependencies]
tox = "^3.27.0"
tox = "^4.2.8"
codecov = "^2.1.12"
coverage = "^6.5.0"
pytest = "^7.2.0"
pytest-cov = "^4.0.0"
moto = "^4.0.9"
flake8 = "^5.0.4"
pytest-asyncio = "^0.20.1"

debugpy = "^1.6.5"

0 comments on commit 2fb7f19

Please sign in to comment.