Skip to content

Commit 0981bb7

Browse files
committed
Fix blob call
1 parent 7b02c25 commit 0981bb7

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

functions-python/tasks_executor/src/tasks/geojson/update_geojson_files_precision.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -159,26 +159,26 @@ def update_geojson_files_precision_handler(
159159
if processed % 100 == 0:
160160
logging.info("Processed %s/%s", processed, len(feeds))
161161
db_session.commit()
162-
with storage.Blob(
162+
file = storage.Blob(
163163
bucket=bucket, name=f"{feed.stable_id}/{GEOLOCATION_FILENAME}"
164-
) as file:
165-
if not file.exists():
166-
logging.info("File does not exist: %s", file.name)
167-
continue
168-
logging.info("Processing file: %s", file.name)
169-
text = file.download_as_text()
170-
geojson = json.loads(text)
171-
172-
geojson = process_geojson(geojson, precision)
173-
if not geojson:
174-
logging.info("No valid GeoJSON features found in %s", file.name)
175-
176-
# Optionally upload processed geojson
177-
if not dry_run:
178-
_upload_file(bucket, geojson)
179-
_update_feed_info(feed, timestamp)
180-
181-
processed += 1
164+
)
165+
if not file.exists():
166+
logging.info("File does not exist: %s", file.name)
167+
continue
168+
logging.info("Processing file: %s", file.name)
169+
text = file.download_as_text()
170+
geojson = json.loads(text)
171+
172+
geojson = process_geojson(geojson, precision)
173+
if not geojson:
174+
logging.info("No valid GeoJSON features found in %s", file.name)
175+
176+
# Optionally upload processed geojson
177+
if not dry_run:
178+
_upload_file(bucket, geojson)
179+
_update_feed_info(feed, timestamp)
180+
181+
processed += 1
182182
except Exception as e:
183183
logging.exception("Error processing feed %s: %s", feed.stable_id, e)
184184
errors.append(feed.stable_id)

0 commit comments

Comments
 (0)