File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5555
5656def load_aois () -> dict :
5757 """Fetch aois.json from S3. Returns {} on failure."""
58+ import traceback
59+ bucket = os .getenv ("S3_BUCKET_NAME" , "environment-monitor" )
60+ key_id = os .getenv ("AWS_ACCESS_KEY_ID" , "NOT SET" )
61+ region = os .getenv ("AWS_DEFAULT_REGION" , "NOT SET" )
62+ print (f"DEBUG load_aois: bucket={ bucket } region={ region } key_id={ key_id [:6 ]} ..." )
5863 try :
59- import os
6064 s3 = boto3 .client ("s3" )
61- bucket = os .getenv ("BUCKET_NAME" , "env_monitor" )
6265 resp = s3 .get_object (Bucket = bucket , Key = "aois.json" )
63- return json .loads (resp ["Body" ].read ().decode ("utf-8" ))
66+ data = json .loads (resp ["Body" ].read ().decode ("utf-8" ))
67+ print (f"DEBUG load_aois: loaded { list (data .keys ())} countries" )
68+ return data
6469 except Exception as e :
65- print (f"Could not load aois.json: { e } " )
70+ print (f"ERROR load_aois: { e } " )
71+ traceback .print_exc ()
6672 return {}
6773
6874
@@ -371,6 +377,8 @@ def load_data(aoi_value: str):
371377 country = sel ["country" ]
372378 aoi_name = sel ["aoi_name" ]
373379
380+ print (f"DEBUG load_data: country={ country } aoi={ aoi_name } " )
381+ print (f"DEBUG load_data: S3_BUCKET_NAME={ os .getenv ('S3_BUCKET_NAME' )} AWS_KEY={ os .getenv ('AWS_ACCESS_KEY_ID' ,'NOT SET' )[:6 ]} ..." )
374382 reader = DataReader (country = country )
375383
376384 # time series
You can’t perform that action at this time.
0 commit comments