diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index e7fd1b5..164036b 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -26,6 +26,7 @@ jobs: pip install -r tests/requirements.txt - name: Pre build mock server docker image run: | + cd src/ docker build -t arterys_inference_server . - name: Test the mock inference server run: | diff --git a/README.md b/README.md index fbe7de4..ab3e7ec 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,8 @@ The SDK helps you containerize your model into a Flask app with a predefined API ## Integrating the SDK You should use this SDK to allow the Arterys web app to invoke your model. -The `gateway.py` is a helper class that creates a Flask server to communicate with the Arterys app via HTTP. +You will find the files needed for the integration in the `src` folder. +The `src/gateway.py` is a helper class that creates a Flask server to communicate with the Arterys app via HTTP. You will have to provide 2 endpoints: @@ -43,7 +44,7 @@ You should handle healthcheck requests by returning a string 'READY' if your ser Otherwise return something else, with status code 200 in both cases. Returning "READY" too early will result in failures due to requests being sent too early. -You can do this by modifying the `healthcheck_handler` function in `mock_server.py` +You can do this by modifying the `healthcheck_handler` function in `src/mock_server.py` ### Handling an inference request @@ -92,7 +93,7 @@ if __name__ == '__main__': app.run(host='0.0.0.0', port=8000, debug=True, use_reloader=True) ``` -See mock_server.py, for more examples of handlers that respond with different types of annotations. +See `mock_server.py`, for more examples of handlers that respond with different types of annotations. > You will normally not need to change `gateway.py`. However, you will have to **parse the request, call your model and return a response** in the `mock_server.py` @@ -349,6 +350,7 @@ This would need custom work from the Arterys support team. ```bash # Start the service. +cd src/ ./start_server.sh # View the logs diff --git a/.dockerignore b/src/.dockerignore similarity index 100% rename from .dockerignore rename to src/.dockerignore diff --git a/Dockerfile b/src/Dockerfile similarity index 100% rename from Dockerfile rename to src/Dockerfile diff --git a/gateway.py b/src/gateway.py similarity index 100% rename from gateway.py rename to src/gateway.py diff --git a/logging.yaml b/src/logging.yaml similarity index 100% rename from logging.yaml rename to src/logging.yaml diff --git a/mock_server.py b/src/mock_server.py similarity index 100% rename from mock_server.py rename to src/mock_server.py diff --git a/requirements.txt b/src/requirements.txt similarity index 100% rename from requirements.txt rename to src/requirements.txt diff --git a/start_server.sh b/src/start_server.sh similarity index 100% rename from start_server.sh rename to src/start_server.sh diff --git a/utils/__init__.py b/src/utils/__init__.py similarity index 100% rename from utils/__init__.py rename to src/utils/__init__.py diff --git a/utils/image_conversion.py b/src/utils/image_conversion.py similarity index 100% rename from utils/image_conversion.py rename to src/utils/image_conversion.py diff --git a/utils/request_auditor.py b/src/utils/request_auditor.py similarity index 100% rename from utils/request_auditor.py rename to src/utils/request_auditor.py diff --git a/utils/tagged_logger.py b/src/utils/tagged_logger.py similarity index 100% rename from utils/tagged_logger.py rename to src/utils/tagged_logger.py diff --git a/tests/mock_server_test_case.py b/tests/mock_server_test_case.py index 286e946..01f9e36 100644 --- a/tests/mock_server_test_case.py +++ b/tests/mock_server_test_case.py @@ -23,8 +23,8 @@ def setUp(self): should_start_server = not os.getenv('ARTERYS_SDK_ASSUME_SERVER_STARTED', False) if should_start_server: print("Starting", self.test_name) - self.server_proc = subprocess.Popen(["./start_server.sh", self.command, "--name", self.test_container_name], stdout=subprocess.PIPE, - stderr=subprocess.PIPE, encoding='utf-8') + self.server_proc = subprocess.Popen(["./start_server.sh", self.command, "--name", self.test_container_name], + cwd='src', stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf-8') else: self.inference_port = os.getenv('ARTERYS_SDK_INFERENCE_SERVER_PORT', '8900') print("Assuming the server is already running.") diff --git a/tests/test_tagged_logger.py b/tests/test_tagged_logger.py index 88c2955..49e48bc 100644 --- a/tests/test_tagged_logger.py +++ b/tests/test_tagged_logger.py @@ -1,7 +1,7 @@ import unittest import logging -from utils.tagged_logger import TaggedLogger +from src.utils.tagged_logger import TaggedLogger class TestLogHandler(logging.Handler): def emit(self, record):