make changes to request body

This commit is contained in:
Michael Duong 2025-11-02 13:34:34 +00:00
parent 96bfeb92f9
commit c3a7866df4
2 changed files with 5 additions and 6 deletions

View file

@ -86,7 +86,7 @@ jobs:
- name: Test Lambda endpoint
run: |
sleep 5
RESPONSE=$(curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"body": "{\"file_location\": \"cicd://retrofit-data-dev/sap_change_model/sample_data_for_cicd/${timestamp}/sample_test.parquet\", \"property_id\": 1, \"portfolio_id\": 4, \"created_at\": \"now\"}"}')
RESPONSE=$(curl -XPOST "http://localhost:9000/2015-03-31/functions/function/invocations" -d '{"body": "{\"file_location\": \"s3://retrofit-data-dev/sap_change_model/sample_data_for_cicd/${timestamp}/sample_test.parquet\", \"property_id\": 1, \"portfolio_id\": 4, \"created_at\": \"now\", \"testing\": true}"}')
echo "Lambda response: $RESPONSE"
if [[ $RESPONSE != *"predictions"* ]]; then
echo "Lambda invocation failed"
@ -94,6 +94,7 @@ jobs:
fi
- name: Remove uploaded sample row dataset from S3
if: always()
env:
AWS_ACCESS_KEY_ID: ${{ secrets.ROBOT_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.ROBOT_AWS_SECRET_ACCESS_KEY }}

View file

@ -67,11 +67,9 @@ def handler(event, context):
# TODO: Implement the loading of the model and prediction
if body["file_location"].startswith("cicd://"):
storage_filepath = (
body["file_location"]
.replace("cicd://", "s3://")
.replace(".parquet", "_output.parquet")
if "testing" in body:
storage_filepath = body["file_location"].replace(
".parquet", "_output.parquet"
)
else:
storage_filepath = f"s3://{PREDICTIONS_BUCKET}/{portfolio_id}/{property_id}/{created_at}.parquet"