Merge pull request #226 from Hestia-Homes/main

Allowing all s3 permissions for predictions bucket for sapmodel
This commit is contained in:
KhalimCK 2023-09-12 19:00:20 +01:00 committed by GitHub
commit bafba8f4c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 10 deletions

View file

@ -399,17 +399,11 @@ async def trigger_plan(body: PlanTriggerRequest):
) )
# Retrieve the predictions # Retrieve the predictions
logger.info("Retrieving predictions from s3")
test = read_csv_from_s3(
bucket_name="retrofit-sap-predictions-{environment}".format(environment=get_settings().ENVIRONMENT),
filepath=response["storage_filepath"]
)
predictions = pd.DataFrame(read_csv_from_s3( predictions = pd.DataFrame(read_csv_from_s3(
bucket_name="retrofit-sap-predictions-{environment}".format(environment=get_settings().ENVIRONMENT), bucket_name="retrofit-sap-predictions-{environment}".format(environment=get_settings().ENVIRONMENT),
filepath=response["storage_filepath"] filepath=response["storage_filepath"]
)) ))
# We round the predictions # We round the predictions
predictions["RDSAP_CHANGE"] = predictions["RDSAP_CHANGE"].astype(float).round(0) predictions["RDSAP_CHANGE"] = predictions["RDSAP_CHANGE"].astype(float).round(0)
# Extract property_id and recommendation_id # Extract property_id and recommendation_id

View file

@ -30,9 +30,10 @@ provider:
# Allow reading and writing to PREDICTIONS_BUCKET # Allow reading and writing to PREDICTIONS_BUCKET
- Effect: Allow - Effect: Allow
Action: Action:
- s3:GetObject - s3:*
- s3:PutObject # - s3:GetObject
- s3:ListBucket # - s3:PutObject
# - s3:ListBucket
Resource: Resource:
- arn:aws:s3:::${env:PREDICTIONS_BUCKET} - arn:aws:s3:::${env:PREDICTIONS_BUCKET}
- arn:aws:s3:::${env:PREDICTIONS_BUCKET}/* - arn:aws:s3:::${env:PREDICTIONS_BUCKET}/*