Skip to content

Commit

Permalink
Fail hard if sync libs not available
Browse files Browse the repository at this point in the history
  • Loading branch information
moradology committed Jun 4, 2024
1 parent 498c20f commit 37cd76d
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions pangeo_forge_recipes/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,15 +229,11 @@ def _add_query_string_secrets(fname: str, secrets: dict) -> str:
def _get_opener(fname, secrets, fsspec_sync_patch, **open_kwargs):
if fsspec_sync_patch:
logger.debug("Attempting to enable synchronous filesystem implementations in FSSpec")
try:
from httpfs_sync.core import SyncHTTPFileSystem
from httpfs_sync.core import SyncHTTPFileSystem

SyncHTTPFileSystem.overwrite_async_registration()
logger.debug("Synchronous HTTP implementation enabled.")

SyncHTTPFileSystem.overwrite_async_registration()
logger.debug("Synchronous HTTP implementation enabled.")
except ImportError:
logger.warning(
"httpfs_sync could not be imported. Falling back to async http implementation."
)

fname = fname if not secrets else _add_query_string_secrets(fname, secrets)
return fsspec.open(fname, mode="rb", **open_kwargs)
Expand Down

0 comments on commit 37cd76d

Please sign in to comment.