From 41c600abca3daefdd1283d97575e5cf1e4c47f63 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Thu, 31 Aug 2023 21:07:49 +0100 Subject: [PATCH 1/5] removing v1 from basePath --- sapmodel.serverless.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sapmodel.serverless.yml b/sapmodel.serverless.yml index 50567b36..a37e2df5 100644 --- a/sapmodel.serverless.yml +++ b/sapmodel.serverless.yml @@ -19,7 +19,7 @@ plugins: custom: customDomain: domainName: api.${self:provider.environment.DOMAIN_NAME} - basePath: 'v1/sapmodel' + basePath: 'sapmodel' createRoute53Record: true certificateArn: ${ssm:/ssl_certificate_arn} From 29690d09be9cabc6c0ed066e99fc38f5d77863fb Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Thu, 31 Aug 2023 21:53:14 +0100 Subject: [PATCH 2/5] changing docker file --- .../Dockerfiles/Dockerfile.prediction.lambda | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/model_data/simulation_system/Dockerfiles/Dockerfile.prediction.lambda b/model_data/simulation_system/Dockerfiles/Dockerfile.prediction.lambda index 0c3db572..512c8150 100644 --- a/model_data/simulation_system/Dockerfiles/Dockerfile.prediction.lambda +++ b/model_data/simulation_system/Dockerfiles/Dockerfile.prediction.lambda @@ -1,17 +1,15 @@ -FROM public.ecr.aws/lambda/python:3.10 - # Set the working directory -WORKDIR ${LAMBDA_TASK_ROOT}/simulation_system +WORKDIR ${LAMBDA_TASK_ROOT} # Install python packages -COPY ../requirements/predictions/predictions.txt ./requirements.txt -RUN pip install --no-cache-dir -r requirements.txt +COPY requirements/predictions/predictions.txt ./simulation_system/requirements.txt +RUN pip install --no-cache-dir -r ./simulation_system/requirements.txt # Copy the project code to the working directory -COPY ./core ./core -COPY ./MLModel ./MLModel -COPY ./predictions.py ./predictions.py -COPY ./handlers/predictions_app.py ./predictions_app.py +COPY ./core ./simulation_system/core +COPY ./MLModel ./simulation_system/MLModel +COPY ./predictions.py ./simulation_system/predictions.py +COPY ./handlers/predictions_app.py ./simulation_system/predictions_app.py # Run off a lambda trigger -CMD [ "predictions_app.handler" ] +CMD [ "simulation_system.predictions_app.handler" ] From f8209c42ab63004c8c322ef06f378a7099206f47 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Thu, 31 Aug 2023 22:27:35 +0100 Subject: [PATCH 3/5] fix stupid dockerfile error --- .../simulation_system/Dockerfiles/Dockerfile.prediction.lambda | 2 ++ 1 file changed, 2 insertions(+) diff --git a/model_data/simulation_system/Dockerfiles/Dockerfile.prediction.lambda b/model_data/simulation_system/Dockerfiles/Dockerfile.prediction.lambda index 512c8150..2e301b24 100644 --- a/model_data/simulation_system/Dockerfiles/Dockerfile.prediction.lambda +++ b/model_data/simulation_system/Dockerfiles/Dockerfile.prediction.lambda @@ -1,3 +1,5 @@ +FROM public.ecr.aws/lambda/python:3.10 + # Set the working directory WORKDIR ${LAMBDA_TASK_ROOT} From fe6a08f031f6620a1e805ffcbc3e5a8576ab541d Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Fri, 1 Sep 2023 10:46:17 +0100 Subject: [PATCH 4/5] fixed reference to predictions --- .../Dockerfiles/Dockerfile.prediction.lambda | 3 +++ model_data/simulation_system/handlers/predictions_app.py | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/model_data/simulation_system/Dockerfiles/Dockerfile.prediction.lambda b/model_data/simulation_system/Dockerfiles/Dockerfile.prediction.lambda index 2e301b24..3ffd3354 100644 --- a/model_data/simulation_system/Dockerfiles/Dockerfile.prediction.lambda +++ b/model_data/simulation_system/Dockerfiles/Dockerfile.prediction.lambda @@ -3,6 +3,9 @@ FROM public.ecr.aws/lambda/python:3.10 # Set the working directory WORKDIR ${LAMBDA_TASK_ROOT} +# Install necessary build tools - required to test locally +RUN yum install -y gcc python3-devel + # Install python packages COPY requirements/predictions/predictions.txt ./simulation_system/requirements.txt RUN pip install --no-cache-dir -r ./simulation_system/requirements.txt diff --git a/model_data/simulation_system/handlers/predictions_app.py b/model_data/simulation_system/handlers/predictions_app.py index 1f3a5c8b..02b1673f 100644 --- a/model_data/simulation_system/handlers/predictions_app.py +++ b/model_data/simulation_system/handlers/predictions_app.py @@ -1,6 +1,6 @@ import os import urllib.parse -from predictions import prediction +from ..predictions import prediction RUNTIME_ENVIRONMENT = os.environ.get("RUNTIME_ENVIRONMENT", "dev") @@ -30,7 +30,8 @@ def handler(event, context): # model_path = os.environ.get("MODEL_PATH", "http://minio:9000/data/model_directory/") model_path = os.environ.get( "MODEL_PATH", - "s3://retrofit-model-directory-{RUNTIME_ENVIRONMENT}/RDSAP_CHANGE/autogluon/rdsap_change-medium_quality-30-2023-08-30_11-43-41/deployment/", + "s3://retrofit-model-directory-{RUNTIME_ENVIRONMENT}/RDSAP_CHANGE/autogluon/rdsap_change-medium_quality-30" + "-2023-08-30_11-43-41/deployment/", ) try: From a6dece350750cbd33b0570f0042c4eb92db5aa06 Mon Sep 17 00:00:00 2001 From: Khalim Conn-Kowlessar Date: Fri, 1 Sep 2023 10:47:58 +0100 Subject: [PATCH 5/5] removing local code from lambda --- .../simulation_system/Dockerfiles/Dockerfile.prediction.lambda | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/model_data/simulation_system/Dockerfiles/Dockerfile.prediction.lambda b/model_data/simulation_system/Dockerfiles/Dockerfile.prediction.lambda index 3ffd3354..bd7479e6 100644 --- a/model_data/simulation_system/Dockerfiles/Dockerfile.prediction.lambda +++ b/model_data/simulation_system/Dockerfiles/Dockerfile.prediction.lambda @@ -4,7 +4,7 @@ FROM public.ecr.aws/lambda/python:3.10 WORKDIR ${LAMBDA_TASK_ROOT} # Install necessary build tools - required to test locally -RUN yum install -y gcc python3-devel +# RUN yum install -y gcc python3-devel # Install python packages COPY requirements/predictions/predictions.txt ./simulation_system/requirements.txt