working on dockerfile and handler and added new s3 bucket

This commit is contained in:
Khalim Conn-Kowlessar 2023-09-01 12:06:14 +01:00
parent a6dece3507
commit 058194fc14
4 changed files with 25 additions and 9 deletions

View file

@ -108,6 +108,12 @@ module "retrofit_sap_predictions" {
allowed_origins = var.allowed_origins
}
module "retrofit_sap_data" {
source = "./modules/s3"
bucketname = "retrofit-data-${var.stage}"
allowed_origins = var.allowed_origins
}
# Set up the route53 record for the API
module "route53" {

View file

@ -1,20 +1,22 @@
FROM public.ecr.aws/lambda/python:3.10
# Set the working directory
WORKDIR ${LAMBDA_TASK_ROOT}
WORKDIR ${LAMBDA_TASK_ROOT}/simulation_system
# 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
COPY requirements/predictions/predictions-dev.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 ./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
COPY ./core ./core
COPY ./MLModel ./MLModel
COPY ./predictions.py ./predictions.py
COPY ./handlers/predictions_app.py ./predictions_app.py
COPY ./__init__.py ./__init__.py
# Run off a lambda trigger
CMD [ "simulation_system.predictions_app.handler" ]
CMD [ "predictions_app.handler" ]

View file

@ -1,14 +1,16 @@
import os
import urllib.parse
from ..predictions import prediction
from predictions import prediction
RUNTIME_ENVIRONMENT = os.environ.get("RUNTIME_ENVIRONMENT", "dev")
def handler(event, context):
def handler():
"""
Take in event and trigger the prediction pipeline
"""
print("HIHIHI")
event = {}
# Assuming a file in a bucket landing for now?
# Assuming we have a model to use
@ -43,3 +45,7 @@ def handler(event, context):
except (Exception, KeyError, ValueError):
print("Prediction failed")
if __name__ == "__main__":
handler()

View file

@ -1,3 +1,5 @@
autogluon==0.8.2
pandas==1.5.3
s3fs==2023.6.0
seaborn==0.12.2
matplotlib==3.7.2