in components/processing/libs/processor-base/src/processors/base/gcsio.py [0:0]
def write_folder_as_gcs(self) -> Iterator[str]:
"""Writable GCS folder that will downloaded if necessary."""
logger.debug("Writing to %s as GCS folder", str(self))
# As GCS, use the prefix directly
if self.bucket:
yield str(self)
return
# Generate a temporary prefix
tmp_obj = GCSPath(f"{GCS_TMP_PREFIX}/tmp-prefix-{str(uuid.uuid4())}")
# Return temporary GCS directory
yield str(tmp_obj)
# Download objects to filesystem
for path in tmp_obj.list():
# Copy locally
path.copy(str(Path(self.path, Path(path.path).relative_to(tmp_obj.path))))
# Remove the object
path.delete()