-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract OAK RPC as a fully standalone service (#371)
### Related issues - Closes #368 ### Summary - adds Dockerfile for the OAK RPC service image. It's based on the API image, but changes the startup script (i.e., to just run the OAK RPC server, not the Monarch API server) and includes a healthcheck script for testing the service within the container - adds a step to the `build-and-deploy-images` GH workflow to build the new image - removes launching and waiting on the OAK RPC server to start from the API's startup script ### Checks - [ ] All tests have passed (or issues created for failing tests)
- Loading branch information
1 parent
4467911
commit cf34405
Showing
6 changed files
with
56 additions
and
189 deletions.
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
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
This file was deleted.
Oops, something went wrong.
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,23 @@ | ||
# This Dockerfile is used to build a supplementary image, based on | ||
# the Monarch API image, that runs the OAK RPC server. | ||
# Note that it takes a build argument, FROM_IMAGE, which should be the | ||
# API image and tag that's associated with the current build. | ||
# It assumes that the build context is the root of the repository. | ||
# The image is built using the following command structure: | ||
# (from the root of the repository, i.e. .../monarch-app) | ||
# docker build \ | ||
# --build-arg="FROM_IMAGE=<API image:tag>" \ | ||
# -f services/oak_lib/Dockerfile . | ||
|
||
ARG FROM_IMAGE | ||
FROM ${FROM_IMAGE} | ||
|
||
COPY ./services/oak_rpc_server/start_rpc_service.sh /var/oak_server/start_rpc_service.sh | ||
COPY ./services/oak_rpc_server/rpc_healthcheck.py /var/oak_server/rpc_healthcheck.py | ||
|
||
HEALTHCHECK \ | ||
--interval=30s --timeout=15s --retries=3 \ | ||
--start-period=120s \ | ||
CMD poetry run python /var/oak_server/rpc_healthcheck.py || exit 1 | ||
|
||
CMD /var/oak_server/start_rpc_service.sh |
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,19 @@ | ||
#!/usr/bin/env python | ||
|
||
from monarch_py.api.config import OakRPCMarshaller | ||
|
||
def main(): | ||
try: | ||
oak = OakRPCMarshaller() | ||
|
||
# run the 'warmup' query from init_semsim() | ||
# note, this is roughly equivalent to | ||
# /v3/api/semsim/compare/MP%3A0010771/HP%3A0004325 | ||
oak.compare( subjects=["MP:0010771"], objects=["HP:0004325"]) | ||
|
||
except Exception as ex: | ||
print(ex) | ||
exit(1) | ||
|
||
if __name__ == '__main__': | ||
main() |
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,3 @@ | ||
#!/bin/bash | ||
|
||
poetry run python -m src.monarch_py.api.oak_server |