Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possibly solve intermittent permission issues #335

Merged
merged 7 commits into from
Jan 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions gcsfs/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,13 +500,15 @@ async def _call(
self, method, path, *args, json_out=False, info_out=False, **kwargs
):
logger.debug(f"{method.upper()}: {path}, {args}, {kwargs}")
self.maybe_refresh()
path, jsonin, datain, headers, kwargs = self._get_args(path, *args, **kwargs)

for retry in range(self.retries):
try:
if retry > 0:
await asyncio.sleep(min(random.random() + 2 ** (retry - 1), 32))
self.maybe_refresh()
path, jsonin, datain, headers, kwargs = self._get_args(
path, *args, **kwargs
)
async with self.session.request(
method=method,
url=path,
Expand Down Expand Up @@ -1152,14 +1154,12 @@ def find(self, path, withdirs=False, detail=False, prefix="", **kwargs):
)
if not out and key:
try:
out = [
sync(
self.loop,
self._get_object,
path,
callback_timeout=self.callback_timeout,
)
]
out = sync(
self.loop,
self._get_object,
path,
callback_timeout=self.callback_timeout,
)
except FileNotFoundError:
out = []
dirs = []
Expand Down
5 changes: 5 additions & 0 deletions gcsfs/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
import vcr.stubs.aiohttp_stubs as aios


import fsspec.config

fsspec.config.conf.pop("gcs", None)


@pytest.yield_fixture
def token_restore():
cache = GCSFileSystem.tokens
Expand Down