Skip to content

Commit

Permalink
Fix bug of removing layer inside thread
Browse files Browse the repository at this point in the history
  • Loading branch information
kshitijrajsharma committed Jan 22, 2024
1 parent 4e4d357 commit 4f67499
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions backend/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ def process_feature(feature, aoi_id, foreign_key_id, feedback=False):
tags = properties["tags"]
geometry = feature["geometry"]
if feedback:
FeedbackLabel.objects.filter(aoi__id=aoi_id).delete()
if FeedbackLabel.objects.filter(
osm_id=int(osm_id), feedback_aoi__training=foreign_key_id
).exists():
Expand All @@ -210,7 +209,6 @@ def process_feature(feature, aoi_id, foreign_key_id, feedback=False):
)

else:
Label.objects.filter(aoi__id=aoi_id).delete()
if Label.objects.filter(
osm_id=int(osm_id), aoi__dataset=foreign_key_id
).exists():
Expand Down Expand Up @@ -247,7 +245,10 @@ def process_geojson(geojson_file_path, aoi_id, feedback=False):
max_workers = (
(os.cpu_count() - 1) if os.cpu_count() != 1 else 1
) # leave one cpu free always

if feedback:
FeedbackLabel.objects.filter(aoi__id=aoi_id).delete()
else :
Label.objects.filter(aoi__id=aoi_id).delete()
# max_workers = os.cpu_count() # get total cpu count available on the

with open(geojson_file_path) as f:
Expand Down

0 comments on commit 4f67499

Please sign in to comment.