Skip to content

Commit

Permalink
Add debug statements in rawdata processing
Browse files Browse the repository at this point in the history
  • Loading branch information
kshitijrajsharma committed Apr 3, 2024
1 parent ac4628d commit 976c06e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion backend/aiproject/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@

CORS_ORIGIN_WHITELIST = ALLOWED_ORIGINS

CORS_ORIGIN_ALLOW_ALL = env("CORS_ORIGIN_ALLOW_ALL", default= False)
CORS_ALLOW_ALL_ORIGINS = env("CORS_ALLOW_ALL_ORIGINS", default= False)

REST_FRAMEWORK = {
"DEFAULT_SCHEMA_CLASS": "rest_framework.schemas.coreapi.AutoSchema",
Expand Down
7 changes: 4 additions & 3 deletions backend/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ def process_rawdata(file_download_url, aoi_id, feedback=False):
headers = {
'Referer': 'https://fair-dev.hotosm.org/' # TODO : Use request uri
}
logging.info(f"Started Processing rawdata for {aoi_id}")
r = requests.get(file_download_url, headers=headers)
# Check whether the export path exists or not
path = "temp/"
Expand All @@ -148,7 +149,7 @@ def process_rawdata(file_download_url, aoi_id, feedback=False):
if fileName != "clipping_boundary.geojson":
# Extract a single file from zip
zipObj.extract(fileName, geojson_file_path)
print(f"""Geojson file{fileName} from API wrote to disk""")
logging.DEBUG(f"""Geojson file{fileName} from API wrote to disk""")
break
geojson_file = f"""{geojson_file_path}{fileName}"""
process_geojson(geojson_file, aoi_id, feedback)
Expand Down Expand Up @@ -240,7 +241,7 @@ def process_geojson(geojson_file_path, aoi_id, feedback=False):
Raises:
ValidationErr: _description_
"""
print("Geojson Processing Started")
logging.DEBUG("Geojson Processing Started for aoi {aoi_id} in {geojson_file_path}")
if feedback:
foreign_key_id = FeedbackAOI.objects.get(id=aoi_id).training
else:
Expand All @@ -266,4 +267,4 @@ def process_geojson(geojson_file_path, aoi_id, feedback=False):
for f in tqdm(futures, total=len(data["features"])):
f.result()

print("writing to database finished")
logging.DEBUG("Raw data writing to database finished")

0 comments on commit 976c06e

Please sign in to comment.