-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into task/vite-update
- Loading branch information
Showing
8 changed files
with
625 additions
and
605 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import json | ||
from app.db.models.auto_spatial_advisory import RunParameters | ||
from app.utils.s3 import get_client, object_exists_v2 | ||
|
||
|
||
async def get_critical_hours_json_from_s3(run_params: RunParameters): | ||
async with get_client() as (client, bucket): | ||
key = f"critical_hours/{run_params[0].for_date.isoformat()}/{run_params[0].id}_critical_hours.json" | ||
exists = await object_exists_v2(key) | ||
if exists: | ||
res = await client.get_object(Bucket=bucket, Key=key) | ||
body = await res["Body"].read() | ||
json_content = json.loads(body) | ||
return json_content | ||
else: | ||
print("Critical hours json not found") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.