removed redundant bucket and fixed storage filepath

This commit is contained in:
Khalim Conn-Kowlessar 2023-10-03 17:38:56 +01:00
parent fd07605502
commit 57ed666ea7
3 changed files with 11 additions and 3 deletions

View file

@ -114,7 +114,6 @@ jobs:
- name: Deploy to AWS Lambda via Serverless
env:
RUNTIME_ENVIRONMENT: ${{ steps.set_runtime_environment.outputs.runtime_environment }}
MODEL_DIRECTORY_BUCKET: ${{ steps.s3_buckets.outputs.model_directory_bucket }}
PREDICTIONS_BUCKET: ${{ steps.s3_buckets.outputs.predictions_bucket }}
DATA_BUCKET: ${{ steps.s3_buckets.outputs.data_bucket }}
DOMAIN_NAME: ${{ steps.set_domain.outputs.domain }}

View file

@ -17,6 +17,8 @@ from core.DataClient import dataclient_factory
logger = logging.getLogger()
logger.setLevel(logging.INFO)
PREDICTIONS_BUCKET = os.getenv("PREDICTIONS_BUCKET", None)
def upload_dataframe_to_s3(df, bucket, s3_file_name):
"""
@ -65,7 +67,9 @@ def handler(event, context):
# TODO: Implement the loading of the model and prediction
storage_filepath = f"{portfolio_id}/{property_id}/{created_at}.csv"
storage_filepath = (
f"s3://{PREDICTIONS_BUCKET}/{portfolio_id}/{property_id}/{created_at}.csv"
)
logger.info("-------------------------")
logger.info(f"--- Initiate MLModel ---")
@ -78,11 +82,17 @@ def handler(event, context):
model = model_factory(build_model_params["model_type"])
logger.info("----------------------------")
logger.info(f"--- Initiate Input DataClient ---")
logger.info("----------------------------")
input_dataclient = dataclient_factory(
dataclient_type="aws-s3",
dataclient_config=client_params["aws-s3"],
)
logger.info("----------------------------")
logger.info(f"--- Initiate Output DataClient ---")
logger.info("----------------------------")
output_dataclient = dataclient_factory(
dataclient_type="aws-s3",
dataclient_config=client_params["aws-s3"],

View file

@ -6,7 +6,6 @@ provider:
architecture: x86_64
environment:
RUNTIME_ENVIRONMENT: ${env:RUNTIME_ENVIRONMENT}
MODEL_DIRECTORY_BUCKET: ${env:MODEL_DIRECTORY_BUCKET}
PREDICTIONS_BUCKET: ${env:PREDICTIONS_BUCKET}
DATA_BUCKET: ${env:DATA_BUCKET}
DOMAIN_NAME: ${env:DOMAIN_NAME}